Closed tobiasschweizer closed 2 years ago
As an aside, "1"^^
We typically use owl:imports to have the data graph import the shapes graph with the rdfs:subClassOf triples. So assuming that you have schema:ResearchProject rdfs:subClassOf schema:Thing in some other graph then you'd need to owl:import that other graph. I am not sure if the command line tool would follow owl:imports, but this can be simulated programmatically by creating a Jena MultiUnion with the required subgraphs and passing that into the validation engine as data graph and also the shapes graph.
Thanks a lot for your answer.
I actually generated this from JSON-LD using pyld
: jsonld.to_rdf(data, {'format': 'application/n-quads'})
.
I have naively assumed that this would do the job but now I notice the difference. Thanks for pointing that out!
{
"sh:property": {
"sh:class": {
"@id": "schema:Thing"
},
"sh:description": "Indicates an item funded or sponsored through a [[Grant]].",
"sh:maxCount": {
"@type": "xsd:integer",
"@value": 1
},
"sh:minCount": {
"@type": "xsd:integer",
"@value": 1
},
"sh:name": "fundedItem",
"sh:nodeKind": {
"@id": "sh:IRI"
},
"sh:path": {
"@id": "schema:fundedItem"
}
}
}
I am not sure if the command line tool would follow owl:imports, but this can be simulated programmatically by creating a Jena MultiUnion with the required subgraphs and passing that into the validation engine as data graph and also the shapes graph.
Ok, thanks for the explanation.
Not sure if this ticket can be closed?
Let's close it. Thanks again for the clarifications.
Hi there,
I have made my first steps with
shaclvalidate
and I have a question regarding inference.Given the following data:
And the following property shape:
How can I pass in the information that
schema:ResearchProject
is a subclass ofschema:Thing
so that the constraint is satisfied? Would I need to useshaclinfer
for that?When using
pyshacl
, I use the "extra ontology graph" (https://github.com/RDFLib/pySHACL#command-line-use) to pass in the ontology stating the subclass relation betweenschema:ResearchProject
andschema:Thing
.Thanks a lot for any hint on that.