pub struct SelectQuery {
pub prefixes: Vec<(String, String)>,
pub projection: Vec<String>,
pub distinct: bool,
pub reduced: bool,
pub where_clause: WhereClause,
pub order_by: Vec<OrderDirection>,
pub group_by: Vec<String>,
pub having: Option<SparqlFilter>,
pub limit: Option<usize>,
pub offset: Option<usize>,
}Expand description
A fluent builder for SPARQL SELECT queries.
Fields§
§prefixes: Vec<(String, String)>PREFIX declarations: (prefix, iri).
projection: Vec<String>Variables to project. Empty means SELECT *.
distinct: boolWhether to apply DISTINCT.
reduced: boolWhether to apply REDUCED.
where_clause: WhereClauseThe WHERE clause.
order_by: Vec<OrderDirection>ORDER BY terms.
group_by: Vec<String>GROUP BY variables.
having: Option<SparqlFilter>HAVING filter (only meaningful when GROUP BY is set).
limit: Option<usize>LIMIT value.
offset: Option<usize>OFFSET value.
Implementations§
Source§impl SelectQuery
impl SelectQuery
Sourcepub fn prefix(self, prefix: impl Into<String>, iri: impl Into<String>) -> Self
pub fn prefix(self, prefix: impl Into<String>, iri: impl Into<String>) -> Self
Add a PREFIX declaration.
Sourcepub fn select_all(self) -> Self
pub fn select_all(self) -> Self
Set projection to SELECT *.
Sourcepub fn where_clause(self, clause: WhereClause) -> Self
pub fn where_clause(self, clause: WhereClause) -> Self
Set the WHERE clause.
Sourcepub fn order_by_asc(self, var: impl Into<String>) -> Self
pub fn order_by_asc(self, var: impl Into<String>) -> Self
Add an ORDER BY ASC(?var) term.
Sourcepub fn order_by_desc(self, var: impl Into<String>) -> Self
pub fn order_by_desc(self, var: impl Into<String>) -> Self
Add an ORDER BY DESC(?var) term.
Sourcepub fn having(self, filter: SparqlFilter) -> Self
pub fn having(self, filter: SparqlFilter) -> Self
Set the HAVING filter.
Sourcepub fn build(&self) -> Result<String, SparqlBuilderError>
pub fn build(&self) -> Result<String, SparqlBuilderError>
Build the SPARQL query string, performing validation first.
Sourcepub fn build_unchecked(&self) -> String
pub fn build_unchecked(&self) -> String
Build the SPARQL query string without validation.
Trait Implementations§
Source§impl Clone for SelectQuery
impl Clone for SelectQuery
Source§fn clone(&self) -> SelectQuery
fn clone(&self) -> SelectQuery
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 moreSource§impl Debug for SelectQuery
impl Debug for SelectQuery
Auto Trait Implementations§
impl Freeze for SelectQuery
impl RefUnwindSafe for SelectQuery
impl Send for SelectQuery
impl Sync for SelectQuery
impl Unpin for SelectQuery
impl UnsafeUnpin for SelectQuery
impl UnwindSafe for SelectQuery
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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