Re: shapes-ISSUE-129 (existential constraints): Existential constraints should be consistent [SHACL - Core]

On 16/03/2016 17:44, Dimitris Kontokostas wrote:
>
>
> On Wed, Mar 16, 2016 at 8:35 AM, Holger Knublauch 
> <holger@topquadrant.com <mailto:holger@topquadrant.com>> wrote:
>
>     Could you sketch how the SPARQL would look like for sh:equals,
>     sh:notEquals, sh:lessThan? I see no issues with the current
>     definitions, but I may be missing something. Do you have a case
>     where sh:equals and sh:notEquals are not symmetric? To me,
>     notEquals reports the intersection and equals reports violations
>     for all values that are outside of the intersection.
>
>
> I would define sh:equals as
>
> SELECT $this ($this AS ?subject) $predicate ?object
> WHERE {
>  $this $predicate ?object .
>  $this $equals ?object2 .
>  FILTER (?object != ?object2) .
> }

But this would iterate over all combinations, i.e. even for two 
identical sets of 2 values, it would produce violations. In other words, 
both properties could only ever have one value.

> similar to the existing definitions
> SELECT $this ($this AS ?subject) $predicate ?object WHERE {
>  $this $predicate ?object .
>  $this $lessThan ?object2 .
>  FILTER (!(?object < ?object2)) .
> }
> SELECT $this ($this AS ?subject) $predicate ?object WHERE {
>  $this $predicate ?object .
>  $this $lessThanOrEquals ?object2 .
>  FILTER (!(?object <= ?object2)) .
> }
> SELECT $this ($this AS ?subject) $predicate ?object WHERE {
>  $this $predicate ?object .
>  $this $notEquals ?object .
> }
> with the current definition, when a property does not exists, equals and notEquals are not symmetric since notEquals does not check for absence.
> With the suggested definition we can claim that these properties are symmetric only when we have a sh:minCount >0 on both properties

I regard these as set-operators.

sh:equals: both sets must be equal
sh:notEquals: both sets must not be equal, i.e. there are nodes outside 
of either set
sh:lessThan: all values of set1 must be < all values of set2

sh:hasValue: the set must include a given value

Holger

Received on Wednesday, 16 March 2016 08:55:16 UTC