pub trait AsPattern {
type Ground: ?Sized;
type Var: ?Sized;
// Required method
fn as_pattern(&self) -> Pattern<&Self::Ground, &Self::Var>;
// Provided methods
fn is_ground(&self) -> bool { ... }
fn is_ground_and(&self, f: impl FnOnce(&Self::Ground) -> bool) -> bool { ... }
fn is_var(&self) -> bool { ... }
fn is_var_and(&self, f: impl FnOnce(&Self::Var) -> bool) -> bool { ... }
fn is_ground_or(&self, f: impl FnOnce(&Self::Var) -> bool) -> bool { ... }
fn is_var_or(&self, f: impl FnOnce(&Self::Ground) -> bool) -> bool { ... }
}Expand description
Value that can be seen as a Pattern, either a ground value or a
variable.
Implemented by Pattern itself. Resource types implementing this trait
can be used with crate::find_bijection to find a blank
node/variable-preserving bijection between two datasets.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn is_ground_and(&self, f: impl FnOnce(&Self::Ground) -> bool) -> bool
fn is_ground_and(&self, f: impl FnOnce(&Self::Ground) -> bool) -> bool
Returns true if this value is a ground value satisfying the given
predicate, and false if it is a variable.
Sourcefn is_var_and(&self, f: impl FnOnce(&Self::Var) -> bool) -> bool
fn is_var_and(&self, f: impl FnOnce(&Self::Var) -> bool) -> bool
Returns true if this value is a variable satisfying the given
predicate, and false if it is a ground value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl AsPattern for Term
Blank node identifiers act as the variable side of the Pattern
ground/variable abstraction, and ground terms act as the ground side.
impl AsPattern for Term
Blank node identifiers act as the variable side of the Pattern
ground/variable abstraction, and ground terms act as the ground side.
This lets lexical RDF data be used directly with rdf-types’ pattern
matching and isomorphism-checking facilities (e.g.
are_isomorphic and
find_bijection), since blank node
identifiers, like pattern variables, are existentially quantified and can
be renamed without changing the meaning of the data.