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

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: ?Sized>(&self, t: &T) -> Option<Self::Index> where
    T: TTerm

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

fn get_index_for_graph_name<T: ?Sized>(
    &self,
    g: Option<&T>
) -> Option<Self::Index> where
    T: TTerm

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

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

fn remove_indexed<TS: ?Sized, TP: ?Sized, TO: ?Sized, TG: ?Sized>(
    &mut self,
    s: &TS,
    p: &TP,
    o: &TO,
    g: Option<&TG>
) -> Option<[Self::Index; 4]> where
    TS: TTerm,
    TP: TTerm,
    TO: TTerm,
    TG: TTerm

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<Term<<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<Term<<T as IndexedDataset>::TermData>>>, 
[src]

type Index = T::Index

type TermData = T::TermData

Loading content...