shapes-ISSUE-146 (sh:qualifiedMinCount ): treatment of unbound results from sh:hasShape in sh:qualifiedMinCount (and elsewhere) [SHACL - Core]

shapes-ISSUE-146 (sh:qualifiedMinCount ): treatment of unbound results from sh:hasShape in sh:qualifiedMinCount (and elsewhere) [SHACL - Core]

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

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

It's hard to determine just what is going on in the SPARQL code, but appears that if any call to hasShape returns unbound then a validation result will be produced, which does not match the text.


TEXTUAL DEFINITION of sh:qualifiedMinCount
A validation result must be produced if the number of triples that have the focus node as its subject, the sh:predicate as its predicate and where validating the object against the shape specified by sh:qualifiedValueShape produces no validation results with severity sh:Violation or a failure is less than sh:qualifiedMinCount. The produced validation result must have the focus node as its sh:subject, and the sh:predicate as its sh:predicate.
SPARQL DEFINITION of sh:qualifiedMinCount

SELECT $this ($this AS ?subject) $predicate ?failure
WHERE {
 {
  SELECT (SUM(?s) AS ?count)
  WHERE {
   {
    FILTER NOT EXISTS { $this $predicate ?value } .
    BIND (0 AS ?s) .
   }
   UNION
   {
    $this $predicate ?value .
    BIND (sh:hasShape(?value, $qualifiedValueShape, $shapesGraph) AS ?hasShape) .
    BIND (IF(bound(?hasShape), IF(?hasShape, 1, 0), 'error') AS ?s) .
   }
  }
 }
 BIND (!bound(?count) AS ?failure) .
 FILTER IF(?failure, true, ?count < $qualifiedMinCount) .
}

Received on Friday, 8 April 2016 21:11:13 UTC