ExposoGraph.engine¶
NetworkX-backed graph engine for building and querying the knowledge graph.
GraphEngine.load(...) and GraphEngine.merge(...) both accept a
mode argument:
exploratorykeeps provisional content after groundingstrictmerges only canonically grounded content and returns warnings for dropped items
The engine is backed by a NetworkX MultiDiGraph and preserves parallel
edges. Distinct evidence edges with the same source, predicate, and target are
kept as separate graph edges instead of replacing earlier records.
- class ExposoGraph.engine.GraphEngine[source]¶
Bases:
objectThin wrapper around a NetworkX MultiDiGraph that speaks our domain model.
- load(kg, *, mode=GraphMode.EXPLORATORY)[source]¶
Replace the current graph with kg.
Clears all existing nodes and edges before loading. Returns a list of warning messages for any skipped edges.
- Parameters:
kg (KnowledgeGraph)
- Return type:
- merge(kg, *, mode=GraphMode.EXPLORATORY)[source]¶
Additive merge — new nodes/edges are added, existing ones updated.
Returns a list of warning messages for any skipped edges.
- Parameters:
kg (KnowledgeGraph)
- Return type: