GovDataOfficial / DCAT-AP.de-SHACL-Validation

SHACL-Shapes für DCAT-AP.de
https://www.itb.ec.europa.eu/shacl/dcat-ap.de/upload
GNU Affero General Public License v3.0
10 stars 7 forks source link

Named Property Shape With `sh:path` Only Within `sh:or` #21

Closed init-dcat-ap-de closed 1 year ago

init-dcat-ap-de commented 1 year ago

https://github.com/w3c/data-shapes/issues/147

volkerjaenisch commented 1 year ago

@init-dcat-ap-de

I am not a SHACL wizzard. But I like to help.

In the shape given by you:

ex:mainShape
    a sh:NodeShape ;
    sh:targetClass ex:TestClass ;
    sh:message "Custom message in mainShape!" ;

    sh:property ex:singlePathProperty ;
    sh:property ex:orPathProperty ;
.

you want the sh:property "ex:orPathProperty" to bear two possible paths [ex:orPathOne, ex:orPathTwo].

ex:orPathProperty
    sh:message "Custom message for ex:orPathProperty!" ;
    sh:or (
        [
            sh:path ex:orPathOne ;
            sh:minCount 1 ;
        ]
        [
            sh:path ex:orPathTwo ;
            sh:minCount 1 ;
        ] 
    )
.

This is IMHO a violation of https://www.w3.org/TR/shacl/#dfn-property-shape which claims:

A property shape is a shape in the shapes graph that is the subject of a triple that has sh:path as its predicate. A shape has at most one value for sh:path. Each value of sh:path in a shape must be a well-formed SHACL property path.

Your SHACL code violates "A [property] shape has at most one value for sh:path" since the sh:or statement gives TWO possible paths.

IMHO you have to rewrite your "properties" to become proper "nodes" since they are not limited so much.

Cheers Volker

init-dcat-ap-de commented 1 year ago

Hello,

this lead me to the solution.

Thank you!

volkerjaenisch commented 1 year ago

Is there a new version with the sh:or fixed? Unable too find, or blind :-) Cheers, Volker

init-dcat-ap-de commented 1 year ago

Updates went online today. For one use-case it was not yet possible to fix the shapes, but this use-case was minor.

All used files are now valid according to https://www.itb.ec.europa.eu/shacl/shacl/upload