Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHACL shape not recognized when not explicitly typed as a sh:NodeShape #2626

Open
abrokenjester opened this issue Nov 3, 2020 · 3 comments
Assignees
Labels
📶 enhancement issue is a new feature or improvement 📦 SHACL affects the SHACL validator

Comments

@abrokenjester
Copy link
Contributor

According to the SHACL specification, asserting an explicit type for a node shape is not required:

A node shape is a shape in the shapes graph that is not the subject of a triple with sh:path as its predicate. It is recommended, but not required, for a node shape to be declared as a SHACL instance of sh:NodeShape.

(emphasis mine)

However, the SHACLSail only recognizes / applies node shapes when they are explicitly typed as such. For example,

Data:

@prefix : <http://example.org/> .
:bob a :Person ;
        :name "Bob";
        :name "Alice" .

Shape:

@prefix sh: <http://www.w3.org/ns/shacl#>.
@prefix : <http://example.org/>.

:personShape a sh:Shape; 
       sh:targetClass :Person ;
       sh:property [
           sh:path :name ;
           sh:maxCount 1
       ].

This will not trigger a validation error because the person shape is not recognized. Only if we adapt the shape definition:

@prefix sh: <http://www.w3.org/ns/shacl#>.
@prefix : <http://example.org/>.

:personShape a sh:NodeShape;
      sh:targetClass :Person ;
       sh:property [
           sh:path :name ;
           sh:maxCount 1
       ].

does the validator detect the problem in the data.

@abrokenjester abrokenjester added 🐞 bug issue is a bug 📦 SHACL affects the SHACL validator labels Nov 3, 2020
@hmottestad
Copy link
Contributor

I believe this is fixed in the new AST which uses RDFS and the SHACL schema.

@abrokenjester
Copy link
Contributor Author

I believe this is fixed in the new AST which uses RDFS and the SHACL schema.

Good to know! This is not urgent from my perspective, just something I ran into when doing some comparisons between different SHACL engines.

@hmottestad hmottestad added 📶 enhancement issue is a new feature or improvement and removed 🐞 bug issue is a bug labels Nov 12, 2020
@hmottestad
Copy link
Contributor

TODO: Make a test for this to show that it's fixed with the new AST.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📶 enhancement issue is a new feature or improvement 📦 SHACL affects the SHACL validator
Projects
None yet
Development

No branches or pull requests

2 participants