pub struct BindingSet { /* private fields */ }Expand description
A set of SPARQL solution mappings (bindings).
Each element is a mapping from variable names to RDF terms. Implements the SPARQL algebra operations: MINUS, EXISTS, UNION, PROJECT, JOIN, DISTINCT.
Implementations§
Source§impl BindingSet
impl BindingSet
Sourcepub fn from_vec(bindings: Vec<HashMap<String, RdfTerm>>) -> Self
pub fn from_vec(bindings: Vec<HashMap<String, RdfTerm>>) -> Self
Create a binding set from a vector of solution mappings.
Sourcepub fn minus(&self, other: &BindingSet) -> BindingSet
pub fn minus(&self, other: &BindingSet) -> BindingSet
SPARQL MINUS operation.
Returns a binding set containing only those rows from self that are NOT
compatible with any row in other that shares at least one variable.
W3C SPARQL 1.1 spec §18.5: A row μ₁ from Ω₁ is removed if there exists μ₂ in Ω₂ such that:
- dom(μ₁) ∩ dom(μ₂) ≠ ∅ (they share at least one variable)
- μ₁ and μ₂ are compatible on shared variables
If no row in other shares any variable with a row in self, the row is KEPT.
Sourcepub fn exists_filter(&self, pattern: &BindingSet) -> BindingSet
pub fn exists_filter(&self, pattern: &BindingSet) -> BindingSet
EXISTS filter: keep rows from self that are compatible with at least
one row in pattern.
Two rows are compatible if all their shared variables agree in value. Rows with no shared variables are considered compatible.
Sourcepub fn union(&self, other: &BindingSet) -> BindingSet
pub fn union(&self, other: &BindingSet) -> BindingSet
UNION: combine all rows from both binding sets.
Sourcepub fn project(&self, vars: &[&str]) -> BindingSet
pub fn project(&self, vars: &[&str]) -> BindingSet
PROJECT: keep only the named variables in each solution mapping.
Variables not in vars are dropped. Solutions that become identical
after projection are NOT automatically deduplicated (call distinct separately).
Sourcepub fn join(&self, other: &BindingSet) -> BindingSet
pub fn join(&self, other: &BindingSet) -> BindingSet
Natural JOIN: for each pair of rows from self and other that are
compatible (agree on all shared variables), produce the merged row.
Sourcepub fn distinct(&self) -> BindingSet
pub fn distinct(&self) -> BindingSet
DISTINCT: remove duplicate solution mappings.
Trait Implementations§
Source§impl Clone for BindingSet
impl Clone for BindingSet
Source§fn clone(&self) -> BindingSet
fn clone(&self) -> BindingSet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BindingSet
impl Debug for BindingSet
Source§impl Default for BindingSet
impl Default for BindingSet
Source§fn default() -> BindingSet
fn default() -> BindingSet
Source§impl IntoIterator for BindingSet
impl IntoIterator for BindingSet
Auto Trait Implementations§
impl Freeze for BindingSet
impl RefUnwindSafe for BindingSet
impl Send for BindingSet
impl Sync for BindingSet
impl Unpin for BindingSet
impl UnsafeUnpin for BindingSet
impl UnwindSafe for BindingSet
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
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>
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>
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