[][src]Trait sophia::graph::indexed::IndexedGraph

pub trait IndexedGraph {
    type Index: Copy + Eq + Hash;
    type TermData: TermData + 'static;
    fn get_index<T>(&self, t: &Term<T>) -> Option<Self::Index>
    where
        T: TermData
;
fn get_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>;
fn insert_indexed<T, U, V>(
        &mut self,
        s: &Term<T>,
        p: &Term<U>,
        o: &Term<V>
    ) -> Option<[Self::Index; 3]>
    where
        T: TermData,
        U: TermData,
        V: TermData
;
fn remove_indexed<T, U, V>(
        &mut self,
        s: &Term<T>,
        p: &Term<U>,
        o: &Term<V>
    ) -> Option<[Self::Index; 3]>
    where
        T: TermData,
        U: TermData,
        V: TermData
;
fn shrink_to_fit(&mut self); }

A utility trait for implementing Graph and MutableGraph based on an internal TermIndexMap for efficient storage.

The impl_mutable_graph_for_indexed_graph! macro can be used to derive the MutableGraph implementation for any implementation of IndexedGraph.

Associated Types

type Index: Copy + Eq + Hash

The type used to represent terms internally.

type TermData: TermData + 'static

Loading content...

Required methods

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_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>

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

fn insert_indexed<T, U, V>(
    &mut self,
    s: &Term<T>,
    p: &Term<U>,
    o: &Term<V>
) -> Option<[Self::Index; 3]> where
    T: TermData,
    U: TermData,
    V: TermData

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

fn remove_indexed<T, U, V>(
    &mut self,
    s: &Term<T>,
    p: &Term<U>,
    o: &Term<V>
) -> Option<[Self::Index; 3]> where
    T: TermData,
    U: TermData,
    V: TermData

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

fn shrink_to_fit(&mut self)

Loading content...

Implementors

impl<I> IndexedGraph for HashGraph<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> IndexedGraph for OpsWrapper<T> where
    T: IndexedGraph + for<'a> Graph<'a, Triple = [&'a Term<<T as IndexedGraph>::TermData>; 3]>, 
[src]

type Index = T::Index

type TermData = T::TermData

impl<T> IndexedGraph for SpoWrapper<T> where
    T: IndexedGraph + for<'a> Graph<'a, Triple = [&'a Term<<T as IndexedGraph>::TermData>; 3]>, 
[src]

type Index = T::Index

type TermData = T::TermData

Loading content...