https://brickschema.org/schema/BrickShape#TagInferenceRule
@prefix brick: <https://brickschema.org/schema/Brick#> .
@prefix bsh: <https://brickschema.org/schema/BrickShape#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
bsh:TagInferenceRule a sh:NodeShape ;
sh:rule [ a sh:SPARQLRule ;
sh:construct """
CONSTRUCT {
$this brick:hasTag ?tag .
} WHERE {
$this rdf:type/rdfs:subClassOf* ?class .
?class brick:hasAssociatedTag ?tag .
}""" ;
sh:prefixes <https://brickschema.org/schema/1.4/Brick> ] ;
sh:targetClass brick:Entity .