I have two queries that differ only in the filter restrictions. The more restrictive of the queries returns the correct result while the less restrictive query returns nothing.
Here's the more restrictive query: SELECT DISTINCT ?s ?p ?o ?op ?ot WHERE { ?s ?p ?o . ?o ?op ?ot FILTER (?s = nm-tr:RelationshipManager && ?p = rdfs:subClassOf) }
Here's the less restrictive query: SELECT DISTINCT ?s ?p ?o ?op ?ot WHERE { ?s ?p ?o . ?o ?op ?ot FILTER (?s = nm-tr:RelationshipManager ) } - returns nothing
I do not understand how adding a filter predicate caused Stardog to find a binding that it was unable to find previously.
As you can see in the results, ?o should have bound to bnode .bnode_5f216aed_42e5_4515_811f_5473cabb63d0_849 in the second query as it did in the first.
Below are the queries and JSON results. After the JSON result of the query that returned nothing is the query plan. SELECT DISTINCT ?s ?p ?o ?op ?ot WHERE { ?s ?p ?o . ?o ?op ?ot FILTER (?s = nm-tr:RelationshipManager && ?p = rdfs:subClassOf) }
{
"head" : {
"vars" : [ "s", "p", "o", "op", "ot" ]
},
"results" : {
"bindings" : [ {
"s" : {
"type" : "uri",
},
"p" : {
"type" : "uri",
},
"o" : {
"type" : "bnode",
"value" : "bnode_5f216aed_42e5_4515_811f_5473cabb63d0_849"
},
"op" : {
"type" : "uri",
},
"ot" : {
"type" : "uri",
}
}, {
"s" : {
"type" : "uri",
},
"p" : {
"type" : "uri",
},
"o" : {
"type" : "bnode",
"value" : "bnode_5f216aed_42e5_4515_811f_5473cabb63d0_849"
},
"op" : {
"type" : "uri",
},
"ot" : {
"type" : "bnode",
"value" : "bnode_5f216aed_42e5_4515_811f_5473cabb63d0_850"
}
} ]
}
}
SELECT DISTINCT ?s ?p ?o ?op ?ot WHERE { ?s ?p ?o . ?o ?op ?ot FILTER (?s = nm-tr:RelationshipManager ) }
{
"head" : {
"vars" : [ "s", "p", "o", "op", "ot" ]
},
"results" : {
"bindings" : [ ]
}
}
SELECT DISTINCT ?s ?p ?o ?op ?ot WHERE { ?s ?p ?o . ?o ?op ?ot FILTER (?s = nm-t
r:RelationshipManager ) }
The Query Plan:
Distinct [cardinality=0]
Projection(?s, ?p, ?o, ?op, ?ot) [cardinality=0]
sentation/RelationshipManager> AS ?s)) [cardinality=0]
MergeJoin[?o] [cardinality=0]
radeRepresentation/RelationshipManager>, ?p, ?o){all} [cardinality=8.2K]
Scan[SPOC](?o, ?op, ?ot){all} [cardinality=8.2K]