In order to validate my RDF graph against my SHACL validation shapes V, I want to infer some triples to keep my shapes simple. In particular, one of the rule I need to implement is (in pseudo code):
(?s, rdf:type, :X) <-- (?s, rdfs:subClassOf, :Y)
I was trying several implementations, ending up with this triple rule (and its variants):
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix : <http://example.com/ex#> .
:s
a sh:NodeShape ;
sh:targetClass rdfs:Resource ;
sh:rule [
a sh:TripleRule ;
sh:subject sh:this ;
sh:predicate rdf:type ;
sh:object :X ;
sh:condition [ sh:property [ sh:path rdfs:subClassOf ;
sh:hasValue :Y ] ]
] .
However the rule does not infer :A rdf:type :X . for data graph
:A rdfs:subClassOf :Y .
(Executing against https://github.com/TopQuadrant/shacl). It is possible to solve this issue with a SPARQL rule, so my question is whether there is an option to do it through Triple rule as well. Thanks for hints!