Skip to main content

SimpleTripleStore

Struct SimpleTripleStore 

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

Lightweight Arrow-native triple store.

Wraps ArrowGraphStore with defaults for namespace and layer, providing a simplified API.

Implementations§

Source§

impl SimpleTripleStore

Source

pub fn new() -> Self

Create a new empty store with a single “default” namespace and layer 0.

Source

pub fn with_defaults(namespace: &str, layer: Option<u8>) -> Self

Create with custom namespace and layer defaults.

Source

pub fn add( &mut self, subject: &str, predicate: &str, object: &str, confidence: f64, source: &str, ) -> Result<String, StoreError>

Add a triple. Returns the generated triple ID.

Source

pub fn add_batch( &mut self, triples: &[(&str, &str, &str, f64, &str)], ) -> Result<Vec<String>, StoreError>

Add a batch of triples. Returns generated IDs.

Source

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

Remove a triple by ID. Returns true if found.

Source

pub fn query( &self, subject: Option<&str>, predicate: Option<&str>, object: Option<&str>, ) -> Result<Vec<StoredTriple>, StoreError>

Query triples matching pattern. None means wildcard (match all).

Source

pub fn count( &self, subject: Option<&str>, predicate: Option<&str>, object: Option<&str>, ) -> usize

Count triples matching pattern.

Source

pub fn get(&self, triple_id: &str) -> Option<StoredTriple>

Get a single triple by ID.

Source

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

Update confidence on an existing triple. Returns true if found.

Source

pub fn group_by( &self, field: &str, ) -> Result<HashMap<String, usize>, StoreError>

Group and count triples by a field (“subject”, “predicate”, or “object”).

Source

pub fn stats(&self) -> StoreStats

Get store statistics.

Source

pub fn len(&self) -> usize

Total number of triples.

Source

pub fn is_empty(&self) -> bool

Whether the store is empty.

Source

pub fn inner(&self) -> &ArrowGraphStore

Get a reference to the underlying ArrowGraphStore.

Source

pub fn inner_mut(&mut self) -> &mut ArrowGraphStore

Get a mutable reference to the underlying ArrowGraphStore.

Trait Implementations§

Source§

impl Default for SimpleTripleStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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.