[−][src]Trait sophia::graph::MutableGraph
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.
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,
&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,
&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.
Provided methods
fn insert_all<TS>(
&mut self,
src: &mut TS
) -> StreamResult<usize, TS::Error, Self::MutationError> where
TS: TripleSource,
&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,
&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>,
&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>,
&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.
Implementations on Foreign Types
impl MutableGraph for Vec<[BoxTerm; 3]>
[src]
type MutationError = Infallible
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,
[src]
&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,
[src]
&mut self,
s: &Term<T>,
p: &Term<U>,
o: &Term<V>
) -> MGResult<Self, bool> where
T: TermData,
U: TermData,
V: TermData,
impl<BH> MutableGraph for HashSet<[BoxTerm; 3], BH> where
BH: BuildHasher,
[src]
BH: BuildHasher,
type MutationError = Infallible
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,
[src]
&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,
[src]
&mut self,
s: &Term<T>,
p: &Term<U>,
o: &Term<V>
) -> MGResult<Self, bool> where
T: TermData,
U: TermData,
V: TermData,
Implementors
impl<D, E, F> MutableGraph for DatasetGraph<D, E, Option<Term<F>>> where
D: MutableDataset,
E: BorrowMut<D>,
F: TermData,
[src]
D: MutableDataset,
E: BorrowMut<D>,
F: TermData,
type MutationError = D::MutationError
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,
[src]
&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,
[src]
&mut self,
s: &Term<T>,
p: &Term<U>,
o: &Term<V>
) -> MGResult<Self, bool> where
T: TermData,
U: TermData,
V: TermData,
impl<I> MutableGraph for HashGraph<I> where
I: TermIndexMap,
I::Index: Hash,
<I::Factory as TermFactory>::TermData: 'static,
[src]
I: TermIndexMap,
I::Index: Hash,
<I::Factory as TermFactory>::TermData: 'static,
type MutationError = Infallible
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,
[src]
&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,
[src]
&mut self,
s: &Term<T_>,
p: &Term<U_>,
o: &Term<V_>
) -> MGResult<Self, bool> where
T_: TermData,
U_: TermData,
V_: TermData,
impl<T> MutableGraph for OpsWrapper<T> where
T: IndexedGraph + Graph<Triple = ByTermRefs<<T as IndexedGraph>::TermData>>,
[src]
T: IndexedGraph + Graph<Triple = ByTermRefs<<T as IndexedGraph>::TermData>>,
type MutationError = Infallible
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,
[src]
&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,
[src]
&mut self,
s: &Term<T_>,
p: &Term<U_>,
o: &Term<V_>
) -> MGResult<Self, bool> where
T_: TermData,
U_: TermData,
V_: TermData,
impl<T> MutableGraph for SpoWrapper<T> where
T: IndexedGraph + Graph<Triple = ByTermRefs<<T as IndexedGraph>::TermData>>,
[src]
T: IndexedGraph + Graph<Triple = ByTermRefs<<T as IndexedGraph>::TermData>>,
type MutationError = Infallible
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,
[src]
&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,
[src]
&mut self,
s: &Term<T_>,
p: &Term<U_>,
o: &Term<V_>
) -> MGResult<Self, bool> where
T_: TermData,
U_: TermData,
V_: TermData,