Re: Using sh:scopeShape within And/Xor/Not/OR Constraints

On 6/18/15 9:15 PM, Simon Steyskal wrote:
> Hi!
>
>> In the sense of the recursion, it means
>> sh:hasShape() evaluates to true, with whatever consequences this has
>> on the And/Or logic.
>
> And what about Not or Xor? E.g assume there are 2 shapes within a 
> sh:XorConstraint -> one of them is scoped, the other one not.
> If hasShape() returns true for the scoped shape (because its scope 
> evaluates to false) and true for the unscoped one (because the node 
> actually matches the shape), then the whole XorConstraint evaluates to 
> false?

Yes. And my previous link already had an example for Not.

>
> Same with sh:NotConstraint.. if it contains a single scoped shape 
> whose scope evaluates to false then sh:hasShape() returns true, thus 
> sh:NotConstraint(true) = false?
>
> I also noticed that in the examples you've linked, sh:filterShape was 
> used instead of sh:scopeShape. Is "filter" the new term for "scope"? 
> If yes, I would recommend to adapt the specification respectively.

We have a long-running parallel thread under "a clean proposal for 
ISSUE-62" in which I propose to rename sh:scopeShape to sh:filterShape. 
This is not approved yet and therefore lives on a branch for now, 
together with other changes.

Holger


>
> cheers,
> simon
>
> ---
> DDipl.-Ing. Simon Steyskal
> Institute for Information Business, WU Vienna
>
> www: http://www.steyskal.info/  twitter: @simonsteys
>
> Am 2015-06-18 12:10, schrieb Holger Knublauch:
>> On 6/18/2015 18:58, Simon Steyskal wrote:
>>> Hi!
>>>
>>> Regarding the validation of a shape that has an attached 
>>> sh:scopeShape, the specification currently says:
>>>
>>> "If the scope shape returns an error-level constraint violation, 
>>> then the constraint must be ignored"
>>
>> If a constraint is ignored, the consequence is that no constraint
>> violation will be found. So the nodes that don't pass the scope/filter
>> test will match the shape. In the sense of the recursion, it means
>> sh:hasShape() evaluates to true, with whatever consequences this has
>> on the And/Or logic.
>>
>> I have added your two scenarios to our tests:
>>
>> https://github.com/w3c/data-shapes/commit/fbad86d1e379e00e1d362ede9a1e60d3cf02ef1b 
>>
>>
>> Results hopefully self-explanatory (ValidExampleInstance is OK,
>> InvalidExampleInstance not OK).
>>
>> Regards,
>> Holger
>>
>>
>>>
>>> I'm not 100% sure how this (may) influences the validation of 
>>> And/Xor/Not/OR Constraints if they contain such a scoped shape whose 
>>> scope validation returns an error. Futhermore, what happens if all 
>>> shapes of And/Xor/Not/OR Constraints are scoped shapes having 
>>> violated/non-matching scopes?
>>>
>>> cheers,
>>> simon
>>>
>>> ------------------------------------------------------------------
>>> Example1: AndConstraint containing 2 shapes, only 1 fires -> Will I 
>>> get a Validation Error?
>>>
>>> ex:ScopedExampleShape
>>>   a sh:Shape ;
>>>     sh:property [
>>>       sh:predicate ex:someProperty ;
>>>       sh:minCount 1 ;
>>>       sh:scopeShape [
>>>         sh:property [
>>>           sh:predicate ex:requiredProperty ;
>>>           sh:hasValue ex:requiredValue ;
>>>     ]
>>>       ]
>>>     ] .
>>>
>>> ex:NotScopedExampleShape
>>>   a sh:Shape ;
>>>     sh:property [
>>>       sh:predicate ex:someProperty ;
>>>       sh:maxCount 1 ;
>>>     ] .
>>>
>>> ex:ExampleClass
>>>   a sh:ShapeClass;
>>>     sh:constraint [
>>>       a sh:AndConstraint ;
>>>       sh:shapes (
>>>         ex:ScopedExampleShape
>>>         ex:NotScopedExampleShape
>>>       )
>>>     ]
>>>
>>> ex:ScopedShapeExampleInstance
>>>     ex:someProperty ex:someValue ;
>>>     ex:requiredProperty ex:notRequiredValue .
>>>
>>> ------------------------------------------------------------------
>>> Example2: NotConstraint containing 1 shape that does not fire -> 
>>> empty NotConstraint?
>>>
>>> ex:ScopedExampleShape
>>>   a sh:Shape ;
>>>     sh:property [
>>>       sh:predicate ex:someProperty ;
>>>       sh:minCount 1 ;
>>>       sh:scopeShape [
>>>         sh:property [
>>>           sh:predicate ex:requiredProperty ;
>>>           sh:hasValue ex:requiredValue ;
>>>     ]
>>>       ]
>>>     ] .
>>>
>>> ex:ExampleClass
>>>   a sh:ShapeClass;
>>>     sh:constraint [
>>>       a sh:NotConstraint ;
>>>       sh:shape ex:ScopedExampleShape;
>>>     ]
>>>
>>> ex:ScopedShapeExampleInstance
>>>     ex:someProperty ex:someValue ;
>>>     ex:requiredProperty ex:notRequiredValue .
>>>

Received on Thursday, 18 June 2015 21:54:40 UTC