My colleague ran into an issue and sent me the following observation. I told
him I would relay it to the list.
##############
We have been seeing an inconsistency with the way multiple-expression FILTERs
applied to an OPTIONAL clause are handled. At first, SPARQL queries with the
following sort of structure,
…
WHERE {
…
?class3 rdfs:subClassOf foaf:Document .
?doc3 rdf:type ?class3 .
?doc3 dcterms:references ?bag3 .
?bag3 ?member3 ?doc
OPTIONAL {
?class4 rdfs:subClassOf foaf:Document .
?doc4 rdf:type ?class4 .
?doc4 dcterms:references ?bag4 .
?bag4 ?member4 ?doc3
FILTER (!bound(?doc4))
FILTER (!bound(?bag4) )
}
…
used to be translated, by SPARQLer Query Validator, into SPARQL Algebra that
looked like the following:
…
(leftjoin
(quadpattern
(quad <urn:x-arq:DefaultGraphNode> ?class3 rdfs:subClassOf
foaf:Document)
(quad <urn:x-arq:DefaultGraphNode> ?doc3 rdf:type ?class3)
(quad <urn:x-arq:DefaultGraphNode> ?doc3 dcterms:references ?bag3)
(quad <urn:x-arq:DefaultGraphNode> ?bag3 ?member3 ?doc)
)
(quadpattern
(quad <urn:x-arq:DefaultGraphNode> ?class4 rdfs:subClassOf
foaf:Document)
(quad <urn:x-arq:DefaultGraphNode> ?doc4 rdf:type ?class4)
(quad <urn:x-arq:DefaultGraphNode> ?doc4 dcterms:references ?bag4)
(quad <urn:x-arq:DefaultGraphNode> ?bag4 ?member4 ?doc3)
)
(exprlist (! (bound ?doc4)) (! (bound ?bag4))))))))
In the last couple of weeks, however, the “exprlist” operator never appeared,
and instead we’d see a single, AND-ed expression:
…
(leftjoin
(quadpattern
(quad <urn:x-arq:DefaultGraphNode> ?class3 rdfs:subClassOf
foaf:Document)
(quad <urn:x-arq:DefaultGraphNode> ?doc3 rdf:type ?class3)
(quad <urn:x-arq:DefaultGraphNode> ?doc3 dcterms:references ?bag3)
(quad <urn:x-arq:DefaultGraphNode> ?bag3 ?member3 ?doc)
)
(quadpattern
(quad <urn:x-arq:DefaultGraphNode> ?class4 rdfs:subClassOf
foaf:Document)
(quad <urn:x-arq:DefaultGraphNode> ?doc4 rdf:type ?class4)
(quad <urn:x-arq:DefaultGraphNode> ?doc4 dcterms:references ?bag4)
(quad <urn:x-arq:DefaultGraphNode> ?bag4 ?member4 ?doc3)
)
(&& (! (bound ?doc4)) (! (bound ?bag4))))))))
This is OK, since it represents how we have to treat the expressions anyway,
but it just worries us that we’re shooting at a moving target. Note that
recently, the “exprlist” construct has reappeared. Either changes are being
made to the SPARQL-to-SPARQL-Algebra translation, or we’re missing some fine
point of the SPARQL grammar. Either way, we need to know what’s going on.
##############
Thanks,
Tim