org.jrdf.graph.index.graphhandler
Interface GraphHandler

All Known Implementing Classes:
AbstractGraphHandler, GraphHandler012, GraphHandler120, GraphHandler201

public interface GraphHandler

An interface used to make modifications on the internal indexes (012, 120 and 201) of a graph.

Version:
$Revision: 1045 $
Author:
Andrew Newman

Method Summary
 Node[] createTriple(Long[] nodes)
          Creates the globalized nodes based on the internal representation of the nodes.
 Iterator<Map.Entry<Long,Map<Long,Set<Long>>>> getEntries()
          Returns an iterator over an internal representation of the graph in the fixed order based on the underlying index.
 void reconstructIndices(LongIndex firstIndex, LongIndex secondIndex, LongIndex thirdIndex)
          As 012, 120 and 201 are symmetrical this can be used to reconstruct either two from any one index.
 void remove(Long[] currentNodes)
          Removes a triple from the other indexes of the graph.
 

Method Detail

reconstructIndices

void reconstructIndices(LongIndex firstIndex,
                        LongIndex secondIndex,
                        LongIndex thirdIndex)
                        throws GraphException
As 012, 120 and 201 are symmetrical this can be used to reconstruct either two from any one index. Using the 012 index it will add entries correctly to 120 (secondIndex) and 201 (thirdIndex), or 120 will make 201 (secondIndex) and 012 (thirdIndex) and 201 will produce 120 and 201.

Parameters:
firstIndex - the first index.
secondIndex - the second index.
thirdIndex - the third index.
Throws:
GraphException - if the adds fail.

getEntries

Iterator<Map.Entry<Long,Map<Long,Set<Long>>>> getEntries()
Returns an iterator over an internal representation of the graph in the fixed order based on the underlying index.

Returns:
an iterator over an internal representation of the graph in the fixed order based on the underlying index.

createTriple

Node[] createTriple(Long[] nodes)
                    throws TripleFactoryException
Creates the globalized nodes based on the internal representation of the nodes. This may move to the NodePool interface.

Parameters:
nodes - an array of three triple values to create.
Returns:
an array of three nodes.
Throws:
TripleFactoryException - if the nodes could not be mapped - the nodes must refer to something that already have existed.

remove

void remove(Long[] currentNodes)
            throws GraphException
Removes a triple from the other indexes of the graph. For example, if this is the 012 GraphHandler it will remove the 120 and 201.

Parameters:
currentNodes - the array of nodes to remove.
Throws:
GraphException - if the nodes do not exist.