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

pub trait MutableGraph: for<'x> Graph<'x> {
    type MutationError: CoercibleWith<Error> + CoercibleWith<Never>;
    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 inserter(&mut self) -> Inserter<Self> { ... }
fn insert_all<'a, TS>(
        &mut self,
        src: &mut TS
    ) -> CoercedResult<usize, TS::Error, Self::MutationError>
    where
        TS: TripleSource<'a>,
        TS::Error: CoercibleWith<Self::MutationError>
, { ... }
fn remover(&mut self) -> Remover<Self> { ... }
fn remove_all<'a, TS>(
        &mut self,
        src: &mut TS
    ) -> CoercedResult<usize, TS::Error, Self::MutationError>
    where
        TS: TripleSource<'a>,
        TS::Error: CoercibleWith<Self::MutationError>
, { ... }
fn remove_matching<S: ?Sized, P: ?Sized, O: ?Sized>(
        &mut self,
        ms: &S,
        mp: &P,
        mo: &O
    ) -> MGResult<Self, usize>
    where
        S: TermMatcher,
        P: TermMatcher,
        O: TermMatcher,
        Self::Error: Into<Self::MutationError>,
        Never: CoercibleWith<Self::MutationError>,
        Self::MutationError: From<CoercedError<Never, Self::MutationError>>
, { ... }
fn retain<S: ?Sized, P: ?Sized, O: ?Sized>(
        &mut self,
        ms: &S,
        mp: &P,
        mo: &O
    ) -> MGResult<Self, ()>
    where
        S: TermMatcher,
        P: TermMatcher,
        O: TermMatcher,
        Self::Error: Into<Self::MutationError>,
        Never: CoercibleWith<Self::MutationError>,
        Self::MutationError: From<CoercedError<Never, 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: CoercibleWith<Error> + CoercibleWith<Never>

The error type that this graph may raise during mutations.

Must be either Never (for infallible graphs) or Error.

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 inserter(&mut self) -> Inserter<Self>

Return a TripleSink that will insert into this graph all the triples it receives.

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

Insert into this graph all triples from the given source.

fn remover(&mut self) -> Remover<Self>

Return a TripleSink that will remove from this graph all the triples it receives.

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

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
) -> MGResult<Self, usize> where
    S: TermMatcher,
    P: TermMatcher,
    O: TermMatcher,
    Self::Error: Into<Self::MutationError>,
    Never: CoercibleWith<Self::MutationError>,
    Self::MutationError: From<CoercedError<Never, 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<S: ?Sized, P: ?Sized, O: ?Sized>(
    &mut self,
    ms: &S,
    mp: &P,
    mo: &O
) -> MGResult<Self, ()> where
    S: TermMatcher,
    P: TermMatcher,
    O: TermMatcher,
    Self::Error: Into<Self::MutationError>,
    Never: CoercibleWith<Self::MutationError>,
    Self::MutationError: From<CoercedError<Never, 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 = Never

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

type MutationError = Never

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 = Never

impl<T> MutableGraph for OpsWrapper<T> where
    T: IndexedGraph + for<'a> Graph<'a, Triple = [&'a Term<<T as IndexedGraph>::TermData>; 3]>, 
[src]

type MutationError = Never

impl<T> MutableGraph for SpoWrapper<T> where
    T: IndexedGraph + for<'a> Graph<'a, Triple = [&'a Term<<T as IndexedGraph>::TermData>; 3]>, 
[src]

type MutationError = Never

Loading content...