pub trait MutableGraph: Graph {
    type MutationError: 'static + Error;
    fn insert<TS, TP, TO>(
        &mut self,
        s: &TS,
        p: &TP,
        o: &TO
    ) -> MgResult<Self, bool>
    where
        TS: TTerm + ?Sized,
        TP: TTerm + ?Sized,
        TO: TTerm + ?Sized
;
fn remove<TS, TP, TO>(
        &mut self,
        s: &TS,
        p: &TP,
        o: &TO
    ) -> MgResult<Self, bool>
    where
        TS: TTerm + ?Sized,
        TP: TTerm + ?Sized,
        TO: TTerm + ?Sized
; fn insert_all<TS>(
        &mut self,
        src: TS
    ) -> StreamResult<usize, TS::Error, <Self as MutableGraph>::MutationError>
    where
        TS: TripleSource
, { ... }
fn remove_all<TS>(
        &mut self,
        src: TS
    ) -> StreamResult<usize, TS::Error, <Self as MutableGraph>::MutationError>
    where
        TS: TripleSource
, { ... }
fn remove_matching<'s, S, P, O>(
        &'s mut self,
        ms: &S,
        mp: &P,
        mo: &O
    ) -> Result<usize, Self::MutationError>
    where
        S: TermMatcher + ?Sized,
        P: TermMatcher + ?Sized,
        O: TermMatcher + ?Sized,
        GTerm<Self>: Clone,
        <Self as Graph>::Error: Into<Self::MutationError>
, { ... }
fn retain_matching<'s, S, P, O>(
        &'s mut self,
        ms: &S,
        mp: &P,
        mo: &O
    ) -> Result<(), Self::MutationError>
    where
        S: TermMatcher + ?Sized,
        P: TermMatcher + ?Sized,
        O: TermMatcher + ?Sized,
        GTerm<Self>: Clone,
        <Self as Graph>::Error: Into<Self::MutationError>
, { ... } }
Expand description

Generic trait for mutable RDF graphs.

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

Associated Types

The error type that this graph may raise during mutations.

Required methods

Insert the given triple in this graph.

Return value

The bool value returned in case of success is not significant unless this graph also implements SetGraph.

If it does, true is returned iff the insertion actually changed the graph. In other words, a return value of false means that the graph was not changed, because the triple was already present in this SetGraph.

Usage

let schema = Namespace::new("http://schema.org/").unwrap();
let s_name = schema.get("name").unwrap();

graph.insert(&s_name, &rdf::type_, &rdf::Property)?;
graph.insert(&s_name, &rdfs::range, &xsd::string)?;

Remove the given triple from this graph.

Return value

The bool value returned in case of success is not significant unless this graph also implements SetGraph.

If it does, true is returned iff the removal actually changed the graph. In other words, a return value of false means that the graph was not changed, because the triple was already absent from this SetGraph.

Provided methods

Insert into this graph all triples from the given source.

Blank node scope

The blank nodes contained in the triple source will be inserted as is. If they happen to have the same identifier as blank nodes already present, they will be considered equal. This might not be what you want, especially if the graph contains data from a file, and you are inserting data from a different file. In that case, you should first transform the triple source, in order to get fresh blank node identifiers.

Return value

The usize value returned in case of success is not significant unless this graph also implements SetGraph.

If it does, the number of triples that were actually inserted (i.e. that were not already present in this SetGraph) is returned.

Remove from this graph all triples from the given source.

Return value

The usize value returned in case of success is not significant unless this graph also implements SetGraph.

If it does, the number of triples that were actually removed (i.e. that were not already absent from this SetGraph) is returned.

Remove all triples matching the given matchers.

Return value

The usize value returned in case of success is not significant unless this graph also implements SetGraph.

If it does, the number of triples that were actually removed (i.e. that were not already absent from this SetGraph) is returned.

Note to implementors

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

Keep only the triples matching the given matchers.

Note to implementors

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

Implementations on Foreign Types

Implementors