pub struct Query { /* private fields */ }
Expand description
A parsed SPARQL query.
use rdf_fusion_execution::sparql::Query;
use rdf_fusion_model::NamedNode;
let query_str = "SELECT ?s ?p ?o WHERE { ?s ?p ?o . }";
let mut query = Query::parse(query_str, None)?;
assert_eq!(query.to_string(), query_str);
// We edit the query dataset specification
let default = vec![NamedNode::new("http://example.com")?.into()];
query.dataset_mut().set_default_graph(default.clone());
assert_eq!(
query.dataset().default_graph_graphs(),
Some(default.as_slice())
);
Implementations§
Source§impl Query
impl Query
Sourcepub fn parse(
query: &str,
base_iri: Option<&str>,
) -> Result<Self, SparqlSyntaxError>
pub fn parse( query: &str, base_iri: Option<&str>, ) -> Result<Self, SparqlSyntaxError>
Parses a SPARQL query with an optional base IRI to resolve relative IRIs in the query.
Sourcepub fn dataset(&self) -> &QueryDataset
pub fn dataset(&self) -> &QueryDataset
Returns the query dataset specification
Sourcepub fn dataset_mut(&mut self) -> &mut QueryDataset
pub fn dataset_mut(&mut self) -> &mut QueryDataset
Returns the query dataset specification
Trait Implementations§
impl Eq for Query
impl StructuralPartialEq for Query
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl UnwindSafe for Query
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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