[][src]Trait sophia::graph::MutableGraph

pub trait MutableGraph: Graph {
    type MutationError: 'static + Error;
    fn insert<T, U, V>(
        &mut self,
        s: &Term<T>,
        p: &Term<U>,
        o: &Term<V>
    ) -> MGResult<Self, bool>
    where
        T: TermData,
        U: TermData,
        V: TermData
;
fn remove<T, U, V>(
        &mut self,
        s: &Term<T>,
        p: &Term<U>,
        o: &Term<V>
    ) -> MGResult<Self, bool>
    where
        T: TermData,
        U: TermData,
        V: TermData
; fn insert_all<TS>(
        &mut self,
        src: &mut TS
    ) -> StreamResult<usize, TS::Error, Self::MutationError>
    where
        TS: TripleSource
, { ... }
fn remove_all<TS>(
        &mut self,
        src: &mut TS
    ) -> StreamResult<usize, TS::Error, Self::MutationError>
    where
        TS: TripleSource
, { ... }
fn remove_matching<S: ?Sized, P: ?Sized, O: ?Sized>(
        &mut self,
        ms: &S,
        mp: &P,
        mo: &O
    ) -> Result<usize, Self::MutationError>
    where
        S: TermMatcher,
        P: TermMatcher,
        O: TermMatcher,
        Self::Error: Into<Self::MutationError>,
        Infallible: Into<Self::MutationError>
, { ... }
fn retain_matching<S: ?Sized, P: ?Sized, O: ?Sized>(
        &mut self,
        ms: &S,
        mp: &P,
        mo: &O
    ) -> Result<(), Self::MutationError>
    where
        S: TermMatcher,
        P: TermMatcher,
        O: TermMatcher,
        Self::Error: Into<Self::MutationError>,
        Infallible: Into<Self::MutationError>
, { ... } }

Generic trait for mutable RDF graphs.

NB: the semantics of this trait allows a graph to contain duplicate triples; see also SetGraph.

Associated Types

type MutationError: 'static + Error

The error type that this graph may raise during mutations.

Loading content...

Required methods

fn insert<T, U, V>(
    &mut self,
    s: &Term<T>,
    p: &Term<U>,
    o: &Term<V>
) -> MGResult<Self, bool> where
    T: TermData,
    U: TermData,
    V: TermData

Insert the given triple in this graph.

Return true iff the triple was actually inserted.

NB: unless this graph also implements SetGraph, a return value of true does not mean that the triple was not already in the graph, only that the graph now has one more occurence of it.

fn remove<T, U, V>(
    &mut self,
    s: &Term<T>,
    p: &Term<U>,
    o: &Term<V>
) -> MGResult<Self, bool> where
    T: TermData,
    U: TermData,
    V: TermData

Insert the given triple in this graph.

Return true iff the triple was actually removed.

NB: unless this graph also implements SetGraph, a return value of true does not mean that the triple is not still contained in the graph, only that the graph now has one less occurence of it.

Loading content...

Provided methods

fn insert_all<TS>(
    &mut self,
    src: &mut TS
) -> StreamResult<usize, TS::Error, Self::MutationError> where
    TS: TripleSource

Insert into this graph all triples from the given source.

fn remove_all<TS>(
    &mut self,
    src: &mut TS
) -> StreamResult<usize, TS::Error, Self::MutationError> where
    TS: TripleSource

Remove from this graph all triples from the given source.

fn remove_matching<S: ?Sized, P: ?Sized, O: ?Sized>(
    &mut self,
    ms: &S,
    mp: &P,
    mo: &O
) -> Result<usize, Self::MutationError> where
    S: TermMatcher,
    P: TermMatcher,
    O: TermMatcher,
    Self::Error: Into<Self::MutationError>,
    Infallible: Into<Self::MutationError>, 

Remove all triples matching the given matchers.

Note that the default implementation is rather naive, and could be improved in specific implementations of the trait.

fn retain_matching<S: ?Sized, P: ?Sized, O: ?Sized>(
    &mut self,
    ms: &S,
    mp: &P,
    mo: &O
) -> Result<(), Self::MutationError> where
    S: TermMatcher,
    P: TermMatcher,
    O: TermMatcher,
    Self::Error: Into<Self::MutationError>,
    Infallible: Into<Self::MutationError>, 

Keep only the triples matching the given matchers.

Note that the default implementation is rather naive, and could be improved in specific implementations of the trait.

Loading content...

Implementations on Foreign Types

impl MutableGraph for Vec<[BoxTerm; 3]>[src]

type MutationError = Infallible

impl<BH> MutableGraph for HashSet<[BoxTerm; 3], BH> where
    BH: BuildHasher
[src]

type MutationError = Infallible

Loading content...

Implementors

impl<D, E, F> MutableGraph for DatasetGraph<D, E, Option<Term<F>>> where
    D: MutableDataset,
    E: BorrowMut<D>,
    F: TermData
[src]

type MutationError = D::MutationError

impl<I> MutableGraph for HashGraph<I> where
    I: TermIndexMap,
    I::Index: Hash,
    <I::Factory as TermFactory>::TermData: 'static, 
[src]

type MutationError = Infallible

impl<T> MutableGraph for OpsWrapper<T> where
    T: IndexedGraph + Graph<Triple = ByTermRefs<<T as IndexedGraph>::TermData>>, 
[src]

type MutationError = Infallible

impl<T> MutableGraph for SpoWrapper<T> where
    T: IndexedGraph + Graph<Triple = ByTermRefs<<T as IndexedGraph>::TermData>>, 
[src]

type MutationError = Infallible

Loading content...