- From: Holger Knublauch <holger@topquadrant.com>
- Date: Sun, 3 Jul 2016 12:39:51 +1000
- To: public-data-shapes-wg@w3.org
On 2/07/2016 1:49, Iovka Boneva wrote:
> The SHACL spec says that a sh:class constraint can appear in the context of a sh:NodeConstraint.
> (see http://w3c.github.io/data-shapes/shacl/#ClassConstraintComponent and the table in Sect. 4 http://w3c.github.io/data-shapes/shacl/#constraints).
>
> Does this mean that the following is a valid SHACL constraint ?
>
> ex:ExampleShape
> a sh:Shape ;
> sh:scopeNode ex:Bob, ex:Alice, ex:Carol ;
> sh:constraint [
> sh:class ex:Person ;
> ] .
>
> If yes, what is the semantics of this constraint ?
Yes that's valid and it means that all nodes that are validated against
the ExampleShape must be (SHACL) instances of ex:Person. I.e. the
constraint applies to the focus nodes (such as Alice and Bob) directly.
And being a SHACL instance means that subclasses of ex:Person are OK too.
>
> Here is how the semantics of sh:class is defined as a SPARQL query:
>
> SELECT $this ($this AS ?subject) $predicate (?value AS ?object)
> WHERE {
> $this $predicate ?value .
> FILTER NOT EXISTS { ?value rdf:type/rdfs:subClassOf* $class } .
> }
>
> What would be the value of the $predicate variable in this SPARQL query for the above SHACL constraint ?
In the case of node constraints, a different query would be generated
that simply binds ?value to $this. We are still discussing the details
of how to best generalize the SPARQL query templates. I plan to work on
an update to the spec using the new, generalized, path syntax this
coming week.
HTH
Holger
>
> Thanks for your help.
>
> Iovka
>
Received on Sunday, 3 July 2016 02:40:23 UTC