[−][src]Trait sophia::dataset::indexed::IndexedDataset
A utility trait for implementing Dataset
and MutableDataset
based on an internal TermIndexMap
for efficient storage.
The impl_mutable_dataset_for_indexed_dataset!
macro
can be used to derive the MutableDataset
implementation
for any implementation of IndexedDataset
.
Associated Types
type Index: Copy + Eq + Hash
The type used to represent terms internally.
type TermData: TermData + 'static
Required methods
fn with_capacity(capacity: usize) -> Self
Construct a new empty dataset, provisioning for storing capacity
quads.
fn shrink_to_fit(&mut self)
Shrink the memory consumption of the dataset as much as possible.
fn get_index<T>(&self, t: &Term<T>) -> Option<Self::Index> where
T: TermData,
T: TermData,
Return the index for the given term, if it exists.
fn get_index_for_graph_name<T>(
&self,
g: Option<&Term<T>>
) -> Option<Self::Index> where
T: TermData,
&self,
g: Option<&Term<T>>
) -> Option<Self::Index> where
T: TermData,
Return the index for the given graph name, if it exists.
fn get_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>
Return the term for the given index, if it exists.
fn get_graph_name(
&self,
i: Self::Index
) -> Option<Option<&Term<Self::TermData>>>
&self,
i: Self::Index
) -> Option<Option<&Term<Self::TermData>>>
Return the graph name for the given index, if it exists
NB: a graph name is already an Option
, None
meaning the (unnamed) default graph.
As a consequence, this methods returns an option of option :
None
means that given index is not associated to any graph name,Some(None)
means that the given index is associated to the default graph,Some(Some(term))
means that given index is associetd to a proper graph name.
fn insert_indexed<T, U, V, W>(
&mut self,
s: &Term<T>,
p: &Term<U>,
o: &Term<V>,
g: Option<&Term<W>>
) -> Option<[Self::Index; 4]> where
T: TermData,
U: TermData,
V: TermData,
W: TermData,
&mut self,
s: &Term<T>,
p: &Term<U>,
o: &Term<V>,
g: Option<&Term<W>>
) -> Option<[Self::Index; 4]> where
T: TermData,
U: TermData,
V: TermData,
W: TermData,
Insert a triple in this Dataset, and return the corresponding tuple of indices.
fn remove_indexed<T, U, V, W>(
&mut self,
s: &Term<T>,
p: &Term<U>,
o: &Term<V>,
g: Option<&Term<W>>
) -> Option<[Self::Index; 4]> where
T: TermData,
U: TermData,
V: TermData,
W: TermData,
&mut self,
s: &Term<T>,
p: &Term<U>,
o: &Term<V>,
g: Option<&Term<W>>
) -> Option<[Self::Index; 4]> where
T: TermData,
U: TermData,
V: TermData,
W: TermData,
Remove a triple from this Dataset, and return the corresponding tuple of indices.
Implementors
impl<I> IndexedDataset for HashDataset<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 Index = I::Index
type TermData = <I::Factory as TermFactory>::TermData
fn with_capacity(capacity: usize) -> Self
[src]
fn shrink_to_fit(&mut self)
[src]
fn get_index<T>(&self, t: &Term<T>) -> Option<Self::Index> where
T: TermData,
[src]
T: TermData,
fn get_index_for_graph_name<T>(
&self,
g: Option<&Term<T>>
) -> Option<Self::Index> where
T: TermData,
[src]
&self,
g: Option<&Term<T>>
) -> Option<Self::Index> where
T: TermData,
fn get_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>
[src]
fn get_graph_name(
&self,
i: Self::Index
) -> Option<Option<&Term<Self::TermData>>>
[src]
&self,
i: Self::Index
) -> Option<Option<&Term<Self::TermData>>>
fn insert_indexed<T, U, V, W>(
&mut self,
s: &Term<T>,
p: &Term<U>,
o: &Term<V>,
g: Option<&Term<W>>
) -> Option<[I::Index; 4]> where
T: TermData,
U: TermData,
V: TermData,
W: TermData,
[src]
&mut self,
s: &Term<T>,
p: &Term<U>,
o: &Term<V>,
g: Option<&Term<W>>
) -> Option<[I::Index; 4]> where
T: TermData,
U: TermData,
V: TermData,
W: TermData,
fn remove_indexed<T, U, V, W>(
&mut self,
s: &Term<T>,
p: &Term<U>,
o: &Term<V>,
g: Option<&Term<W>>
) -> Option<[I::Index; 4]> where
T: TermData,
U: TermData,
V: TermData,
W: TermData,
[src]
&mut self,
s: &Term<T>,
p: &Term<U>,
o: &Term<V>,
g: Option<&Term<W>>
) -> Option<[I::Index; 4]> where
T: TermData,
U: TermData,
V: TermData,
W: TermData,
impl<T> IndexedDataset for GspoWrapper<T> where
T: IndexedDataset + Dataset<Quad = ByTermRefs<<T as IndexedDataset>::TermData>>,
[src]
T: IndexedDataset + Dataset<Quad = ByTermRefs<<T as IndexedDataset>::TermData>>,
type Index = T::Index
type TermData = T::TermData
fn with_capacity(capacity: usize) -> Self
[src]
fn shrink_to_fit(&mut self)
[src]
fn get_index<U>(&self, t: &Term<U>) -> Option<Self::Index> where
U: TermData,
[src]
U: TermData,
fn get_index_for_graph_name<U>(
&self,
g: Option<&Term<U>>
) -> Option<Self::Index> where
U: TermData,
[src]
&self,
g: Option<&Term<U>>
) -> Option<Self::Index> where
U: TermData,
fn get_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>
[src]
fn get_graph_name(
&self,
i: Self::Index
) -> Option<Option<&Term<Self::TermData>>>
[src]
&self,
i: Self::Index
) -> Option<Option<&Term<Self::TermData>>>
fn insert_indexed<U, V, W, X>(
&mut self,
s: &Term<U>,
p: &Term<V>,
o: &Term<W>,
g: Option<&Term<X>>
) -> Option<[Self::Index; 4]> where
U: TermData,
V: TermData,
W: TermData,
X: TermData,
[src]
&mut self,
s: &Term<U>,
p: &Term<V>,
o: &Term<W>,
g: Option<&Term<X>>
) -> Option<[Self::Index; 4]> where
U: TermData,
V: TermData,
W: TermData,
X: TermData,
fn remove_indexed<U, V, W, X>(
&mut self,
s: &Term<U>,
p: &Term<V>,
o: &Term<W>,
g: Option<&Term<X>>
) -> Option<[Self::Index; 4]> where
U: TermData,
V: TermData,
W: TermData,
X: TermData,
[src]
&mut self,
s: &Term<U>,
p: &Term<V>,
o: &Term<W>,
g: Option<&Term<X>>
) -> Option<[Self::Index; 4]> where
U: TermData,
V: TermData,
W: TermData,
X: TermData,
impl<T> IndexedDataset for OgpsWrapper<T> where
T: IndexedDataset + Dataset<Quad = ByTermRefs<<T as IndexedDataset>::TermData>>,
[src]
T: IndexedDataset + Dataset<Quad = ByTermRefs<<T as IndexedDataset>::TermData>>,
type Index = T::Index
type TermData = T::TermData
fn with_capacity(capacity: usize) -> Self
[src]
fn shrink_to_fit(&mut self)
[src]
fn get_index<U>(&self, t: &Term<U>) -> Option<Self::Index> where
U: TermData,
[src]
U: TermData,
fn get_index_for_graph_name<U>(
&self,
g: Option<&Term<U>>
) -> Option<Self::Index> where
U: TermData,
[src]
&self,
g: Option<&Term<U>>
) -> Option<Self::Index> where
U: TermData,
fn get_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>
[src]
fn get_graph_name(
&self,
i: Self::Index
) -> Option<Option<&Term<Self::TermData>>>
[src]
&self,
i: Self::Index
) -> Option<Option<&Term<Self::TermData>>>
fn insert_indexed<U, V, W, X>(
&mut self,
s: &Term<U>,
p: &Term<V>,
o: &Term<W>,
g: Option<&Term<X>>
) -> Option<[Self::Index; 4]> where
U: TermData,
V: TermData,
W: TermData,
X: TermData,
[src]
&mut self,
s: &Term<U>,
p: &Term<V>,
o: &Term<W>,
g: Option<&Term<X>>
) -> Option<[Self::Index; 4]> where
U: TermData,
V: TermData,
W: TermData,
X: TermData,
fn remove_indexed<U, V, W, X>(
&mut self,
s: &Term<U>,
p: &Term<V>,
o: &Term<W>,
g: Option<&Term<X>>
) -> Option<[Self::Index; 4]> where
U: TermData,
V: TermData,
W: TermData,
X: TermData,
[src]
&mut self,
s: &Term<U>,
p: &Term<V>,
o: &Term<W>,
g: Option<&Term<X>>
) -> Option<[Self::Index; 4]> where
U: TermData,
V: TermData,
W: TermData,
X: TermData,