pub trait Triple: Sized {
type Term: Term;
Show 13 methods
// Required methods
fn s(&self) -> TBorrowTerm<'_, Self>;
fn p(&self) -> TBorrowTerm<'_, Self>;
fn o(&self) -> TBorrowTerm<'_, Self>;
fn to_spo(self) -> [Self::Term; 3];
// Provided methods
fn spo(&self) -> [TBorrowTerm<'_, Self>; 3] { ... }
fn to_s(self) -> Self::Term { ... }
fn to_p(self) -> Self::Term { ... }
fn to_o(self) -> Self::Term { ... }
fn matched_by<S, P, O>(&self, sm: S, pm: P, om: O) -> bool
where S: TermMatcher,
P: TermMatcher,
O: TermMatcher { ... }
fn eq<T: Triple>(&self, other: T) -> bool { ... }
fn eq_spo<S: Term, P: Term, O: Term>(&self, s: S, p: P, o: O) -> bool { ... }
fn into_quad(self) -> Spog<Self::Term> { ... }
fn into_quad_from(
self,
graph_name: GraphName<Self::Term>,
) -> Spog<Self::Term> { ... }
}
Expand description
This trait represents an abstract RDF triple, and provide convenient methods for working with triples.
Required Associated Types§
Required Methods§
Sourcefn s(&self) -> TBorrowTerm<'_, Self>
fn s(&self) -> TBorrowTerm<'_, Self>
The subject of this triple.
Sourcefn p(&self) -> TBorrowTerm<'_, Self>
fn p(&self) -> TBorrowTerm<'_, Self>
The predicate of this triple.
Sourcefn o(&self) -> TBorrowTerm<'_, Self>
fn o(&self) -> TBorrowTerm<'_, Self>
The object of this triple.
Sourcefn to_spo(self) -> [Self::Term; 3]
fn to_spo(self) -> [Self::Term; 3]
Consume this triple, returning all its components.
See also Triple::spo
.
Provided Methods§
Sourcefn spo(&self) -> [TBorrowTerm<'_, Self>; 3]
fn spo(&self) -> [TBorrowTerm<'_, Self>; 3]
The three components of this triple, as a triple of borrowed terms.
See also Triple::to_spo
.
Sourcefn matched_by<S, P, O>(&self, sm: S, pm: P, om: O) -> bool
fn matched_by<S, P, O>(&self, sm: S, pm: P, om: O) -> bool
Checks that the constituents terms of this triple match the respective matchers.
Sourcefn eq<T: Triple>(&self, other: T) -> bool
fn eq<T: Triple>(&self, other: T) -> bool
Check whether other
is term-wise equal (using Term::eq
) to self
.
See also eq_spo
, matched_by
.
Sourcefn eq_spo<S: Term, P: Term, O: Term>(&self, s: S, p: P, o: O) -> bool
fn eq_spo<S: Term, P: Term, O: Term>(&self, s: S, p: P, o: O) -> bool
Check whether the triple (s
, p
, o
) is term-wise equal (using Term::eq
) to self
.
See also eq
, matched_by
.
Sourcefn into_quad(self) -> Spog<Self::Term>
fn into_quad(self) -> Spog<Self::Term>
Convert this triple to a Quad
in the default graph.
NB: if you do not wish to consume this triple,
you can combine this method with spo
as below:
t.spo().into_quad()
See also Triple::into_quad_from
.
Sourcefn into_quad_from(self, graph_name: GraphName<Self::Term>) -> Spog<Self::Term>
fn into_quad_from(self, graph_name: GraphName<Self::Term>) -> Spog<Self::Term>
Convert this triple to a Quad
in the given named graph.
See also Triple::into_quad
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.