[][src]Trait sophia::dataset::indexed::IndexedDataset

pub trait IndexedDataset {
    type Index: Copy + Eq + Hash;
    type TermData: TermData + 'static;
    fn with_capacity(capacity: usize) -> Self;
fn shrink_to_fit(&mut self);
fn get_index<T>(&self, t: &Term<T>) -> Option<Self::Index>
    where
        T: TermData
;
fn get_index_for_graph_name<T>(
        &self,
        g: Option<&Term<T>>
    ) -> Option<Self::Index>
    where
        T: TermData
;
fn get_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>;
fn get_graph_name(
        &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<[Self::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<[Self::Index; 4]>
    where
        T: TermData,
        U: TermData,
        V: TermData,
        W: TermData
; }

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

Loading content...

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

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

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>>>

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

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

Remove a triple from this Dataset, and return the corresponding tuple of indices.

Loading content...

Implementors

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

type Index = I::Index

type TermData = <I::Factory as TermFactory>::TermData

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

type Index = T::Index

type TermData = T::TermData

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

type Index = T::Index

type TermData = T::TermData

Loading content...