Graph consistency
What this is
Validate relationships across linked entities, not only one node in isolation.
When to use it
Use graph consistency when correctness depends on references and cross-node context:
- operation <-> equipment tag alignment
- work-order link completeness
- cross-model semantic agreement
Industrial examples
- An operation tag on a work order must also exist on its linked equipment object.
- If a pump references a parent unit, the parent unit must exist and be in the same site hierarchy.
- A functional location relation must point to a valid location node, not a missing external reference.
These are implemented as sh:sparql constraints over linked nodes.
Example (SHACL + SPARQL)
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix ex: <https://example.com/dm/> .
ex:OperationTagConsistencyShape
a sh:NodeShape ;
sh:targetClass ex:Operation ;
sh:sparql [
sh:message "Operation tag must exist on linked equipment." ;
sh:select """
SELECT $this ?opTag WHERE {
$this ex:tag ?opTag ;
ex:equipment ?equipment .
FILTER NOT EXISTS {
?equipment ex:tag ?eqTag .
FILTER(?eqTag = ?opTag)
}
}
""" ;
] .