[][src]Trait sophia::dataset::MutableDataset

pub trait MutableDataset: for<'x> Dataset<'x> {
    type MutationError: CoercibleWith<Error> + CoercibleWith<Never>;
    fn insert<T, U, V, W>(
        &mut self,
        s: &Term<T>,
        p: &Term<U>,
        o: &Term<V>,
        g: Option<&Term<W>>
    ) -> MDResult<Self, bool>
    where
        T: TermData,
        U: TermData,
        V: TermData,
        W: TermData
;
fn remove<T, U, V, W>(
        &mut self,
        s: &Term<T>,
        p: &Term<U>,
        o: &Term<V>,
        g: Option<&Term<W>>
    ) -> MDResult<Self, bool>
    where
        T: TermData,
        U: TermData,
        V: TermData,
        W: 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: QuadSource<'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: QuadSource<'a>,
        TS::Error: CoercibleWith<Self::MutationError>
, { ... }
fn remove_matching<S: ?Sized, P: ?Sized, O: ?Sized, G: ?Sized>(
        &mut self,
        ms: &S,
        mp: &P,
        mo: &O,
        mg: &G
    ) -> MDResult<Self, usize>
    where
        S: TermMatcher,
        P: TermMatcher,
        O: TermMatcher,
        G: GraphNameMatcher,
        Self::Error: Into<Self::MutationError>,
        Never: CoercibleWith<Self::MutationError>,
        Self::MutationError: From<CoercedError<Never, Self::MutationError>>
, { ... }
fn retain<S: ?Sized, P: ?Sized, O: ?Sized, G: ?Sized>(
        &mut self,
        ms: &S,
        mp: &P,
        mo: &O,
        mg: &G
    ) -> MDResult<Self, ()>
    where
        S: TermMatcher,
        P: TermMatcher,
        O: TermMatcher,
        G: GraphNameMatcher,
        Self::Error: Into<Self::MutationError>,
        Never: CoercibleWith<Self::MutationError>,
        Self::MutationError: From<CoercedError<Never, Self::MutationError>>
, { ... } }

Generic trait for mutable RDF datasets.

NB: the semantics of this trait allows a dataset to contain duplicate quads; see also SetDataset.

Associated Types

type MutationError: CoercibleWith<Error> + CoercibleWith<Never>

The error type that this dataset may raise during mutations.

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

Loading content...

Required methods

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

Insert the given quad in this dataset.

Return true iff the quad was actually inserted.

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

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

Remove the given quad in this dataset.

Return true iff the quad was actually removed.

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

Loading content...

Provided methods

fn inserter(&mut self) -> Inserter<Self>

Return a QuadSink that will insert into this dataset all the quads it receives.

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

Insert into this dataset all quads from the given source.

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

Return a QuadSink that will remove from this dataset all the quads it receives.

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

Remove from this dataset all quads from the given source.

fn remove_matching<S: ?Sized, P: ?Sized, O: ?Sized, G: ?Sized>(
    &mut self,
    ms: &S,
    mp: &P,
    mo: &O,
    mg: &G
) -> MDResult<Self, usize> where
    S: TermMatcher,
    P: TermMatcher,
    O: TermMatcher,
    G: GraphNameMatcher,
    Self::Error: Into<Self::MutationError>,
    Never: CoercibleWith<Self::MutationError>,
    Self::MutationError: From<CoercedError<Never, Self::MutationError>>, 

Remove all quads 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, G: ?Sized>(
    &mut self,
    ms: &S,
    mp: &P,
    mo: &O,
    mg: &G
) -> MDResult<Self, ()> where
    S: TermMatcher,
    P: TermMatcher,
    O: TermMatcher,
    G: GraphNameMatcher,
    Self::Error: Into<Self::MutationError>,
    Never: CoercibleWith<Self::MutationError>,
    Self::MutationError: From<CoercedError<Never, Self::MutationError>>, 

Keep only the quads 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 MutableDataset for Vec<([BoxTerm; 3], Option<BoxTerm>)>[src]

type MutationError = Never

impl<S: BuildHasher> MutableDataset for HashSet<([BoxTerm; 3], Option<BoxTerm>), S>[src]

type MutationError = Never

Loading content...

Implementors

impl<G, H> MutableDataset for GraphAsDataset<G, H> where
    G: MutableGraph,
    H: BorrowMut<G>,
    Error: From<G::MutationError>, 
[src]

type MutationError = Error

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

type MutationError = Never

impl<T> MutableDataset for GspoWrapper<T> where
    T: IndexedDataset + for<'a> Dataset<'a, Quad = ([&'a Term<<T as IndexedDataset>::TermData>; 3], Option<&'a Term<<T as IndexedDataset>::TermData>>)>, 
[src]

type MutationError = Never

impl<T> MutableDataset for OgpsWrapper<T> where
    T: IndexedDataset + for<'a> Dataset<'a, Quad = ([&'a Term<<T as IndexedDataset>::TermData>; 3], Option<&'a Term<<T as IndexedDataset>::TermData>>)>, 
[src]

type MutationError = Never

Loading content...