Skip to main content

ContentStore

Struct ContentStore 

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

Wraps Oxigraph Store, providing named-graph-aware RDF operations. No other crate should import oxigraph directly.

Implementations§

Source§

impl ContentStore

Source

pub fn new() -> Result<Self, Box<dyn Error>>

Create a new in-memory content store.

Source

pub fn insert_triple_into( &self, subject: &str, predicate: &str, object: &ObjectValue, graph: &str, ) -> Result<(), Box<dyn Error>>

Insert a triple into the specified named graph.

Source

pub fn query_to_json(&self, sparql: &str) -> Result<Value, Box<dyn Error>>

Execute a SPARQL SELECT or ASK query and return results as JSON.

Source

pub fn load_turtle(&self, path: &Utf8Path) -> Result<(), Box<dyn Error>>

Load a Turtle (.ttl) file into the default graph.

Source

pub fn load_turtle_into( &self, path: &Utf8Path, graph: &str, ) -> Result<(), Box<dyn Error>>

Load a Turtle (.ttl) file into a specific named graph.

Source

pub fn clear(&self) -> Result<(), Box<dyn Error>>

Clear all data from the store.

Source

pub fn export_search_ntriples(&self) -> Result<String, Box<dyn Error>>

Export all triples as N-Triples for client-side SPARQL search.

Includes every triple from every named graph so that custom RDF properties (from [rdf.custom] frontmatter) are queryable in the browser alongside standard schema.org fields.

Source

pub fn export_partitioned_ntriples( &self, partition_fn: &dyn Fn(&str) -> Option<String>, ) -> Result<HashMap<String, String>, Box<dyn Error>>

Export triples grouped by a partition function.

The partition_fn receives (graph_name) and returns an optional partition key. Triples whose graph returns None go into the empty-key bucket (main search.nt). The design tokens graph always partitions to "design-tokens".

Source

pub fn export_turtle(&self) -> Result<String, Box<dyn Error>>

Export all triples (flattened from all named graphs) as NTriples.

This is useful for SHACL validation, which operates on a flat graph.

Trait Implementations§

Source§

impl Clone for ContentStore

Source§

fn clone(&self) -> ContentStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V