-
Notifications
You must be signed in to change notification settings - Fork 63
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
Access to inferred triples #20
Comments
Hi @JoelBender
If you're using the commandline tool, it can be enabled by passing pySHACL uses the OWL-RL library to do the inferencing step. They way Your question however is about getting access to the data graph containing the inferred triples. If you are using the commandline tool, this is not possible. There is no feature (nor is there one planned) to return the expanded data graph back to the user via the commandline. If however you are using the python library within your application, then it is possible to get the expanded data graph, but you can't do it using the
|
@JoelBender I've added an issue tracking that here: #21 |
@JoelBender |
Given this code:
The
The |
Ah! I've found that |
@JoelBender
You say that data_graph and expanded_graph is the same, that is expected, because you have not done You also have:
And say that expanded_graph now has the additional content. That is not possible. Two reasons:
I'm not sure how this issue relates to the sh:TripleRule feature of SHACL. Can you explain more about what you are trying to achieve? |
Ah, sorry, that was a copy/paste error, a gist of the application is here. Adding the empty |
@JoelBender Its looks like the TripleRule feature should be fairly easy to implement, but I'm not sure how useful it will be, or how much use it will get. |
@JoelBender |
@JoelBender If this feature is still applicable to your use-case, please test it and let me know if it works for you. |
@JoelBender Closing this issue now, I believe it to be resolved since the addition of SHACL Advanced Features. |
Still cannot get the inferred triples (SPARQLRule). v = Validator(data_graph=dg_basin, shacl_graph=rule, options={"inference": "rdfs"},ont_graph=ont)
conforms, report_graph, report_text = v.run()
expanded_graph = v.target_graph but got the content of ont_graph. r = validate(data_graph=dg_basin, shacl_graph=rule, ont_graph=ont, advanced=True, inference='rdfs', debug=False) only got With the same files, I tried TopQuadrant's SHACL API, and got the results: <http://www.egc.org/ont/process/arcgis#project>
<http://www.egc.org/ont/process#from>
<http://www.egc.org/ont/process/arcgis#create_custom_geographic_transformation> .
<http://www.egc.org/ont/data#in_features_data>
<http://www.egc.org/ont/process#isInputDataOf>
<http://www.egc.org/ont/process/arcgis#project> . So, how can I get the same results as the SHACL API produced ? Thanks. |
Hi @houzw In your first example code snippet, you are not enabling Advanced mode. Try this:
In your second example, you can disassemble the results like this: |
Hi, I am new to PySHACL but I also have the same problem that I applied :
no inference triples are returned and the result is:
How can I get the inferred triples? Thank you in advance! |
Hi @YZhengaa, Your example is invalid. You cannot pass "options" parameter into the For your example, you should use: HOWEVER! PySHACL is a graph validation engine, not a general-purpose inference engine. PySHACL is not designed to provide access to the triples inferred internally by SHACL-Rules. PySHACL supports SHACL-Rules as a preliminary step in the graph validation process, and inferred triples are only for the purposes of graph validation. Please see this Issue Thread for discussion around a potential alternate operating mode for PyShacl, which could allow the application to work as a general-purpose inferencing tool supporting SHACL-Rules. |
According to 8.4 General Execution Instructions for SHACL Rules implementations modify the data graph if triples get inferred, and/or may "construct a logical data graph that has the original data as one subgraph and a dedicated inferences graph as another subgraph, and where the inferred triples get added to the inferences graph only."
I've been following the Classification With SHACL Rules article and I would like to extract the graph of inferred triples which would include
<http://bakery.com/ns#AppleTartC> a <http://bakery.com/ns#NonGlutenFreeBakedGood>, <http://bakery.com/ns#VeganBakedGood> .
merged into the data graph or as a inference graph.Is this feature available?
The text was updated successfully, but these errors were encountered: