w3c / data-shapes

RDF Data Shapes WG repo
87 stars 33 forks source link

Can property shapes be closed? #134

Closed wouterbeek closed 3 years ago

wouterbeek commented 3 years ago

I was under the impression that only node shapes could be sh:closed, based on the following Figure in the standard: link

But I sometimes see people apply sh:closed to property shapes as well 'in the wild'. Looking this up in the vocabulary, the rdfs:domain of sh:closed is not specified: link. This strengthens the belief of people who apply sh:closed to property shapes that the SHACL standard may allow this, or does at least not actively prohibit this.

I'm not sure what the meaning of a closed property shape is... TWIUI a closed node shape addresses the specification of its properties. Since property shapes do not have property specifications at all, the application of sh:closed to properties shapes seem meaningless to me.

Given the above, would it be better to make explicit that sh:closed rdfs:domain sh:NodeShape?

HolgerKnublauch commented 3 years ago

Property shapes may also carry sh:property constraints, see https://github.com/w3c/data-shapes/blob/gh-pages/data-shapes-test-suite/tests/core/property/property-001.ttl

I haven't seen this much (basically never) in practice but the WG allowed this for symmetry reasons. Therefore, in principle, sh:closed is also permitted for property shapes.

If you have seen this use of sh:closed 'in the wild' can you share these examples?

wouterbeek commented 3 years ago

The examples were by others. (I have never tried to close a property shape myself.) I would like to dissuade people from closing property shapes. If the standard would have disallowed this than this would have been a viable argument in trying to convince such people.

Closing node shapes breaks hierarchic reuse, at least in the default case / without complex workarounds (see #129). IMO sh:closed has some issues in practice: its use on property shapes is unclear and its use on node shapes come with significant caveats. It seems great at first to detect mistyped properties, but after having looked for workarounds for a while I have come to the conclusion that they bring more harm than good.

HolgerKnublauch commented 3 years ago

They were invented for ShEx and then hastily added to SHACL. I agree they don't fit well in a language that is more class-centric than ShEx.