pub trait SparqlDataset {
type BindingsTerm: Term;
type BindingsResult: SparqlBindings<Self>;
type TriplesResult: TripleSource;
type SparqlError: Error + '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 method
fn prepare_query(
&self,
query_string: &str,
) -> Result<Self::Query, Self::SparqlError> { ... }
}
Expand description
A dataset that can be queried with SPARQL.
Required Associated Types§
Sourcetype BindingsTerm: Term
type BindingsTerm: Term
The type of terms that SELECT queries will return.
Sourcetype BindingsResult: SparqlBindings<Self>
type BindingsResult: SparqlBindings<Self>
The type of bindings that SELECT queries will return.
Sourcetype TriplesResult: TripleSource
type TriplesResult: TripleSource
The type of triples that GRAPH and DESCRIBE queries will return.
Sourcetype SparqlError: Error + 'static
type SparqlError: Error + 'static
The type of errors that processing SPARQL queries may raise.
Sourcetype Query: Query<Error = Self::SparqlError>
type Query: Query<Error = Self::SparqlError>
The type representing pre-processed queries.
See prepare_query
for more defail.
Required Methods§
Sourcefn query<Q>(&self, query: Q) -> Result<SparqlResult<Self>, Self::SparqlError>
fn query<Q>(&self, query: Q) -> Result<SparqlResult<Self>, Self::SparqlError>
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§
Sourcefn prepare_query(
&self,
query_string: &str,
) -> Result<Self::Query, Self::SparqlError>
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 exectution 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.
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.