Skip to content

Edge existence

What this is

Validate typed-edge cardinality for MultiEdgeConnection / EdgeConnection relations using dqs:edgeExistenceConstraint.

When to use it

Use edge existence when correctness depends on min/max counts of typed edges, for example:

  • every work order must have at least one work-item edge
  • an asset must not exceed a maximum number of child edges of a given type

Use this after single-instance checks, alongside other graph consistency rules. Prefer edge existence over plain sh:minCount on the relation path when relationships are stored as typed edges (node dumps often omit the connection property and false-fail).

Industrial examples

  • Work order → work items: outwards edges of type WorkItemEdge, minCount 1.
  • Functional location → child locations: outwards hierarchy edges with an upper bound.
  • Incoming ownership edges: dqs:direction "inwards" so the focus node is the edge end.

Example (SHACL edge existence)

@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix dqs: <http://purl.org/cognite/dqs#> .
@prefix sp:  <http://purl.org/cognite/my_space/WorkOrder/> .

sp:WorkOrderShape a sh:NodeShape ;
    sh:targetClass sp:WorkOrder ;
    dqs:edgeExistenceConstraint [
        dqs:connectionProperty "workItems" ;
        dqs:edgeType "edge_sp/WorkItemEdge" ;
        dqs:direction "outwards" ;
        dqs:minCount 1 ;
        dqs:maxCount 50
    ] .

Previous section

Next section