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§
Sourcefn capabilities(&self) -> GraphCapabilities
fn capabilities(&self) -> GraphCapabilities
What the store declares about itself.
Sourcefn insert_quads(&self, quads: &[Quad]) -> Result<(), StoreError>
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.
Sourcefn remove_quads(&self, quads: &[Quad]) -> Result<(), StoreError>
fn remove_quads(&self, quads: &[Quad]) -> Result<(), StoreError>
Removes quads (absent ones are ignored). Blank nodes cannot be named for removal.
§Errors
Sourcefn clear_graph(&self, graph: &NamedNode) -> Result<(), StoreError>
fn clear_graph(&self, graph: &NamedNode) -> Result<(), StoreError>
Sourcefn query(&self, sparql: &str) -> Result<QueryResults, StoreError>
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§
Sourcefn rdf_capability(&self) -> RdfCapability
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".