w3c / data-shapes

RDF Data Shapes WG repo
87 stars 33 forks source link

Standalone PropertyShape behavior #146

Closed jakubklimek closed 4 months ago

jakubklimek commented 1 year ago

I was wondering, what is the expected behavior of a standalone property shape that does not have a target specified. From the Property shape example in 2.3 I assumed, maybe wrongly, that:

ex:ExamplePropertyShape
    a sh:PropertyShape ;
    sh:path ex:email ;
    sh:description "We need at least one email value" ;
    sh:minCount 1 .

i.e. a property shape with no target specified - but not linked from the rest of the example - would result in validation of the entire data graph - passing when there is an ex:email predicate used in any triple, and failing when there is not. However, that is not the behavior of the implementations I tried (Zazuko, SHACL Play!) and now I wonder, if I understood the example correctly.

If it is not supposed to validate anything and it is just an example of a named property shape, then I think the example is confusing and it would be better if this named shape would be linked from the NodeShape instead of the equivalent blank node property shape.

The whole example:

ex:ExampleNodeShapeWithPropertyShapes
    a sh:NodeShape ;
    sh:property [
        sh:path ex:email ;
        sh:name "e-mail" ;
        sh:description "We need at least one email value" ;
        sh:minCount 1 ;
    ] ;
    sh:property [
        sh:path (ex:knows ex:email) ;
        sh:name "Friend's e-mail" ;
        sh:description "We need at least one email for everyone you know" ;
        sh:minCount 1 ;
    ] .

ex:ExamplePropertyShape
    a sh:PropertyShape ;
    sh:path ex:email ;
    sh:description "We need at least one email value" ;
    sh:minCount 1 .
HolgerKnublauch commented 1 year ago

A property shape that has no target and is not used by sh:property from another shape that has a target will not "do" anything.

The example could be improved by splitting into two, and to complete the second syntax, the example could add the triple ex:ExampleNodeShapeWithPropertyShapes sh:property ex:ExamplePropertyShape. But even then, since the node shape has no target, still no validation would happen.

HolgerKnublauch commented 4 months ago

In preparation for a potential future SHACL WG I would like to close GitHub issues that were mainly just questions. Please reopen if you disagree.