Re: shapes-ISSUE-83 (multiple sh:qualifiedValueShapes): How should multiple definitions of sh:qualifiedValueShape of a property constraint be treated? [SHACL Spec]

Hi Simon,

thanks for the timely bug report. This issue had fallen through the 
cracks so far. The problem is that the sh:property in your example is an 
untyped blank node, and therefore the engine would (by default) not 
apply the constraints on sh:Arguments and thus not detect that 
sh:qualifiedValueShape has two values. I have fixed this on the master 
branch of the open source API and also written a separate email about a 
possible general solution for ISSUE-70:

https://lists.w3.org/Archives/Public/public-data-shapes-wg/2015Aug/0138.html

I hope this resolves your ISSUE-83.

Thanks,
Holger


On 8/21/2015 20:47, Simon Steyskal wrote:
> Hi!
>
> I've tried it with TopBraid & your API but both don't complain when 
> evaluating the following:
>
>     ex:QualifiedValueShapeExampleShape
>         a sh:ShapeClass ;
>         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 ;
>         ] .
>
>       ex:test a ex:QualifiedValueShapeExampleShape ;
>           ex:parent [ ex:gender ex:female ] ;
>           ex:parent [ ex:gender ex:female ] ;
>     ex:parent [ ex:gender ex:female ] .
>
> (They do however raise an error, if minCount/maxCount are violated.)
>
> simon
>
> ---
> DDipl.-Ing. Simon Steyskal
> Institute for Information Business, WU Vienna
>
> www: http://www.steyskal.info/  twitter: @simonsteys
>
> Am 2015-08-21 12:26, schrieb Holger Knublauch:
>> 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 Monday, 24 August 2015 02:43:23 UTC