Hi everyone,
I've been looking at shapes in 1.3 and 1.4RC. I think I've found a category of shape that is not going to ever be tested against any model nodes.
Here's a query...
####################SELECT DISTINCT
?shape ?isRangeOf
WHERE {
?shape a sh:NodeShape .
OPTIONAL{ ?isRangeOf rdfs:range ?shape } # does a property try to associate with the shape via range? (If so, this won't help targeting.)
FILTER (
# the shape has some triple that marks it as a validation shape, rather than an inferencing rule shape...
EXISTS { ?shape sh:property ?p }
||
EXISTS { ?shape sh:and ?and }
||
EXISTS { ?shape sh:or ?or }
||
EXISTS { ?shape sh:parameter ?parameter }
||
EXISTS { ?shape sh:sparql ?sparql }
)
# it IS a class though, so it's conceivable that you could declare something to be an instance of the shape, or have something inferenced to become it...
FILTER(
EXISTS { ?shape rdf:type owl:Class }
||
EXISTS { ?shape rdf:type rdfs:Class }
)
# ...but nothing (other than rdfs:range maybe) points to the shape. It's an island, all on its own...
FILTER NOT EXISTS {
?s1 ?p2 ?shape
FILTER(?p2 != rdfs:range)
}
# ...and there's no way for instance to match this shape by virtue of their type as brick:Entity subclass, or targeting, or SHACL-AF features, or whatever...
FILTER (
!(
EXISTS { ?shape ((^owl:equivalentClass) | rdfs:subClassOf)* brick:EntityPropertyValue }
||
EXISTS { ?shape ((^owl:equivalentClass) | rdfs:subClassOf)* brick:Entity }
||
EXISTS { ?shape sh:target ?explicitTarget }
||
EXISTS { ?shape sh:targetClass ?tc }
||
EXISTS { ?shape sh:targetSubjectsOf ?ts }
||
EXISTS { ?shape sh:targetObjectsOf ?to }
||
EXISTS { ?propertyShape sh:node ?shape }
||
EXISTS { ?viaClass sh:class ?shape }
||
EXISTS { ?viaCondition sh:condition ?shape }
||
EXISTS { ?viaObject sh:object ?shape }
)
)
}
ORDER BY ?shape
####################
This will find things like bsh:CO2_ConcentrationShape (1.3) or CO2_ConcentrationQuantityShape (1.4). The problem is that I can't see how a SHACL engine will ever come to test such a shape on any target. Have I misunderstood something about how SHACL works, or is this an oversight in the Brick schema?
Best regards,
Daniel Hugo.