Trait sophia_api::triple::Triple

source ·
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§

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]

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

Consume this triple, returning its subject.

source

fn to_p(self) -> Self::Term

Consume this triple, returning its predicate.

source

fn to_o(self) -> Self::Term

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>

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>

Convert this triple to a Quad in the given named graph.

See also Triple::into_quad.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

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

§

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§