lineage method

  1. @override
List<String> lineage(
  1. covariant Ontology dimension
)
override

Traverses the hierarchical tree to produce a Causal Trace of a specific knowledge dimension associated with this context.

This method provides the architectural Rationale Path, mapping the journey of a specific Governance marker from the root system node down to the current specialized leaf.

When to use

This is useful for debugging – to see how a particular dimension has evolved across the context hierarchy.

How it works

The method walks up the parent chain and collects values for the specified Governance dimension, returning them in chronological order (root first).

Parameters:

  • dimension: The Governance type-level marker to trace (e.g., Governance.subDomains, Governance.compliances).

Returns:

An ordered List of strings representing the evolution of the requested dimension from the system root down to the current node.

Implementation

@override
List<String> lineage(Ontology dimension) {
  List<String> lineage = [];

  ContextBase? context;
  context = this;
  while (context != null) {
    try {
      final key = context._record.map.keys.firstWhere((k) => k == dimension);
      lineage.add(context._record.map[key]);
    } catch (_) {}
    context = context._parent;
  }
  return lineage.reversed.toList(growable: false);
}