org.jrdf.graph.local.index
Interface Index<T>

All Known Subinterfaces:
LongIndex
All Known Implementing Classes:
AbstractIndex, GlobalIndex, LongIndexBdb, LongIndexDb4o, LongIndexMem, LongIndexSesame

public interface Index<T>


Method Summary
 void add(T... node)
          Adds a triple to a single index.
 void clear()
          Removes all triples from this index.
 void close()
           
 boolean contains(T first)
          Returns true if the value given exists in the index.
 long getSize()
          Returns the number of triples in the index.
 Map<T,Set<T>> getSubIndex(T first)
          Returns the map of long to set of longs for the given entry of the index.
 Iterator<Map.Entry<T,Map<T,Set<T>>>> iterator()
          Returns an iterator which contains all the elements in the graph as a collections of distinct longs, contains a map of longs to other longs.
 void remove(T... node)
          Removes a triple from a single index.
 boolean removeSubIndex(T first)
          Removes the given entry of long to set of longs with the given entry.
 

Method Detail

add

void add(T... node)
         throws GraphException
Adds a triple to a single index. This method defines the internal structure.

Parameters:
node - The nodes to add.
Throws:
GraphException - If there was an error adding the statement.

remove

void remove(T... node)
            throws GraphException
Removes a triple from a single index.

Parameters:
node - the nodes to remove.
Throws:
GraphException - If there was an error revoking the statement, for example if it didn't exist.

clear

void clear()
Removes all triples from this index.


iterator

Iterator<Map.Entry<T,Map<T,Set<T>>>> iterator()
Returns an iterator which contains all the elements in the graph as a collections of distinct longs, contains a map of longs to other longs. This prevents any duplication.

Returns:
an iterator which contains all the elements in the graph as a collections of distinct longs, contains a map of longs to other longs. This prevents any duplication.

getSubIndex

Map<T,Set<T>> getSubIndex(T first)
Returns the map of long to set of longs for the given entry of the index. For example, a given subject id is given and it returns a map of predicates to objects.

Parameters:
first - the entry set to find.
Returns:
a map containing the list of longs to set of longs.

contains

boolean contains(T first)
Returns true if the value given exists in the index.

Parameters:
first - the key to search for.
Returns:
true if the key exsts.

removeSubIndex

boolean removeSubIndex(T first)
Removes the given entry of long to set of longs with the given entry. For example, a given subject id is given and it will remove all the associated predicate and objects for that subject.

Parameters:
first - the entry set to remove.
Returns:
true if the entry set was non-null.

getSize

long getSize()
Returns the number of triples in the index.

Returns:
the number of triples in the index.

close

void close()