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

Hi!

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

And I don't see why ex:InvalidExampleInstance shouldn't be valid (I see 
your point though, i.e. negating the empty set of focus nodes results in 
all focus nodes).

With sh:NotConstraint I'm able to verify that a focus node does not 
match a certain shape, and with scopes I'm able to further narrow down 
the set of focus nodes a constraint shall apply to.

I read example[1], as follows:

.) Every instance of ex:ExampleClass must not match 
ex:ScopedExampleShape.
.) An instance of ex:ExampleClass matches ex:ScopedExampleShape, if it 
has at least one ex:someProperty. This is only relevant for focus nodes 
that have value ex:requiredValue for property ex:requiredProperty.

These constraints result in:

.) ex:ValidExampleInstance is valid since it has ex:requiredValue for 
property ex:requiredProperty and no assigned ex:someProperty.

and either:

1) ex:InvalidExampleInstance should be valid since it does not conform 
to sh:ScopedExampleShape (because there are no focus nodes it could be 
compared to).

or

2) ex:InvalidExampleInstance is invalid, because the negation of no 
focus nodes results in all focus nodes, hence it trivally conforms to 
it.

Of course, it would have been better to scope the actual 
sh:NotConstraint to have it only applied to those focus nodes having 
ex:requiredValue for property ex:requiredProperty, thus resulting in 1) 
for ex:InvalidExampleInstance.

But I don't think that 2) would have been the expected result either.

cheers,
simon



[1] 
https://github.com/w3c/data-shapes/blob/fbad86d1e379e00e1d362ede9a1e60d3cf02ef1b/data-shapes-test-suite/tests/features/core/filterShape-003.ttl


---
DDipl.-Ing. Simon Steyskal
Institute for Information Business, WU Vienna

www: http://www.steyskal.info/  twitter: @simonsteys

Am 2015-06-18 23:54, schrieb Holger Knublauch:
> 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 Friday, 19 June 2015 06:14:43 UTC