shapes-ISSUE-131 (sh:hasShape ill defined): The definition of sh:hasShape has errors and holes [SHACL Spec]

shapes-ISSUE-131 (sh:hasShape ill defined): The definition of sh:hasShape has errors and holes [SHACL Spec]

http://www.w3.org/2014/data-shapes/track/issues/131

Raised by: Peter Patel-Schneider
On product: SHACL Spec

The SHACL spec currently defines hasShape as follows:

**************
The SPARQL definitions in this section also assume the existence of a
built-in SPARQL function sh:hasShape, which takes the following arguments:

Argument          Value Type  Summary
$focusNode    rdfs:Resource The focus node to validate.
$shape     sh:Shape   The shape to validate the focus node against.
$shapesGraph    rdfs:Resource The current shapes graph.
$recursionIsError xsd:boolean  If set to true then any recursive occurrence
      of the same resource against the same shape
    signals a failure, with the function
    returning undefined. If not true then any
    recursive occurrence must return true. 

The result of the sh:hasShape function is either true, false or
undefined. The function returns true if the validation of the ?focusNode
against the given ?shape produces no validation results with severity
sh:Violation. Note that any validation results produced inside of the
sh:hasShape function are temporary, i.e. they are not added to the results
graph of the surrounding execution environment. However, some
implementations may add those nested validation results as annotations to
the surrounding validation results, via sh:detail.
**************

There are several problems with this definition.

First, it uses type in a way different from the rest of the document.  This
is not just a case where SHACL typing changed---literals never had types in
SHACL.  (This is a good argument to use a qualifier wherever SHACL typing is
meant.)

Second, dependency loops are currently invalid in SHACL.  The precise
meaning of what is a dependency loop is is a bit uncertain, but it is
certainly the case that recursively running the same shape on the same
resource counts as a dependency loop.  sh:hasShape needs to be defined in
such a way to signal that an invalid situation has occured.

Third, some constraints need to have bindings passed through the
sh:hasShape, or they cannot correctly compute validation results.  However,
SPARQL is silent on the variable environment available inside functions so
any information has to be passed via arguments.

Fourth, arguments to SPARQL functions are RDF terms and thus are not graphs.

Received on Monday, 7 March 2016 23:49:42 UTC