Skip to main content

GraphStore

Trait GraphStore 

Source
pub trait GraphStore: Send + Sync {
    // Required methods
    fn capabilities(&self) -> GraphCapabilities;
    fn insert_quads(&self, quads: &[Quad]) -> Result<(), StoreError>;
    fn remove_quads(&self, quads: &[Quad]) -> Result<(), StoreError>;
    fn clear_graph(&self, graph: &NamedNode) -> Result<(), StoreError>;
    fn query(&self, sparql: &str) -> Result<QueryResults, StoreError>;

    // Provided method
    fn rdf_capability(&self) -> RdfCapability { ... }
}
Expand description

A graph store: accepts RDF quads and answers SPARQL 1.1 queries, and declares whether it supports RDF 1.2 triple terms.

Each call is one request: a store need not offer compare-and-set or transactions across requests, which is why the journal is a separate contract. Writes of quads without blank nodes are idempotent: inserting a quad twice leaves the store as inserting it once.

Required Methods§

Source

fn capabilities(&self) -> GraphCapabilities

What the store declares about itself.

Source

fn insert_quads(&self, quads: &[Quad]) -> Result<(), StoreError>

Adds quads.

§Errors

StoreError::Unavailable when the store cannot be reached, StoreError::Invalid for a quad it cannot hold, StoreError::Backend otherwise.

Source

fn remove_quads(&self, quads: &[Quad]) -> Result<(), StoreError>

Removes quads (absent ones are ignored). Blank nodes cannot be named for removal.

§Errors

As GraphStore::insert_quads.

Source

fn clear_graph(&self, graph: &NamedNode) -> Result<(), StoreError>

Removes every statement of the named graph graph.

§Errors

As GraphStore::insert_quads.

Source

fn query(&self, sparql: &str) -> Result<QueryResults, StoreError>

Runs a SPARQL 1.1 query (SELECT, ASK, CONSTRUCT, DESCRIBE).

§Errors

StoreError::Invalid for invalid query text, and the errors of GraphStore::insert_quads.

Provided Methods§

Source

fn rdf_capability(&self) -> RdfCapability

Whether the store supports RDF 1.2 triple terms.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<G: GraphStore + ?Sized> GraphStore for Arc<G>

Implementors§