on problems with EXISTS

Because of the problems with EXISTS in SPARQL many ASK-defined constraint
components have unusual meanings according to their SPARQL definition.

For example, the data graph

ex:i1 rdf:type ex:C , D ;
      ex:p _:b1 .

validates against the shapes graph

s:s1 rdf:type sh:Shape ;
  sh:targetClass ex:C ;
  sh:property [ sh:predicate ex:p ;
                sh:class ex:D ] .

This is probably not intended behaviour.


Note that this is separate from the continuing problems with pre-binding.



SPARQL definition for sh:class

ASK {
 $value rdf:type/rdfs:subClassOf* $class .
}

Resultant query

SELECT DISTINCT $this ?value
WHERE {
  $this $PATH ?value .
  FILTER NOT EXISTS { $value rdf:type/rdfs:subClassOf* $class . }
}


When validating ex:i1 the first BGP should (if pre-binding were fixed)
result in a single mapping
 { (this, ex:i1), (value, _:b1) }
EXISTS substitution then results in
  BGP(_:b1 rdf:type/rdfs:subClassOf* $class . )
which produces (again if pre-binding were fixed) a single mapping that maps
_:b1 to ex:i1
so the FILTER is false.

So the SELECT returns an empty result and so the data graph validates
against the shapes graph.f


Peter F. Patel-Schneider
Nuance Communications

Received on Thursday, 13 October 2016 03:04:50 UTC