Open cuddihyge opened 2 years ago
This equivalent query works. It replaces some inner UNIONS and some (prop1|prop2|prop3) clauses with VALUES clauses. So the issue with Blazegraph is in NESTING of UNIONS, where the ?s (prop1|prop2|prop3) ?o type of statement also counts as a union.
(Apologies for the backslashed single quotes in the original comment above, they are removed here too. That was not related.)
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select distinct ?Property ?Domain ?Range
FROM <http://rack001/model>
WHERE {
{
#### Outer UNION: domain and range
# ?Property optionally has a rdfs:domain
{
# No domain
# Note that ?Property needs to be repeated in each union to make the FILTER NOT EXISTS work
# Since FILTERS only apply to inner most block
VALUES ?t {owl:ObjectProperty owl:DatatypeProperty } .
?Property a ?t.
FILTER NOT EXISTS { ?Property rdfs:domain ?Domain }
} UNION {
# domain is a simple non-blank node
# rdf:Property added so we match SadlListModel:List
VALUES ?t {owl:ObjectProperty owl:DatatypeProperty rdf:Property} .
?Property a ?t.
?Property rdfs:domain ?Domain filter (!regex(str(?Domain),'^(nodeID://|_:)') || regex(str(?Domain),'XML')) .
} UNION {
# domain is a union
VALUES ?t {owl:ObjectProperty owl:DatatypeProperty } .
?Property a ?t.
?Property rdfs:domain ?d0 .
?d0 owl:unionOf ?y1.{ ?y1 rdf:rest* ?Rest13. ?Rest13 rdf:first ?Domain filter (!regex(str(?Domain),'^(nodeID://|_:)') || regex(str(?Domain),'XML')) . }
}
# ?Property optional has rdfs:range
{
# No range
# Once again ?Property is repeated in each union to make the FILTER NOT EXISTS work
# rdf:Property added so we match SadlListModel:List
VALUES ?t {owl:ObjectProperty owl:DatatypeProperty rdf:Property} .
?Property a ?t.
FILTER NOT EXISTS { ?Property rdfs:range ?Range }
} UNION {
# range is a simple non-blank node
VALUES ?t {owl:ObjectProperty owl:DatatypeProperty} .
?Property a ?t.
?Property rdfs:range ?Range filter (!regex(str(?Range),'^(nodeID://|_:)') || regex(str(?Range),'XML')) .
} UNION {
# range is a union
VALUES ?t {owl:ObjectProperty owl:DatatypeProperty} .
?Property a ?t.
?Property rdfs:range ?r0 .
?r0 owl:unionOf ?r1.{ ?r1 rdf:rest* ?Rest14. ?Rest14 rdf:first ?Range filter (!regex(str(?Range),'^(nodeID://|_:)') || regex(str(?Range),'XML')) . }
} UNION {
# range is a blanknode subclass.
# Added to partially support SadlListModel:List by skipping parameterized lists up their parents: Unparameterized list.
VALUES ?t {owl:ObjectProperty owl:DatatypeProperty} .
?Property a ?t.
?Property rdfs:range ?r0 filter (regex(str(?r0),'^(nodeID://|_:)')) .
?r0 rdfs:subClassOf ?Range.filter (!regex(str(?Range),'^(nodeID://|_:)') || regex(str(?Range),'XML'))
}
} UNION {
#### Outer UNION: restriction ####
# get the restriction
VALUES ?t {owl:ObjectPropertyowl:DatatypeProperty } .
?Property a ?t.
?rest owl:onProperty ?Property.
?rest rdf:type owl:Restriction.
# range
VALUES ?p { owl:onClass owl:allValuesFrom owl:someValuesFrom } .
{
# restriction has simple range or allValuesFrom or someValuesFrom a non-blank node
?rest ?p ?Range filter (!regex(str(?Range),'^(nodeID://|_:)') || regex(str(?Range),'XML')) .
} UNION {
# restriction has range is a union
?rest ?p ?y.
?y owl:unionOf ?z. { ?z rdf:rest* ?Rest15. ?Rest15 rdf:first ?Range filter (!regex(str(?Range),'^(nodeID://|_:)') || regex(str(?Range),'XML')) . }
}
{
# restriction is simple subClassOf non-blank node
?Domain rdfs:subClassOf ?rest filter (!regex(str(?Domain),'^(nodeID://|_:)') || regex(str(?Domain),'XML')) .
} UNION {
# restriction is subClassOf union
?dx1 rdfs:subClassOf ?rest .
?dx1 owl:unionOf ?dx2. { ?dx2 rdf:rest* ?Rest16. ?Rest16 rdf:first ?Domain filter (!regex(str(?Domain),'^(nodeID://|_:)') || regex(str(?Domain),'XML')) . }
}
}
}
This big ol' query (works in Fuseki) fails in every mode of namespace I could create. Below is the error message for the default namespace/kb
error is