- From: RDF Data Shapes Working Group Issue Tracker <sysbot+tracker@w3.org>
- Date: Wed, 29 Jun 2016 12:19:24 +0000
- To: public-data-shapes-wg@w3.org
shapes-ISSUE-170 (exists blank nodes): SPARQL specifies a different reading for exists and blank nodes than needed for SHACL
http://www.w3.org/2014/data-shapes/track/issues/170
Raised by: Peter Patel-Schneider
On product:
The SPARQL evaluation semantics at https://www.w3.org/TR/sparql11-query/#sparqlAlgebraEval specifies that EXISTS has a substitution semantics. The SPARQL definitions of sh:class and several other SHACL constructs use EXISTS.
This leads to incorrect results for value nodes that are blank nodes.
For example
ex:s1 rdf:type sh:Shape ;
sh:scopeClass ex:Person ;
sh:property [ sh:predicate sh:friend ;
sh:class ex:Person ] .
does not produce any violations on the graph
ex:Bill rdf:type ex:Person ;
ex:friend _:John .
What happens is that the evaluation of
SELECT $this ($this AS ?subject) $predicate (?value AS ?object)
WHERE {
$this $predicate ?value .
FILTER NOT EXISTS { ?value rdf:type/rdfs:subClassOf* $class } .
}
evaluates the EXISTS with ?value mapped to _:John. The substitution that underlies EXISTS results in
_:John rdf:type/rdfs:subClassOf* ex:Person
This triple is then matched against the graph and there is a match because _:John matches ex:Bill.
Either there needs to be an approved errata for SPARQL so that this match no longer happens, or the SHACL specification needs to say that it needs a different meaning for EXISTS, or the SPARQL definition of sh:class and the other SHACL constructs that use EXISTS need to be changed.
Received on Wednesday, 29 June 2016 12:19:25 UTC