pub struct SqliteGraphStore { /* private fields */ }Expand description
SQLite-backed graph store.
§Temp-table invariant
Several methods — replace_projection_with_version, upsert_projection,
edges_between_nodes, and breadth_first_search — create connection-scoped
TEMP TABLE staging areas inside the underlying SQLite connection. Two
concurrent calls on the same SqliteGraphStore (or sharing the same
connection through SqliteReadOnlyConnection) would collide on those temp
table names and produce incorrect results or errors.
Only one temp-table-using method may be active at a time per connection.
Implementations§
Source§impl SqliteGraphStore
impl SqliteGraphStore
pub fn open(db_path: &Path) -> Result<Self>
pub fn in_memory() -> Result<Self>
pub fn open_read_only(db_path: &Path) -> Result<Self>
pub fn open_read_only_resilient(db_path: &Path) -> Result<Self>
pub fn read_only_recovery(&self) -> Option<ReadOnlyRecovery>
pub fn has_user_triggers(&self) -> Result<bool>
pub fn replace_projection(&mut self, projection: &GraphProjection) -> Result<()>
pub fn replace_projection_with_version( &mut self, scope: impl Into<String>, projection: &GraphProjection, projection_version: Option<&str>, source_watermark: Option<String>, ) -> Result<SqliteProjectionRefresh>
Sourcepub fn derive_ontology(&self) -> Result<GraphProjection>
pub fn derive_ontology(&self) -> Result<GraphProjection>
Derive a Semantic Ontology Graph (#memgraphrag-ont, MemGraphRAG arxiv
2606.00610 third layer) from the instance graph: one ontology_type node
per distinct node kind, and one ontology_relation:<edge_kind> edge per
observed (from_kind, edge_kind, to_kind) triple, each carrying an
instance_count. This data-driven schema lets retrieval start from
abstract types and prune by permitted inter-type relations. Existing
ontology rows are excluded so the derivation is idempotent and never folds
the ontology layer into itself.
pub fn upsert_projection(&mut self, projection: &GraphProjection) -> Result<()>
Sourcepub fn delete_source_projection(
&mut self,
source_ref: &str,
provider: &str,
) -> Result<usize>
pub fn delete_source_projection( &mut self, source_ref: &str, provider: &str, ) -> Result<usize>
#kgrefreshdup: delete every node previously projected from source_ref by
provider, so a re-extraction REPLACES that source’s subgraph instead of
accumulating duplicate canonical entities across refresh cycles. Incident
edges, node/edge properties, and semantic vectors are removed automatically
via the ON DELETE CASCADE foreign keys. The provider scope keeps the
delete from touching non-KG nodes (e.g. AST symbols) that may share a
source_ref path in the same graph database. Returns the node count deleted.
#kgsameas: link nodes of kind that share the same id_key property value
(restricted to values starting with id_prefix) using star edge_kind
edges — each group’s members point at its lexicographically-smallest node
id. This collapses duplicate logical entities for ALL graph consumers (not
just the context pack), without deleting any node, so per-source provenance
is preserved. Idempotent: edges key on (from,to,kind), so re-running upserts
the same set. Returns the number of link edges written.