Class SchemaGraph
java.lang.Object
com.darkcollective.relix.symbol.graph.SchemaGraph
The schema graph: an immutable set of
Relationship edges between
relations.
The graph is a persistent value — with(Relationship) and
merge(SchemaGraph) return new graphs, never mutate. This fits the
REPL's accumulate-and-reanalyze session model: declared edges are rebuilt
from source on every analysis, while edges learned during the session
(conversational acquisition, joins observed in user queries) are merged in
as a supplemental graph each time.
Merging deduplicates edges by name and endpoints (direction-insensitively
— an edge and its reversal are the same relationship walked both ways). On a
duplicate, the more authoritative EdgeOrigin wins: DECLARED
over LEARNED over INFERRED; on an origin tie, this graph's
edge is kept.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SchemaGraphThe empty graph — the default on everySemanticModel. -
Method Summary
Modifier and TypeMethodDescriptionedgesOf(RelationSymbol relation) All edges incident on the given relation, regardless of which endpoint holds it — every edge is walkable in both directions.booleanisEmpty()Returnstrueif this graph has no edges.static Stringkey(RelationSymbol relation) The lookup key of a relation in this graph: its namespace plus canonical (lower-cased) name.merge(SchemaGraph other) Returns a new graph containing this graph's edges plusother's, deduplicated by identity (name + unordered endpoints); the more authoritative origin wins a duplicate, this graph's edge wins a tie.static SchemaGraphof(List<Relationship> relationships) Creates a graph holding the given relationships (order preserved).All edges of this graph, in insertion order.toString()with(Relationship relationship) Returns a new graph with the given edge added (deduplicating asmerge(com.darkcollective.relix.symbol.graph.SchemaGraph)).
-
Field Details
-
EMPTY
The empty graph — the default on everySemanticModel.
-
-
Method Details
-
of
Creates a graph holding the given relationships (order preserved). -
relationships
All edges of this graph, in insertion order. -
isEmpty
public boolean isEmpty()Returnstrueif this graph has no edges. -
edgesOf
All edges incident on the given relation, regardless of which endpoint holds it — every edge is walkable in both directions. -
with
Returns a new graph with the given edge added (deduplicating asmerge(com.darkcollective.relix.symbol.graph.SchemaGraph)). -
merge
Returns a new graph containing this graph's edges plusother's, deduplicated by identity (name + unordered endpoints); the more authoritative origin wins a duplicate, this graph's edge wins a tie. -
key
The lookup key of a relation in this graph: its namespace plus canonical (lower-cased) name. Stable across distinct symbol instances for the same relation. -
toString
-