org.jrdf.graph.local.iterator
Interface IteratorFactory

All Known Implementing Classes:
DiskIteratorFactory, MemIteratorFactory, OrderedIteratorFactoryImpl

public interface IteratorFactory

Creates the iterators. Allows different implementations of iterators to be used.

Version:
$Id: IteratorFactory.java 1449 2007-09-12 07:15:14Z hamrawee $
Author:
Andrew Newman

Method Summary
 ClosableIterator<Triple> newEmptyClosableIterator()
          Return an new EmptyClosableIterator - indicates no results found.
 ClosableIterator<Triple> newGraphIterator()
          Return an new GraphIterator - result of an unconstrained find.
 ClosableIterator<Triple> newOneFixedIterator(Long fixedFirstNode, int index)
          Return a new FixedIterator - bound by one node.
 ClosableIterator<PredicateNode> newPredicateIterator()
          Return a new PredicateIterator - all unique predicates.
 ClosableIterator<PredicateNode> newPredicateIterator(Long resource)
          Return a new PredicateIterator - all unique predicates for a given resource (subject and object).
 ClosableIterator<Triple> newThreeFixedIterator(Long[] nodes)
          Return a new FixedIterator - bound by three nodes.
 ClosableIterator<Triple> newTwoFixedIterator(Long fixedFirstNode, Long fixedSecondNode, int index)
          Return a new FixedItereator - bound by two nodes.
 

Method Detail

newEmptyClosableIterator

ClosableIterator<Triple> newEmptyClosableIterator()
Return an new EmptyClosableIterator - indicates no results found.

Returns:
an empty closable iterator - always hasNext false and next throws exception.

newGraphIterator

ClosableIterator<Triple> newGraphIterator()
Return an new GraphIterator - result of an unconstrained find.

Returns:
a graph iterator - goes through all triples in the graph.

newOneFixedIterator

ClosableIterator<Triple> newOneFixedIterator(Long fixedFirstNode,
                                             int index)
Return a new FixedIterator - bound by one node.

Parameters:
fixedFirstNode - the node to find.
index - which index (from the three) to use.
Returns:
a new FixedIterator - goes through the graph and returns all given triples with the given node.

newTwoFixedIterator

ClosableIterator<Triple> newTwoFixedIterator(Long fixedFirstNode,
                                             Long fixedSecondNode,
                                             int index)
Return a new FixedItereator - bound by two nodes.

Parameters:
fixedFirstNode - the first node to find.
fixedSecondNode - the second node to find.
index - which index (from the three) to use.
Returns:
a new FixedIterator - goes through the graph and returns all given triples with the two given nodes.

newThreeFixedIterator

ClosableIterator<Triple> newThreeFixedIterator(Long[] nodes)
Return a new FixedIterator - bound by three nodes.

Parameters:
nodes - the triple to find.
Returns:
a new FixedIterator - either one or none triples.

newPredicateIterator

ClosableIterator<PredicateNode> newPredicateIterator()
Return a new PredicateIterator - all unique predicates.

Returns:
a new PredicateIterator - all unique predicates.

newPredicateIterator

ClosableIterator<PredicateNode> newPredicateIterator(Long resource)
Return a new PredicateIterator - all unique predicates for a given resource (subject and object).

Parameters:
resource - all unique predicate for a given resource.
Returns:
a new PredicateIterator - all unique predicate for a given resource (subject and object).