pub struct PreparedSparqlQuery { /* private fields */ }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())
);
}Implementations§
Source§impl PreparedSparqlQuery
impl PreparedSparqlQuery
Sourcepub fn substitute_variable(
self,
variable: impl Into<Variable>,
term: impl Into<Term>,
) -> Self
pub fn substitute_variable( self, variable: impl Into<Variable>, term: impl Into<Term>, ) -> Self
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())
);
}Sourcepub fn dataset(&self) -> &QueryDataset
pub fn dataset(&self) -> &QueryDataset
Returns the query dataset specification of this prepared query.
Sourcepub fn dataset_mut(&mut self) -> &mut QueryDataset
pub fn dataset_mut(&mut self) -> &mut QueryDataset
Returns the query dataset specification of this prepared query.
Sourcepub 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.
Sourcepub 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.
Sourcepub fn on_queryable_dataset<'a, D: QueryableDataset<'a>>(
self,
queryable_dataset: D,
) -> BoundPreparedSparqlQuery<'a, D>
pub fn on_queryable_dataset<'a, D: QueryableDataset<'a>>( self, queryable_dataset: D, ) -> BoundPreparedSparqlQuery<'a, D>
Bind the prepared query to the QueryableDataset it should be evaluated on.
Trait Implementations§
Source§impl Clone for PreparedSparqlQuery
impl Clone for PreparedSparqlQuery
Source§fn clone(&self) -> PreparedSparqlQuery
fn clone(&self) -> PreparedSparqlQuery
Returns a duplicate of the value. Read more
1.0.0 · 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