Triple

Trait Triple 

Source
pub trait Triple {
    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] where Self: Sized; // Provided methods fn spo(&self) -> [TBorrowTerm<'_, Self>; 3] { ... } fn to_s(self) -> Self::Term where Self: Sized { ... } fn to_p(self) -> Self::Term where Self: Sized { ... } fn to_o(self) -> Self::Term where Self: Sized { ... } 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> where Self: Sized { ... } fn into_quad_from( self, graph_name: GraphName<Self::Term>, ) -> Spog<Self::Term> where Self: Sized { ... }
}
Expand description

This trait represents an abstract RDF triple, and provide convenient methods for working with triples.

Required Associated Types§

Source

type Term: Term

The type of Term contained by this triple

Required Methods§

Source

fn s(&self) -> TBorrowTerm<'_, Self>

The subject of this triple.

Source

fn p(&self) -> TBorrowTerm<'_, Self>

The predicate of this triple.

Source

fn o(&self) -> TBorrowTerm<'_, Self>

The object of this triple.

Source

fn to_spo(self) -> [Self::Term; 3]
where Self: Sized,

Consume this triple, returning all its components.

See also Triple::spo.

Provided Methods§

Source

fn spo(&self) -> [TBorrowTerm<'_, Self>; 3]

The three components of this triple, as a triple of borrowed terms.

See also Triple::to_spo.

Source

fn to_s(self) -> Self::Term
where Self: Sized,

Consume this triple, returning its subject.

Source

fn to_p(self) -> Self::Term
where Self: Sized,

Consume this triple, returning its predicate.

Source

fn to_o(self) -> Self::Term
where Self: Sized,

Consume this triple, returning its object.

Source

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.

Source

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.

Source

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.

Source

fn into_quad(self) -> Spog<Self::Term>
where Self: Sized,

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.

Source

fn into_quad_from(self, graph_name: GraphName<Self::Term>) -> Spog<Self::Term>
where Self: Sized,

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.

Implementations on Foreign Types§

Source§

impl<T: Term> Triple for [T; 3]

Source§

type Term = T

Source§

fn s(&self) -> TBorrowTerm<'_, Self>

Source§

fn p(&self) -> TBorrowTerm<'_, Self>

Source§

fn o(&self) -> TBorrowTerm<'_, Self>

Source§

fn to_spo(self) -> [Self::Term; 3]

Implementors§