Skip to main content

ArrowGraphStore

Struct ArrowGraphStore 

Source
pub struct ArrowGraphStore { /* private fields */ }
Expand description

Convenience re-export of the core store types using string-based namespaces. The core Arrow-native graph store, partitioned by namespace.

Each namespace holds a vector of RecordBatches (appended over time). Queries filter by namespace first, then by column predicates.

Namespaces are arbitrary strings defined at construction time.

Implementations§

Source§

impl ArrowGraphStore

Source

pub fn new(namespaces: &[&str]) -> ArrowGraphStore

Create a new empty store with the given namespace partitions.

§Example
use arrow_graph_core::store::ArrowGraphStore;

// Knowledge graph with three partitions
let store = ArrowGraphStore::new(&["world", "code", "self"]);

// Document store with different partitions
let store = ArrowGraphStore::new(&["drafts", "published"]);
Source

pub fn schema(&self) -> &Arc<Schema>

Get the triples schema.

Source

pub fn namespaces(&self) -> &[String]

Get the list of namespace names.

Source

pub fn add_triple( &mut self, triple: &Triple, namespace: &str, layer: Option<u8>, ) -> Result<String, StoreError>

Add a single triple to the specified namespace and layer.

The layer parameter is optional — pass None to use layer 0 (default).

Source

pub fn add_batch( &mut self, triples: &[Triple], namespace: &str, layer: Option<u8>, ) -> Result<Vec<String>, StoreError>

Add a batch of triples to the specified namespace and layer. Returns the generated triple IDs.

Source

pub fn query(&self, spec: &QuerySpec) -> Result<Vec<RecordBatch>, StoreError>

Query triples matching the given spec.

Source

pub fn len(&self) -> usize

Total number of non-deleted triples across all namespaces.

Source

pub fn is_empty(&self) -> bool

Whether the store has no non-deleted triples.

Source

pub fn len_all(&self) -> usize

Total number of triples including deleted.

Source

pub fn delete(&mut self, triple_id: &str) -> Result<bool, StoreError>

Logically delete a triple by ID (sets deleted=true).

Source

pub fn get_namespace_batches(&self, namespace: &str) -> &[RecordBatch]

Get all RecordBatches for a given namespace (including deleted triples).

Source

pub fn set_namespace_batches( &mut self, namespace: &str, batches: Vec<RecordBatch>, )

Replace all data for a namespace (used by checkout/restore).

Source

pub fn causal_chain(&self, triple_id: &str) -> Vec<CausalNode>

Follow the caused_by/derived_from chain from a triple to build a derivation graph.

Returns a list of causal nodes representing the full ancestry of the given triple. The first element is always the queried triple itself. Traversal is breadth-first.

Source

pub fn clear(&mut self)

Clear all data from the store.

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.