Package com.tnsai.intelligence.rag.graph
Class InMemoryGraphStore
java.lang.Object
com.tnsai.intelligence.rag.graph.InMemoryGraphStore
- All Implemented Interfaces:
GraphStore
Zero-config in-process
GraphStore for development and FILE ingest.
Nodes are keyed by a normalized identity so Auth Service and
auth service collapse to one entity. Callers add nodes and edges
explicitly; FileGraphIngestor is the FILE-corpus construction path.
- Since:
- 0.14.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tnsai.intelligence.rag.graph.GraphStore
GraphStore.Edge, GraphStore.Neighbor, GraphStore.Node, GraphStore.Seed -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionedges()Snapshot of stored edges.Finds graph nodes that can seed traversal for a query.static StringidentityKey(String value) Collapses surface forms so identity is not exact-string-only.Returns the outgoing edges and destination nodes for a node.intNumber of stored nodes.nodes()Snapshot of stored nodes.voidputEdge(GraphStore.Edge edge, GraphStore.Node destination) Inserts a directed edge.voidputNode(GraphStore.Node node) Inserts or replaces a node under its identity key.
-
Constructor Details
-
InMemoryGraphStore
public InMemoryGraphStore()
-
-
Method Details
-
putNode
Inserts or replaces a node under its identity key.- Parameters:
node- node to retain
-
putEdge
Inserts a directed edge. The destination must already be stored.- Parameters:
edge- directed edgedestination- destination node (used if not already stored)
-
nodeCount
public int nodeCount()Number of stored nodes. -
nodes
Snapshot of stored nodes. -
edges
Snapshot of stored edges. -
findSeeds
Description copied from interface:GraphStoreFinds graph nodes that can seed traversal for a query.- Specified by:
findSeedsin interfaceGraphStore- Parameters:
query- query text, nevernulllimit- maximum number of seeds requested- Returns:
- seeds, never
null
-
neighbors
Description copied from interface:GraphStoreReturns the outgoing edges and destination nodes for a node.- Specified by:
neighborsin interfaceGraphStore- Parameters:
nodeId- expanded node identifier- Returns:
- neighbors, never
null
-
identityKey
Collapses surface forms so identity is not exact-string-only.- Parameters:
value- raw entity label- Returns:
- lowercase alphanumerics with single spaces
-