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

pub trait MutableDataset: Dataset {
    type MutationError: 'static + Error;
    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 insert_all<TS>(
        &mut self,
        src: &mut TS
    ) -> StreamResult<usize, TS::Error, Self::MutationError>
    where
        TS: QuadSource
, { ... }
fn remove_all<TS>(
        &mut self,
        src: &mut TS
    ) -> StreamResult<usize, TS::Error, Self::MutationError>
    where
        TS: QuadSource
, { ... }
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>,
        Infallible: Into<Self::MutationError>
, { ... }
fn retain_matching<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>,
        Infallible: Into<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: 'static + Error

The error type that this dataset may raise during mutations.

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 insert_all<TS>(
    &mut self,
    src: &mut TS
) -> StreamResult<usize, TS::Error, Self::MutationError> where
    TS: QuadSource

Insert into this dataset all quads from the given source.

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

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>,
    Infallible: Into<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_matching<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>,
    Infallible: Into<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 = Infallible

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

type MutationError = Infallible

Loading content...

Implementors

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

type MutationError = GraphAsDatasetError<G::MutationError>

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

type MutationError = Infallible

impl<T> MutableDataset for GspoWrapper<T> where
    T: IndexedDataset + Dataset<Quad = ByTermRefs<<T as IndexedDataset>::TermData>>, 
[src]

type MutationError = Infallible

impl<T> MutableDataset for OgpsWrapper<T> where
    T: IndexedDataset + Dataset<Quad = ByTermRefs<<T as IndexedDataset>::TermData>>, 
[src]

type MutationError = Infallible

Loading content...