Comments (3)
I believe I understand part of what is going on, but not the reasons behind it.
When one splits into three separate parts, the shacl_graph does not contain the ont_graph information and cannot be processed correctly.
A simple hack that fixes the problem is one line of code in the Validator __init__
code.
shacl_graph = mix_datasets( shacl_graph, self.ont_graph )
if self.ont_graph is not None and \
isinstance(self.ont_graph, (rdflib.Dataset, rdflib.ConjunctiveGraph)):
self.ont_graph.default_union = True
shacl_graph = mix_datasets( shacl_graph, self.ont_graph )
if shacl_graph is None:
shacl_graph = clone_graph(data_graph, identifier='shacl')
assert isinstance(shacl_graph, rdflib.Graph),\
"shacl_graph must be a rdflib Graph object"
self.shacl_graph = ShapesGraph(shacl_graph, self.logger)
basically, I add the ont_graph to the shacl_graph and it works as expected.
Obviously, there are some more checks that need to go in here for a complete solution and there may be other issues I have not yet considered.
from pyshacl.
Yes, your assessment is correct, in pySHACL the shacl_graph
does not get any ont_graph
triples mixed in.
Keep in mind the extra-ontology-graph feature (ont_graph
) was specifically introduced to mix into the DataGraph for the purpose to keep DataGraph files smaller, and the practical reality that DataGraph files cannot always be relied on to contain all of the ontology definitions required for validation to work properly, especially if the Datagraph was supposed to be pre-inferenced before validation and those definitions are needed to enable inferencing.
The ont_graph
was never intended to mix with the SHACL Shapes Graph. Its considered bad practice for a shacl validator to modify the Shapes graph in any way before validation, because that can cause unforeseen validation issues (as you have alluded to).
If a SHACL Shapes Graph requires any ontological definitions in order to work correctly then it makes sense that the author should include those definitions either directly in the SHACL Shapes source file, or via an owl:imports
statement in the SHACL shapes file.
I hope that has helped.
from pyshacl.
It does. Thank you.
from pyshacl.
Related Issues (20)
- 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
- Is a shape (whether node or property) restricted to one instance of sh:not? HOT 5
- Multiple sh:nots causing strange validation results HOT 2
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.