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: &T) -> Option<Self::Index>
    where
        T: TTerm + ?Sized
;
fn get_index_for_graph_name<T>(&self, g: Option<&T>) -> Option<Self::Index>
    where
        T: TTerm + ?Sized
;
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<TS, TP, TO, TG>(
        &mut self,
        s: &TS,
        p: &TP,
        o: &TO,
        g: Option<&TG>
    ) -> Option<[Self::Index; 4]>
    where
        TS: TTerm + ?Sized,
        TP: TTerm + ?Sized,
        TO: TTerm + ?Sized,
        TG: TTerm + ?Sized
;
fn remove_indexed<TS, TP, TO, TG>(
        &mut self,
        s: &TS,
        p: &TP,
        o: &TO,
        g: Option<&TG>
    ) -> Option<[Self::Index; 4]>
    where
        TS: TTerm + ?Sized,
        TP: TTerm + ?Sized,
        TO: TTerm + ?Sized,
        TG: TTerm + ?Sized
; }
Expand description

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

The type used to represent terms internally.

The type used to hold the term data.

Required methods

Construct a new empty dataset, provisioning for storing capacity quads.

Shrink the memory consumption of the dataset as much as possible.

Return the index for the given term, if it exists.

Return the index for the given graph name, if it exists.

Return the term for the given index, if it exists.

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 associated to a proper graph name.

Insert a triple in this Dataset, and return the corresponding tuple of indices.

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

Implementors