Struct BoundPreparedSparqlQuery
pub struct BoundPreparedSparqlQuery<'a, D = DatasetView<'a>>where
D: QueryableDataset<'a>,{
evaluator: QueryEvaluator,
query: Query,
queryable_dataset: D,
substitutions: HashMap<Variable, Term>,
dataset: QueryDatasetSpecification,
marker: PhantomData<&'a ()>,
}Available on crate feature
rdf only.Expand description
A prepared SPARQL query bound to a storage, ready to be executed.
Usage example:
use oxigraph::model::{Literal, Variable};
use oxigraph::sparql::{QueryResults, SparqlEvaluator};
use oxigraph::store::Store;
let prepared_query = SparqlEvaluator::new()
.parse_query("SELECT ?v WHERE {}")?
.substitute_variable(Variable::new("v")?, Literal::from(1));
if let QueryResults::Solutions(mut solutions) =
prepared_query.on_store(&Store::new()?).execute()?
{
assert_eq!(
solutions.next().unwrap()?.get("v"),
Some(&Literal::from(1).into())
);
}Fields§
§evaluator: QueryEvaluator§query: Query§queryable_dataset: D§substitutions: HashMap<Variable, Term>§dataset: QueryDatasetSpecification§marker: PhantomData<&'a ()>Implementations§
§impl<'a, D> BoundPreparedSparqlQuery<'a, D>where
D: QueryableDataset<'a>,
impl<'a, D> BoundPreparedSparqlQuery<'a, D>where
D: QueryableDataset<'a>,
pub fn substitute_variable(
self,
variable: impl Into<Variable>,
term: impl Into<Term>,
) -> BoundPreparedSparqlQuery<'a, D>
pub fn substitute_variable( self, variable: impl Into<Variable>, term: impl Into<Term>, ) -> BoundPreparedSparqlQuery<'a, D>
Substitute a variable with a given RDF term in the SPARQL query.
Usage example:
use oxigraph::model::{Literal, Variable};
use oxigraph::sparql::{QueryResults, SparqlEvaluator};
use oxigraph::store::Store;
let prepared_query = SparqlEvaluator::new()
.parse_query("SELECT ?v WHERE {}")?
.on_store(&Store::new()?)
.substitute_variable(Variable::new("v")?, Literal::from(1));
if let QueryResults::Solutions(mut solutions) = prepared_query.execute()? {
assert_eq!(
solutions.next().unwrap()?.get("v"),
Some(&Literal::from(1).into())
);
}pub fn execute(self) -> Result<QueryResults<'a>, QueryEvaluationError>
pub fn execute(self) -> Result<QueryResults<'a>, QueryEvaluationError>
Evaluate the query against the given store.
pub fn compute_statistics(self) -> BoundPreparedSparqlQuery<'a, D>
pub fn compute_statistics(self) -> BoundPreparedSparqlQuery<'a, D>
Compute statistics during evaluation and fills them in the explanation tree.
pub fn explain(
self,
) -> (Result<QueryResults<'a>, QueryEvaluationError>, QueryExplanation)
pub fn explain( self, ) -> (Result<QueryResults<'a>, QueryEvaluationError>, QueryExplanation)
Executes a SPARQL 1.1 query with some options and
returns a query explanation with some statistics (if enabled with the compute_statistics option).
If you want to compute statistics, you need to exhaust the results iterator before having a look at them.
Usage example serializing the explanation with statistics in JSON:
use oxigraph::sparql::{QueryResults, SparqlEvaluator};
use oxigraph::store::Store;
if let (Ok(QueryResults::Solutions(solutions)), explanation) = SparqlEvaluator::new()
.parse_query("SELECT ?s WHERE { VALUES ?s { 1 2 3 } }")?
.on_store(&Store::new()?)
.explain()
{
// We make sure to have read all the solutions
for _ in solutions {}
let mut buf = Vec::new();
explanation.write_in_json(&mut buf)?;
}Auto Trait Implementations§
impl<'a, D> Freeze for BoundPreparedSparqlQuery<'a, D>where
D: Freeze,
impl<'a, D = DatasetView<'a>> !RefUnwindSafe for BoundPreparedSparqlQuery<'a, D>
impl<'a, D> Send for BoundPreparedSparqlQuery<'a, D>where
D: Send,
impl<'a, D> Sync for BoundPreparedSparqlQuery<'a, D>where
D: Sync,
impl<'a, D> Unpin for BoundPreparedSparqlQuery<'a, D>where
D: Unpin,
impl<'a, D = DatasetView<'a>> !UnwindSafe for BoundPreparedSparqlQuery<'a, D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<E, T, Request, Encoding> FromReq<Patch<Encoding>, Request, E> for Twhere
Request: Req<E> + Send + 'static,
Encoding: Decodes<T>,
E: FromServerFnError,
impl<E, T, Request, Encoding> FromReq<Patch<Encoding>, Request, E> for Twhere
Request: Req<E> + Send + 'static,
Encoding: Decodes<T>,
E: FromServerFnError,
§impl<E, T, Request, Encoding> FromReq<Post<Encoding>, Request, E> for Twhere
Request: Req<E> + Send + 'static,
Encoding: Decodes<T>,
E: FromServerFnError,
impl<E, T, Request, Encoding> FromReq<Post<Encoding>, Request, E> for Twhere
Request: Req<E> + Send + 'static,
Encoding: Decodes<T>,
E: FromServerFnError,
§impl<E, T, Request, Encoding> FromReq<Put<Encoding>, Request, E> for Twhere
Request: Req<E> + Send + 'static,
Encoding: Decodes<T>,
E: FromServerFnError,
impl<E, T, Request, Encoding> FromReq<Put<Encoding>, Request, E> for Twhere
Request: Req<E> + Send + 'static,
Encoding: Decodes<T>,
E: FromServerFnError,
§impl<E, Encoding, Response, T> FromRes<Patch<Encoding>, Response, E> for Twhere
Response: ClientRes<E> + Send,
Encoding: Decodes<T>,
E: FromServerFnError,
impl<E, Encoding, Response, T> FromRes<Patch<Encoding>, Response, E> for Twhere
Response: ClientRes<E> + Send,
Encoding: Decodes<T>,
E: FromServerFnError,
§impl<E, Encoding, Response, T> FromRes<Post<Encoding>, Response, E> for Twhere
Response: ClientRes<E> + Send,
Encoding: Decodes<T>,
E: FromServerFnError,
impl<E, Encoding, Response, T> FromRes<Post<Encoding>, Response, E> for Twhere
Response: ClientRes<E> + Send,
Encoding: Decodes<T>,
E: FromServerFnError,
§impl<E, Encoding, Response, T> FromRes<Put<Encoding>, Response, E> for Twhere
Response: ClientRes<E> + Send,
Encoding: Decodes<T>,
E: FromServerFnError,
impl<E, Encoding, Response, T> FromRes<Put<Encoding>, Response, E> for Twhere
Response: ClientRes<E> + Send,
Encoding: Decodes<T>,
E: FromServerFnError,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<E, T, Encoding, Request> IntoReq<Patch<Encoding>, Request, E> for Twhere
Request: ClientReq<E>,
Encoding: Encodes<T>,
E: FromServerFnError,
impl<E, T, Encoding, Request> IntoReq<Patch<Encoding>, Request, E> for Twhere
Request: ClientReq<E>,
Encoding: Encodes<T>,
E: FromServerFnError,
§impl<E, T, Encoding, Request> IntoReq<Post<Encoding>, Request, E> for Twhere
Request: ClientReq<E>,
Encoding: Encodes<T>,
E: FromServerFnError,
impl<E, T, Encoding, Request> IntoReq<Post<Encoding>, Request, E> for Twhere
Request: ClientReq<E>,
Encoding: Encodes<T>,
E: FromServerFnError,
§impl<E, T, Encoding, Request> IntoReq<Put<Encoding>, Request, E> for Twhere
Request: ClientReq<E>,
Encoding: Encodes<T>,
E: FromServerFnError,
impl<E, T, Encoding, Request> IntoReq<Put<Encoding>, Request, E> for Twhere
Request: ClientReq<E>,
Encoding: Encodes<T>,
E: FromServerFnError,
§impl<E, Response, Encoding, T> IntoRes<Patch<Encoding>, Response, E> for T
impl<E, Response, Encoding, T> IntoRes<Patch<Encoding>, Response, E> for T
§impl<E, Response, Encoding, T> IntoRes<Post<Encoding>, Response, E> for T
impl<E, Response, Encoding, T> IntoRes<Post<Encoding>, Response, E> for T
§impl<E, Response, Encoding, T> IntoRes<Put<Encoding>, Response, E> for T
impl<E, Response, Encoding, T> IntoRes<Put<Encoding>, Response, E> for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> SerializableKey for T
impl<T> SerializableKey for T
§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.