Re: ISSUE-139: uniform descriptions and implementations of constraint components

The spec says and examples illustrate that when the scopeNode is used, the
focus node is the one identified by the scopeNode; when the scopeClass is
used the focus nodes are SHACL instances of the resource identified by the
scopeClass.

The spec also defines SHACL instance as:


A node in an RDF graph is a SHACL instance of a SHACL class  in the graph
if one of its SHACL types  is the given class.

And SHACL type as:

The SHACL types of a node in an RDF graph are its values for rdf:type in
the graph as well as the SHACL superclasses of these values in the graph.




What is missing?


As an aside, I would probably slightly change the definition of SHACL type
to:

The SHACL types of a node in an RDF graph are its property values for
rdf:type as well as the SHACL superclasses of these values.


Property values are defined in the spec, but values are not, so this is a
bit more precise.


And I would also probably change SHACL Class definition to:

Nodes in an RDF graph that are subjects or objects in graph’s triples that
have rdfs:subClassOf predicate or objects of triples that have rdf:type
predicate. SHACL makes no assumption whether any particular value for
rdf:type of a SHACL class can be found in the graph.

Assuming that the above definition is correct. I am not 100% sure.



Irene






On 6/10/16, 12:08 AM, "Karen Coyle" <kcoyle@kcoyle.net> wrote:

