Re: Question about sh:or and the other logical operators

I think your observations are correct. sh:and and sh:or say that each 
value node must conform to all, resp one of the provided shapes. Those 
shapes may either be property shapes or nodes shapes. So

[
 sh:path ex:info ;
 sh:or ([ sh:hasValue "blue" ; ] [ sh:hasValue "red" ; ] [ sh:hasValue "purple" ; ] ) ;
]

is quite different from

[
sh:or (
 [ sh:path ex:info ; sh:hasValue "blue" ; ]
 [ sh:path ex:info ; sh:hasValue "red" ; ]
 [ sh:path ex:info ; sh:hasValue "purple" ; ]
)
]

because sh:hasValue is typically only used for property shapes, not node 
shapes.

Holger


On 21/08/2020 06:09, Håvard Ottestad wrote:
> Hi,
>
> I’ve received some questions about how the RDF4J SHACL implementation 
> handles sh:or. These have lead me down a path of trying to figure out 
> how things are supposed to work, and now I’m wondering a bit about why.
>
> The main issue is how using the logical operators introduce a new 
> contextual level.
>
> Essentially how:
>
> ex:shape1
>         a sh:NodeShape ;
>         sh:targetClass ex:Test ;
>         sh:property [
>                sh:path ex:info ;
>                sh:and ([ sh:hasValue "blue" ; ] ) ;
>         ] ;
>         .
>
> is different from:
>
> ex:shape1
>         a sh:NodeShape ;
>         sh:targetClass ex:Test ;
>         sh:property [
>                sh:path ex:info ;
>                sh:hasValue "blue" ;
>         ] ;
>         .
> The first says: “if there is a node of type ex:Test and it happens to 
> have a value for ex:info, then all those values must be “blue””.
>
> The second says: “if there is a node of type ex:Test, then it must 
> have “blue” as a value for ex:info and by extension at least one value 
> for ex:info”.
>
> I remember the discussion that lead to the introduction of 
> dash:hasValueIn, where we used sh:or ( [ sh:hasValue V1 ] [ 
> sh:hasValue V2 ] ) as a simplification for dash:hasValueIn. But this 
> was obviously wrong, since using the sh:or means that each value must 
> be either V1 or V2.
>
> Essentially this use of sh:or is equivalent to sh:in. As in that:
>
> sh:or ([ sh:hasValue "blue" ; ] [ sh:hasValue "red" ; ] [ sh:hasValue "purple" ; ] ) ;
>
> is the same as
> sh:in ("blue" "red" "purple");
>
> Am I understanding all this correctly?
>
> Cheers,
> Håvard
>
>
>
>
>
>
>
>
>
>
>

Received on Sunday, 23 August 2020 23:32:18 UTC