Trait sophia_api::dataset::MutableDataset [−][src]
pub trait MutableDataset: Dataset {
type MutationError: 'static + Error;
fn insert<TS, TP, TO, TG>(
&mut self,
s: &TS,
p: &TP,
o: &TO,
g: Option<&TG>
) -> MdResult<Self, bool>
where
TS: TTerm + ?Sized,
TP: TTerm + ?Sized,
TO: TTerm + ?Sized,
TG: TTerm + ?Sized;
fn remove<TS, TP, TO, TG>(
&mut self,
s: &TS,
p: &TP,
o: &TO,
g: Option<&TG>
) -> MdResult<Self, bool>
where
TS: TTerm + ?Sized,
TP: TTerm + ?Sized,
TO: TTerm + ?Sized,
TG: TTerm + ?Sized;
fn insert_all<QS>(
&mut self,
src: QS
) -> StreamResult<usize, QS::Error, <Self as MutableDataset>::MutationError>
where
QS: QuadSource,
{ ... }
fn remove_all<QS>(
&mut self,
src: QS
) -> StreamResult<usize, QS::Error, <Self as MutableDataset>::MutationError>
where
QS: QuadSource,
{ ... }
fn remove_matching<S, P, O, G>(
&mut self,
ms: &S,
mp: &P,
mo: &O,
mg: &G
) -> MdResult<Self, usize>
where
S: TermMatcher + ?Sized,
P: TermMatcher + ?Sized,
O: TermMatcher + ?Sized,
G: GraphNameMatcher + ?Sized,
DTerm<Self>: Clone,
<Self as Dataset>::Error: Into<Self::MutationError>,
{ ... }
fn retain_matching<S, P, O, G>(
&mut self,
ms: &S,
mp: &P,
mo: &O,
mg: &G
) -> Result<(), Self::MutationError>
where
S: TermMatcher + ?Sized,
P: TermMatcher + ?Sized,
O: TermMatcher + ?Sized,
G: GraphNameMatcher + ?Sized,
DTerm<Self>: Clone,
<Self as Dataset>::Error: Into<Self::MutationError>,
{ ... }
}
Expand description
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
type MutationError: 'static + Error
The error type that this dataset may raise during mutations.
Required methods
Insert the given quad in this dataset.
Return value
The bool
value returned in case of success is
not significant unless this dataset also implements SetDataset
.
If it does,
true
is returned iff the insertion actually changed the dataset.
In other words,
a return value of false
means that the dataset was not changed,
because the quad was already present in this SetDataset
.
Remove the given quad from this dataset.
Return value
The bool
value returned in case of success is
not significant unless this dataset also implements SetDataset
.
If it does,
true
is returned iff the removal actually changed the dataset.
In other words,
a return value of false
means that the dataset was not changed,
because the quad was already absent from this SetDataset
.
Provided methods
fn insert_all<QS>(
&mut self,
src: QS
) -> StreamResult<usize, QS::Error, <Self as MutableDataset>::MutationError> where
QS: QuadSource,
fn insert_all<QS>(
&mut self,
src: QS
) -> StreamResult<usize, QS::Error, <Self as MutableDataset>::MutationError> where
QS: QuadSource,
Insert into this dataset all quads from the given source.
Blank node scope
The blank nodes contained in the quad 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 dataset contains data from a file, and you are inserting data from a different file. In that case, you should first transform the quad source, in order to get fresh blank node identifiers.
Return value
The usize
value returned in case of success is
not significant unless this dataset also implements SetDataset
.
If it does,
the number of quads that were actually inserted
(i.e. that were not already present in this SetDataset
)
is returned.
fn remove_all<QS>(
&mut self,
src: QS
) -> StreamResult<usize, QS::Error, <Self as MutableDataset>::MutationError> where
QS: QuadSource,
fn remove_all<QS>(
&mut self,
src: QS
) -> StreamResult<usize, QS::Error, <Self as MutableDataset>::MutationError> where
QS: QuadSource,
Remove from this dataset all quads from the given source.
Return value
The usize
value returned in case of success is
not significant unless this dataset also implements SetDataset
.
If it does,
the number of quads that were actually removed
(i.e. that were not already absent from this SetDataset
)
is returned.
fn remove_matching<S, P, O, G>(
&mut self,
ms: &S,
mp: &P,
mo: &O,
mg: &G
) -> MdResult<Self, usize> where
S: TermMatcher + ?Sized,
P: TermMatcher + ?Sized,
O: TermMatcher + ?Sized,
G: GraphNameMatcher + ?Sized,
DTerm<Self>: Clone,
<Self as Dataset>::Error: Into<Self::MutationError>,
fn remove_matching<S, P, O, G>(
&mut self,
ms: &S,
mp: &P,
mo: &O,
mg: &G
) -> MdResult<Self, usize> where
S: TermMatcher + ?Sized,
P: TermMatcher + ?Sized,
O: TermMatcher + ?Sized,
G: GraphNameMatcher + ?Sized,
DTerm<Self>: Clone,
<Self as Dataset>::Error: Into<Self::MutationError>,
Remove all quads matching the given matchers.
Return value
The usize
value returned in case of success is
not significant unless this dataset also implements SetDataset
.
If it does,
the number of quads that were actually removed
(i.e. that were not already absent from this SetDataset
)
is returned.
Note to implementors
The default implementation is rather naive, and could be improved in specific implementations of the trait.
fn retain_matching<S, P, O, G>(
&mut self,
ms: &S,
mp: &P,
mo: &O,
mg: &G
) -> Result<(), Self::MutationError> where
S: TermMatcher + ?Sized,
P: TermMatcher + ?Sized,
O: TermMatcher + ?Sized,
G: GraphNameMatcher + ?Sized,
DTerm<Self>: Clone,
<Self as Dataset>::Error: Into<Self::MutationError>,
fn retain_matching<S, P, O, G>(
&mut self,
ms: &S,
mp: &P,
mo: &O,
mg: &G
) -> Result<(), Self::MutationError> where
S: TermMatcher + ?Sized,
P: TermMatcher + ?Sized,
O: TermMatcher + ?Sized,
G: GraphNameMatcher + ?Sized,
DTerm<Self>: Clone,
<Self as Dataset>::Error: Into<Self::MutationError>,
Keep only the quads matching the given matchers.
Note to implementors
The default implementation is rather naive, and could be improved in specific implementations of the trait.