Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[rdf4j-dev] SHACL rule inference

Hi,

I have a general question about what is the best approach for handling inheritance in SHACL rules.

############################
sh:targetClass ex:Person ;

sh:property [
sh:path ex:address ;
sh:or (
[
sh:datatype xsd:string ;
]
[
sh:class ex:Address ;
]
)
] .
############################


The sh:path ex:address gets inherited into each part of the sh:or. So it’s equivalent to the following:


############################
sh:targetClass ex:Person ;
sh:or (
[
sh:path ex:address ;
sh:datatype xsd:string ;

]
[
sh:path ex:address ;
sh:class ex:Address ;
]
)
 .
############################


And even though there is no example in the SHACL documentation, and this entire part of the spec is fairly poorly defined, I presume the following is equivalent too:


############################
sh:targetClass ex:Person ;

sh:property [
sh:or (
[
sh:path ex:address ;
sh:datatype xsd:string ;
]
[
sh:path ex:address ;
sh:class ex:Address ;
]
)
] .
############################
############################
############################


Question is. How should I handle this in RDF4J? 
 - Should I implement this as Java code in the SHACL engine. 
 - Should I wrap the SHACL rule sail in the CustomGraphQueryInferencer
 - Should I just run a SPARQL query myself to forward chain it?

Cheers,
Håvard



Back to the top