sophia_api::quad

Trait Quad

Source
pub trait Quad: Sized {
    type Term: Term;

Show 14 methods // Required methods fn s(&self) -> QBorrowTerm<'_, Self>; fn p(&self) -> QBorrowTerm<'_, Self>; fn o(&self) -> QBorrowTerm<'_, Self>; fn g(&self) -> GraphName<QBorrowTerm<'_, Self>>; fn to_spog(self) -> Spog<Self::Term>; // Provided methods fn spog(&self) -> Spog<QBorrowTerm<'_, Self>> { ... } fn to_s(self) -> Self::Term { ... } fn to_p(self) -> Self::Term { ... } fn to_o(self) -> Self::Term { ... } fn to_g(self) -> GraphName<Self::Term> { ... } fn matched_by<S, P, O, G>(&self, sm: S, pm: P, om: O, gm: G) -> bool where S: TermMatcher, P: TermMatcher, O: TermMatcher, G: GraphNameMatcher { ... } fn eq<T: Quad>(&self, other: T) -> bool { ... } fn eq_spog<S: Term, P: Term, O: Term, G: Term>( &self, s: S, p: P, o: O, g: GraphName<G>, ) -> bool { ... } fn into_triple(self) -> [Self::Term; 3] { ... }
}
Expand description

This trait represents an abstract RDF quad, and provide convenient methods for working with quads.

Required Associated Types§

Source

type Term: Term

The type of Term used by this quad when borrowing it

Required Methods§

Source

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

The subject of this quad.

Source

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

The predicate of this quad.

Source

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

The object of this quad.

Source

fn g(&self) -> GraphName<QBorrowTerm<'_, Self>>

The graph name of this quad.

None means that this quad belongs to the default graph of the dataset.

Source

fn to_spog(self) -> Spog<Self::Term>

Consume this quad, returning all its components.

See also Quad::spog.

Provided Methods§

Source

fn spog(&self) -> Spog<QBorrowTerm<'_, Self>>

The four components of this quad, as a quad of borrowed terms.

See also Quad::to_spog.

Source

fn to_s(self) -> Self::Term

Consume this quad, returning its subject.

Source

fn to_p(self) -> Self::Term

Consume this quad, returning its predicate.

Source

fn to_o(self) -> Self::Term

Consume this quad, returning its object.

Source

fn to_g(self) -> GraphName<Self::Term>

Consume this quad, returning its graph name.

Source

fn matched_by<S, P, O, G>(&self, sm: S, pm: P, om: O, gm: G) -> bool

Checks that the constituents terms of this quad match the respective matchers.

Source

fn eq<T: Quad>(&self, other: T) -> bool

Check whether other is term-wise equal (using Term::eq) to self.

See also eq_spog, matched_by.

Source

fn eq_spog<S: Term, P: Term, O: Term, G: Term>( &self, s: S, p: P, o: O, g: GraphName<G>, ) -> bool

Check whether the quad (s, p, o) is term-wise equal (using Term::eq) to self.

See also eq, matched_by.

Source

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

Convert this quad to a Triple (dropping the graph name)

NB: if you do not wish to consume this quad, you can combine this method with spog as below:

    q.spog().into_triple()   

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> Quad for ([T; 3], GraphName<T>)

Source§

type Term = T

Source§

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

Source§

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

Source§

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

Source§

fn g(&self) -> GraphName<QBorrowTerm<'_, Self>>

Source§

fn to_s(self) -> Self::Term

Source§

fn to_p(self) -> Self::Term

Source§

fn to_o(self) -> Self::Term

Source§

fn to_g(self) -> GraphName<Self::Term>

Source§

fn to_spog(self) -> Spog<Self::Term>

Source§

impl<T: Term> Quad for (GraphName<T>, [T; 3])

Source§

type Term = T

Source§

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

Source§

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

Source§

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

Source§

fn g(&self) -> GraphName<QBorrowTerm<'_, Self>>

Source§

fn to_s(self) -> Self::Term

Source§

fn to_p(self) -> Self::Term

Source§

fn to_o(self) -> Self::Term

Source§

fn to_g(self) -> GraphName<Self::Term>

Source§

fn to_spog(self) -> Spog<Self::Term>

Source§

impl<T: Term> Quad for [T; 4]

Source§

type Term = T

Source§

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

Source§

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

Source§

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

Source§

fn g(&self) -> GraphName<QBorrowTerm<'_, Self>>

Source§

fn to_s(self) -> Self::Term

Source§

fn to_p(self) -> Self::Term

Source§

fn to_o(self) -> Self::Term

Source§

fn to_g(self) -> GraphName<Self::Term>

Source§

fn to_spog(self) -> Spog<Self::Term>

Implementors§