Skip to main content
Version: V2-Next

ADR 056: Cyclic references — full graph stored relationally

Date: 2026-07-15

Status: Accepted

Decision Makers: @derlinne, @luckey

Context​

Bidirectional and cyclic relationships are normal in the domain and must be stored without special handling.

Decision​

The full (potentially cyclic) reference graph is stored — both in the schema content and as relational edges in artifact_reference.

Rationale​

  • Bidirectional/cyclic relationships are normal in the domain (e.g. OGC SensorThings: Thing ⇄ Datastream).
  • artifact_reference is a plain relational edge table, so cycles and self-references are stored without special handling.

Mechanism​

  • On save, the complete set of $ref edges for the new artifact_version is written to artifact_reference (within the write transaction) and registered in the in-memory graph.
  • At startup the in-memory graph is rebuilt from the stored artifact_reference edges (ADR 054), so it remains complete and cyclic.

Consequences​

Bundled/inlined views and the dependencies/dependents queries always see the full graph (restart-safe). Recursive SQL (CTEs) over artifact_reference can serve transitive-dependency queries directly if needed.

See also​

  • ADR 054: Dependency graph as an in-memory index
  • ADR 055: Views as generated projections