- From: Holger Knublauch <holger@topquadrant.com>
- Date: Fri, 21 Aug 2015 20:26:16 +1000
- To: public-data-shapes-wg@w3.org
On 8/21/2015 17:13, RDF Data Shapes Working Group Issue Tracker wrote:
> shapes-ISSUE-83 (multiple sh:qualifiedValueShapes): How should multiple definitions of sh:qualifiedValueShape of a property constraint be treated? [SHACL Spec]
>
> http://www.w3.org/2014/data-shapes/track/issues/83
>
> Raised by: Simon Steyskal
> On product: SHACL Spec
>
> Hi!
>
> The current specification does not specify how multiple sh:qualifiedValueShapes should be treated when they are used within a single property constraint.
>
> For example, if I want to specify that there must exist exactly 3 values for ex:parent where at least 1 of them must be ex:female (and ex:male respectively), the current specification does not prohibit me from writing something like this:
>
> ex:QualifiedValueShapeExampleShape
> a sh:Shape ;
> sh:property [
> sh:predicate ex:parent ;
> sh:minCount 3 ;
> sh:maxCount 3 ;
> sh:qualifiedValueShape [
> sh:property [
> sh:predicate ex:gender ;
> sh:hasValue ex:female ;
> ]
> ] ;
> sh:qualifiedMinCount 1 ;
> sh:qualifiedValueShape [
> sh:property [
> sh:predicate ex:gender ;
> sh:hasValue ex:male;
> ]
> ] ;
> sh:qualifiedMinCount 1 ;
> ] .
This is syntactically invalid, although I believe this was not
explicitly stated in the text document of the spec. The Turtle file has
sh:AbstractArgumentMaxCountConstraint with the corresponding test. Since
it's already beer-o-clock here, could you double-check that you get a
constraint violation when you validate the snippet above? It should flag
the duplicate value for sh:qualifiedValueShape.
Meanwhile I have added a sentence to make clear that template instances
can at most have one value per argument predicate.
To express what you want, use two different sh:property blocks
ex:QualifiedValueShapeExampleShape
a sh:Shape ;
sh:property [
sh:predicate ex:parent ;
sh:minCount 3 ;
sh:maxCount 3 ;
sh:qualifiedValueShape [
sh:property [
sh:predicate ex:gender ;
sh:hasValue ex:female ;
]
] ;
sh:qualifiedMinCount 1 ;
] ;
sh:property [
sh:qualifiedValueShape [
sh:property [
sh:predicate ex:gender ;
sh:hasValue ex:male;
]
] ;
sh:qualifiedMinCount 1 ;
] .
>
> Of course, one way to approach that would be to use sh:AndConstraint for >1 qualifiedValueShapes, but that's not explicitly mentioned in the draft.
>
> btw. there is a typo in the code example of the draft ->
>
> sh:predicate [
> sh:predicate ex:gender ;
Thanks, both fixed on my current branch:
https://github.com/w3c/data-shapes/commit/da1819e33f24b3a26f140bac412fe36385e6f963
Holger
Received on Friday, 21 August 2015 10:26:54 UTC