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