Struct PreparedSparqlQuery
pub struct PreparedSparqlQuery {
evaluator: QueryEvaluator,
query: Query,
dataset: QueryDatasetSpecification,
substitutions: HashMap<Variable, Term>,
}Available on crate feature
rdf only.Expand description
A prepared SPARQL query.
Allows customizing things like the evaluation dataset and substituting variables.
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ยงdataset: QueryDatasetSpecificationยงsubstitutions: HashMap<Variable, Term>Implementationsยง
ยงimpl PreparedSparqlQuery
impl PreparedSparqlQuery
pub fn substitute_variable(
self,
variable: impl Into<Variable>,
term: impl Into<Term>,
) -> PreparedSparqlQuery
pub fn substitute_variable( self, variable: impl Into<Variable>, term: impl Into<Term>, ) -> PreparedSparqlQuery
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 {}")?
.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())
);
}pub fn dataset(&self) -> &QueryDatasetSpecification
pub fn dataset(&self) -> &QueryDatasetSpecification
Returns the query dataset specification of this prepared query.
pub fn dataset_mut(&mut self) -> &mut QueryDatasetSpecification
pub fn dataset_mut(&mut self) -> &mut QueryDatasetSpecification
Returns the query dataset specification of this prepared query.
pub fn on_store(self, store: &Store) -> BoundPreparedSparqlQuery<'static>
pub fn on_store(self, store: &Store) -> BoundPreparedSparqlQuery<'static>
Bind the prepared query to the [Store] it should be evaluated on.
pub fn on_transaction<'b>(
self,
transaction: &'b Transaction<'_>,
) -> BoundPreparedSparqlQuery<'b>
pub fn on_transaction<'b>( self, transaction: &'b Transaction<'_>, ) -> BoundPreparedSparqlQuery<'b>
Bind the prepared query to the [Transaction] it should be evaluated on.
pub fn on_queryable_dataset<'a, D>(
self,
queryable_dataset: D,
) -> BoundPreparedSparqlQuery<'a, D>where
D: QueryableDataset<'a>,
pub fn on_queryable_dataset<'a, D>(
self,
queryable_dataset: D,
) -> BoundPreparedSparqlQuery<'a, D>where
D: QueryableDataset<'a>,
Bind the prepared query to the [QueryableDataset] it should be evaluated on.
Trait Implementationsยง
ยงimpl Clone for PreparedSparqlQuery
impl Clone for PreparedSparqlQuery
ยงfn clone(&self) -> PreparedSparqlQuery
fn clone(&self) -> PreparedSparqlQuery
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementationsยง
impl Freeze for PreparedSparqlQuery
impl !RefUnwindSafe for PreparedSparqlQuery
impl Send for PreparedSparqlQuery
impl Sync for PreparedSparqlQuery
impl Unpin for PreparedSparqlQuery
impl UnsafeUnpin for PreparedSparqlQuery
impl !UnwindSafe for PreparedSparqlQuery
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
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
ยง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>
ยงfn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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.