Comments (8)
Hi @mdw00d
I've run some tests and have determined the source of the problem you are seeing.
It looks like you are using the "Implicit Class Target" mechanism to find the target nodes to apply the shape to, as described in section 2.1.3.3 SHACL spec here: https://www.w3.org/TR/shacl/#implicit-targetClass.
Your shape does not have a sh:targetNode
or sh:targetClass
, instead relying on the RDFS:Class of the Shape to be the targetClass to apply the constraints to. As per this definition:
Informally, if a shape is also declared to be a class in the shapes graph then all SHACL instances of this class are a target for the shape.
If s is a SHACL instance of sh:NodeShape or sh:PropertyShape in an RDF graph G and s is also a SHACL instance of rdfs:Class in G
Unfortunately this doesn't apply to your shape because you have ex:Func
defined as type of owl:Class
, but not rdfs:Class
.
Of course, owl:Class
is a subclass of rdfs:Class
, but that is never inferred in the shapes graph because in pyshacl, as per SHACL best-practice, no inferencing (entailment) rules are ever allowed to run against the shapes graph.
So to solve your problem, simply change the definition of ex:Func to:
ex:Func a owl:Class , rdfs:Class , sh:NodeShape ;
Or, you could make it an explicit shape, by setting the sh:targetClass
, like this:
ex:Func a owl:Class , sh:NodeShape ;
rdfs:label "Func" ;
rdfs:subClassOf ex:Function ;
sh:targetClass ex:Func ;
sh:property [ a sh:PropertyShape ;
...
This method doesn't rely on the Implicit Class Target mechanism, and won't run into problems like you're seeing now.
from pyshacl.
I'm guessing the SHACL playground JS tool has a slightly relaxed interpretation of the wording in section 2.1.3.3, so perhaps checks for not only rdfs:Class but also owl:Class, when finding implicit class shapes in the shapes file.
It certainly wouldn't be too much of a stretch to also add that change to pySHACL too.
from pyshacl.
Okay, thanks. I am using a third-party tool to generate the SHACL, and unfortunately it does not add the rdfs:Class assertions, so I guess I will need to massage its output.
Again, thanks for taking a look at this.
from pyshacl.
@mdw00d Can you let me know the name of the third-party tool you're using to generate the SHACL?
If it is a popular tool, and it generates slightly incompatible Shapes, then I should probably fix pySHACL so that it works with its outputs (or communicate with the upstream developers to get it fixed on their end).
from pyshacl.
I used TopQuadrant's EDG product.
Thanks again for your assistance.
from pyshacl.
@mdw00d
After communicating with the developers at TopQuadrant, we've decided on a fix for this in pySHACL.
Your generated SHACL Shapesfile will now work correctly as of pySHACL v0.11.1 (just released).
from pyshacl.
Fixed via 5b8ffec
from pyshacl.
Thanks!
from pyshacl.
Related Issues (20)
- Returning modified data graph instead of validation report? HOT 5
- SPARQL Constraint Not Handling Multiple Results HOT 4
- Shacl shapes HOT 4
- [Discussion] Unexpected behaviour of OWL-RL reasoner HOT 2
- SPARQL constraints depend on variable names HOT 2
- Release for RDFLib 7.0 HOT 2
- assert(): cli-friendly validation + entailment api for data pipelines HOT 2
- Message template substitutions for parameters of SPARQL-based Constraint Components fail when the value is not a Literal
- CI fails on pyduktape HOT 5
- [Discussion] Pinned vs loose requirements, application vs library use cases HOT 5
- SPARQL ASK rule incorrectly passing HOT 7
- Can the prettytable dependency be upgraded to major version 3? HOT 1
- Generating SHACL-SPARQL shapes in RDFLib HOT 2
- Shacl does not seem to work on rdflib.Dataset() HOT 1
- Unable to see the validation result in pyshacl HOT 2
- How to ensure subject is not a sh:BlankNode when validating a owl:Class in an ontology? HOT 4
- owl:imports for data graph is hardcoded to false HOT 2
- pySHACL uses deprecated API `pkg_resources` HOT 4
- Trouble with qualified value shape HOT 6
- Failed to catch violations with properties that are not defined HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyshacl.