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

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 10:13:13 UTC