Skip to main content

SqliteGraphStore

Struct SqliteGraphStore 

Source
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

Source

pub fn open(db_path: &Path) -> Result<Self>

Source

pub fn in_memory() -> Result<Self>

Source

pub fn open_read_only(db_path: &Path) -> Result<Self>

Source

pub fn open_read_only_resilient(db_path: &Path) -> Result<Self>

Source

pub fn read_only_recovery(&self) -> Option<ReadOnlyRecovery>

Source

pub fn has_user_triggers(&self) -> Result<bool>

Source

pub fn replace_projection(&mut self, projection: &GraphProjection) -> Result<()>

Source

pub fn replace_projection_with_version( &mut self, scope: impl Into<String>, projection: &GraphProjection, projection_version: Option<&str>, source_watermark: Option<String>, ) -> Result<SqliteProjectionRefresh>

Source

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.

Source

pub fn upsert_projection(&mut self, projection: &GraphProjection) -> Result<()>

Source

pub fn projection_version( &self, scope: &str, ) -> Result<Option<SqliteProjectionVersion>>

Source

pub fn update_projection_source_watermark( &mut self, scope: &str, source_watermark: Option<String>, ) -> Result<()>

Source

pub fn compact_storage( &mut self, scope: &str, prune_tombstones: bool, ) -> Result<usize>

Trait Implementations§

Source§

impl GraphStore for SqliteGraphStore

Source§

fn upsert_node(&self, node: &GraphNode) -> Result<()>

Source§

fn upsert_edge(&self, edge: &GraphEdge) -> Result<()>

Source§

fn delete_node(&self, id: &str) -> Result<usize>

Source§

fn delete_edge(&self, from_id: &str, to_id: &str, kind: &str) -> Result<usize>

Source§

fn node(&self, id: &str) -> Result<Option<GraphNode>>

Source§

fn all_nodes(&self) -> Result<Vec<GraphNode>>

Source§

fn all_edges(&self) -> Result<Vec<GraphEdge>>

Source§

fn edge(&self, edge_id: &str) -> Result<Option<GraphEdge>>

Source§

fn graph_counts(&self) -> Result<(usize, usize)>

Source§

fn sample_edge(&self, kind: Option<&str>) -> Result<Option<GraphEdge>>

Source§

fn sample_edge_with_property( &self, ) -> Result<Option<(GraphEdge, GraphPropertyFilter)>>

Source§

fn nodes_by_kind(&self, kind: &str) -> Result<Vec<GraphNode>>

Source§

fn paged_nodes_by_kind( &self, kind: &str, options: GraphQueryOptions, ) -> Result<GraphPagedSubgraph>

Source§

fn outgoing_edges( &self, from_id: &str, kind: Option<&str>, ) -> Result<Vec<GraphEdge>>

Source§

fn incident_edges( &self, node_id: &str, kind: Option<&str>, ) -> Result<Vec<GraphEdge>>

Source§

fn paged_edges( &self, kind: Option<&str>, options: GraphQueryOptions, ) -> Result<GraphPagedSubgraph>

Source§

fn paged_incident_edges( &self, node_id: &str, kind: Option<&str>, options: GraphQueryOptions, ) -> Result<GraphPagedSubgraph>

Source§

fn edges_between_nodes( &self, node_ids: &BTreeSet<String>, ) -> Result<Vec<GraphEdge>>

Source§

fn ranked_neighborhood( &self, center_id: &str, options: &RankedNeighborhoodOptions, ) -> Result<Option<RankedNeighborhoodResult>>

Source§

fn neighborhood( &self, center_id: &str, depth: usize, kind: Option<&str>, ) -> Result<Option<GraphSubgraph>>

Source§

fn paged_neighborhood( &self, center_id: &str, depth: usize, kind: Option<&str>, options: GraphQueryOptions, ) -> Result<Option<GraphPagedSubgraph>>

Source§

fn shortest_path( &self, from_id: &str, to_id: &str, kind: Option<&str>, ) -> Result<Option<GraphPath>>

Source§

fn shortest_path_with_max_hops( &self, from_id: &str, to_id: &str, kind: Option<&str>, max_hops: Option<usize>, ) -> Result<Option<GraphPath>>

Source§

fn reachable_nodes_by_kind( &self, from_id: &str, kind: &str, depth: usize, limit: usize, ) -> Result<Vec<(GraphNode, GraphPath)>>

Source§

fn reachable_nodes_by_kinds( &self, from_id: &str, kinds: &[&str], depth: usize, limit: usize, ) -> Result<BTreeMap<String, Vec<(GraphNode, GraphPath)>>>

Source§

fn resolve_evidence_target( &self, target: &str, kinds: &[&str], ) -> Result<Option<GraphNode>>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.