>It isn't a question of switching them. I find that the examples do not
>show the difference between class-defined nodes and predicate-defined
>node that uses rdf:type as the predicate. Since all rdf:type/s must be
>explicitly defined, these are either the same, or they are different,
>and if they are different, that needs to be made clear.
>
>kc
>
>On 6/9/16 9:26 AM, Irene Polikoff wrote:
>> Examples in the spec would not have the same result if scopeNode and
>> scopeClass were switched. They look pretty clear to me as they all
>> identify what focus nodes would be selected.
>>
>> May be the following will help:
>>
>> Let¹s say there is a graph like so:
>>
>> ex:Person rdfs:label ŒPerson¹.
>> ex:Person rdfs:label ŒHuman Being¹.
>> ex:Alice rdf:type ex:Person.
>> ex:Alice rdfs:label ŒAlice¹.
>> ex:Alice rdfs:label ŒAlice Jones¹.
>> ex:Bob rdf:type ex:Person.
>> ex:Joe rdf:type ex:Person.
>> ex:Joe rdfs;label ŒJoe¹.
>>
>> And a shape
>>
>> ex:Shape1
>>      a sh:Shape ;
>>      sh:scopeNode ex:Person ;
>>      sh:property [
>>          sh:predicate rdfs:label ;
>>          sh:maxCount 1 ;
>>      ] .
>>
>>
>> The node in focus is ex:Person and there will be a violation because it
>> has two labels. No other nodes are in focus, no other violations.
>>
>> If there was a different shape
>>
>> ex:Shape2
>> a sh:Shape ;
>> sh:scopeClass ex:Person ;
>> sh:property [
>> sh:predicate rdfs:label ;
>> sh:maxCount 1 ;
>> ] .
>>
>>
>> Then, three nodes are in scope - ex:Alice, ex:Bob and ex:Joe. There will
>> be one violation for ex:Alice.
>>
>> Lets look at the shape Holger has below. This shape demonstrates, among
>> other things, that the validation can look at triples with the focus
>>nodes
>> as objects by using sh:inverseProperty
>>
>> ex:MyShape
>>      a sh:Shape ;
>>      sh:scopeNode ex:Person ;
>>      sh:inverseProperty [
>>          sh:predicate rdf:type ;
>>          sh:maxCount 2 ;
>>      ] .
>>
>> The focus node is ex:Person and there will be a violation since there
>>are
>> three triples that follow the {?x rdf:type ex:Person} pattern.
>>
>>
>> Irene
>>
>>
>>
>> On 6/9/16, 1:33 AM, "Karen Coyle" <kcoyle@kcoyle.net> wrote:
>>
>>> Holger, that still doesn't explain what the difference is. What is the
>>> quality of a SHACL class that is different to a triple with a predicate
>>> of rdf:type? Are you saying that scopeClass implies/allows subclass
>>> relationships to be included? If so, that must be said in the
>>> specification, and it should be illustrated in the examples. As it is,
>>> the examples given would have the same result using either predicate.
>>>
>>> Also, the section that introduces scopeNode does not say that it
>>>applies
>>> only to the subject of a triple. If that is the case, then it needs to
>>> specify that.
>>>
>>> kc
>>>
>>> On 6/8/16 9:44 PM, Holger Knublauch wrote:
>>>>
>>>> On 9/06/2016 14:40, Karen Coyle wrote:
>>>>> sh:scopeClass <foaf:Person> and sh:scopeNode <foaf:Person> appear to
>>>>> identify the same focus node(s) in the data graph.
>>>>
>>>> sh:scopeNode means "the (class) node itself".
>>>> sh:scopeClass means "all SHACL instances of the class".
>>>>
>>>> So they do not identify the same focus nodes.
>>>>
>>>> Holger
>>>>
>>>>
>>>>
>>>>>
>>>>> ***shape1***
>>>>> ex:MyShape
>>>>>     a sh:Shape ;
>>>>>     sh:scopeNode foaf:Person ;
>>>>>     sh:inverseProperty [
>>>>>         sh:predicate rdf:type ;
>>>>>         sh:maxCount 2 ;
>>>>>     ] .
>>>>>
>>>>> ***shape2***
>>>>> ex:PersonShape
>>>>>     a sh:Shape ;
>>>>>     sh:scopeClass ex:Person .
>>>>>
>>>>> ***data graph***
>>>>>
>>>>> ex:Alice a ex:Person .
>>>>> ex:Bob a ex:Person .
>>>>> ex:NewYork a ex:Place .
>>>>>
>>>>> Where does the spec address the reason for this?
>>>>>
>>>>> kc
>>>>>
>>>>> On 6/7/16 10:09 PM, Holger Knublauch wrote:
>>>>>>
>>>>>>
>>>>>> On 8/06/2016 14:57, Karen Coyle wrote:
>>>>>>>
>>>>>>>
>>>>>>> On 6/7/16 7:38 PM, Holger Knublauch wrote:
>>>>>>>> Yes and SHACL should implement the same policy, because
>>>>>>>>sh:maxCount
>>>>>>>> also
>>>>>>>> only makes sense for predicate-based constraints and not node
>>>>>>>> constraints.
>>>>>>>
>>>>>>> Does this then rule out a constraint like "n things of type x"? For
>>>>>>> example, if you want to limit the number of foaf:Person nodes?
>>>>>>
>>>>>> No. To express "A graph must have at most 2 instances of
>>>>>>foaf:Person"
>>>>>> you would write
>>>>>>
>>>>>> ex:MyShape
>>>>>>     a sh:Shape ;
>>>>>>     sh:scopeNode foaf:Person ;
>>>>>>     sh:inverseProperty [
>>>>>>         sh:predicate rdf:type ;
>>>>>>         sh:maxCount 2 ;
>>>>>>     ] .
>>>>>>
>>>>>> In other words "there must be at most 2 triples that have
>>>>>>foaf:Person
>>>>>> as
>>>>>> object and rdf:type as predicate".
>>>>>>
>>>>>> Peter's suggested use of sh:maxCount at node constraints would mean
>>>>>>
>>>>>> "Verify that the set of value nodes is not larger than two. Oh, and
>>>>>> regardless of the actual data, I already know that this set of value
>>>>>> nodes has size 1, because it always consists of the focus node only.
>>>>>> So
>>>>>> actually I only need to test whether the value of sh:maxCount > 0."
>>>>>>
>>>>>> which is a rather useless construct. You have just confirmed that
>>>>>> misusing sh:maxCount as node constraints will likely confuse users.
>>>>>>
>>>>>> Is this difference clearer now, or what else could I clarify?
>>>>>>
>>>>>> Thanks,
>>>>>> Holger
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> Karen Coyle
>>> kcoyle@kcoyle.net http://kcoyle.net
>>> m: 1-510-435-8234
>>> skype: kcoylenet/+1-510-984-3600
>>>
>>
>>
>>
>
>-- 
>Karen Coyle
>kcoyle@kcoyle.net http://kcoyle.net
>m: 1-510-435-8234
>skype: kcoylenet/+1-510-984-3600

Received on Friday, 10 June 2016 05:31:33 UTC