SparqlDataset

Trait SparqlDataset 

Source
pub trait SparqlDataset {
    type BindingsTerm: Term;
    type BindingsResult: SparqlBindings<Self>;
    type TriplesResult: TripleSource;
    type SparqlError: Error + Send + Sync + 'static;
    type Query: Query<Error = Self::SparqlError>;

    // Required method
    fn query<Q>(
        &self,
        query: Q,
    ) -> Result<SparqlResult<Self>, Self::SparqlError>
       where Q: IntoQuery<Self::Query>;

    // Provided methods
    fn prepare_query(
        &self,
        query_string: &str,
    ) -> Result<Self::Query, Self::SparqlError> { ... }
    fn prepare_query_with(
        &self,
        query_string: &str,
        base: Iri<&str>,
    ) -> Result<Self::Query, Self::SparqlError> { ... }
}
Expand description

A dataset that can be queried with SPARQL.

Required Associated Types§

Source

type BindingsTerm: Term

The type of terms that SELECT queries will return.

Source

type BindingsResult: SparqlBindings<Self>

The type of bindings that SELECT queries will return.

Source

type TriplesResult: TripleSource

The type of triples that GRAPH and DESCRIBE queries will return.

Source

type SparqlError: Error + Send + Sync + 'static

The type of errors that processing SPARQL queries may raise.

Source

type Query: Query<Error = Self::SparqlError>

The type representing pre-processed queries.

See prepare_query for more detail.

Required Methods§

Source

fn query<Q>(&self, query: Q) -> Result<SparqlResult<Self>, Self::SparqlError>
where Q: IntoQuery<Self::Query>,

Parse and immediately execute query.

query is usually either a &str that will be parsed on the fly, or a Self::Query that was earlier prepared by the prepare_query method.

Provided Methods§

Source

fn prepare_query( &self, query_string: &str, ) -> Result<Self::Query, Self::SparqlError>

Prepare a query for multiple future executions.

This allows some implementation to separate parsing, (or any other pre-processing step) of the query string from the actual execution of the query. There is however no guarantee on how much pre-processing is actually done by this method (see below).

§Note to implementers

If it is impossible or inconvenient to provide a type for pre-parsed queries, you can still use String, which implements the Query trait.

See also SparqlDataset::prepare_query_with

Source

fn prepare_query_with( &self, query_string: &str, base: Iri<&str>, ) -> Result<Self::Query, Self::SparqlError>

Prepare a query for multiple future executions, using the given IRI to resolve relative IRIs.

See also SparqlDataset::prepare_query.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§