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

All Known Subinterfaces:
LongIndex
All Known Implementing Classes:
AbstractIndex, LongIndexAdapter, LongIndexBdb, LongIndexMem, LongIndexSesame, LongIndexSesameSync

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.
 ClosableIterator<T[]> getSubIndex(T first)
          Returns an array of results from the index.
 ClosableIterator<T> getSubSubIndex(T first, T second)
          Returns an array of results from the index.
 ClosableIterator<T[]> iterator()
          Returns an iterator which contains all the elements in the graph as an array of distinct 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

ClosableIterator<T[]> iterator()
Returns an iterator which contains all the elements in the graph as an array of distinct longs.

Returns:
an iterator which contains all the elements in the graph as an array of distinct longs.

getSubIndex

ClosableIterator<T[]> getSubIndex(T first)
Returns an array of results from the index. For example, a given subject id is given and the array of predicates and objects.

Parameters:
first - the entry to find.
Returns:
an array containing the results.

getSubSubIndex

ClosableIterator<T> getSubSubIndex(T first,
                                   T second)
Returns an array of results from the index. For example, a given subject and predicate ids the array of objects is returned.

Parameters:
first - the entry to find.
second - the entry to find.
Returns:
an array containing the results.

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