de.fuberlin.wiwiss.d2rq.find
Class D2RQResultIterator

java.lang.Object
  extended bycom.hp.hpl.jena.util.iterator.NiceIterator
      extended byde.fuberlin.wiwiss.d2rq.find.D2RQResultIterator
All Implemented Interfaces:
com.hp.hpl.jena.util.iterator.ClosableIterator, com.hp.hpl.jena.util.iterator.ExtendedIterator, java.util.Iterator

public class D2RQResultIterator
extends com.hp.hpl.jena.util.iterator.NiceIterator
implements com.hp.hpl.jena.util.iterator.ExtendedIterator

Extended iterator over the results of a find(spo) query. The D2RQResultIterator returns the results of a find(spo) query in the form of triples. The D2RQResultIterator iterates over all contained ResultTripleSets.
History: 06-21-2004 : Initial version of this class.

Version:
V0.1

History:
06-21-2004: Initial version of this class.
, V0.2

Author:
Chris Bizer chris@bizer.de, Richard Cyganiak
See Also:
GraphD2RQ, TripleResultSet

Field Summary
private  boolean m_finished
          Flag that the iteration has finished
private  boolean m_prefetched
          Flag that a triple has been prefetched
private  com.hp.hpl.jena.graph.Triple m_prefetchedTriple
          Prefetched Triple
private  TripleResultSet m_prefetchedTripleResultSet
          Prefetched TripleResultSet
private  java.util.Iterator tripleResultSetIterator
          Iterator over all TripleResultSets
private  java.util.ArrayList tripleResultSets
          All TripleResultSets for this D2RQResultIterator.
 
Fields inherited from class com.hp.hpl.jena.util.iterator.NiceIterator
 
Constructor Summary
D2RQResultIterator()
          Create an empty iterator.
 
Method Summary
 void addTripleResultSet(TripleResultSet resultSet)
          Adds a triple result set to the list of all result sets.
 com.hp.hpl.jena.util.iterator.ExtendedIterator andThen(com.hp.hpl.jena.util.iterator.ClosableIterator other)
          return a new iterator which delivers all the elements of this iterator and then all the elements of the other iterator.
private  void cantRemove()
           
 void close()
          Clean up the allocated resources - result set and statement.
 void finalize()
          Clean up the database cursor.
 boolean hasNext()
          Test if there is a next result to return
private  void moveForward()
          More forward one triple.
 java.lang.Object next()
          Return the current row
 void remove()
          Delete the current row entry
 java.lang.Object removeNext()
           
 
Methods inherited from class com.hp.hpl.jena.util.iterator.NiceIterator
andThen, close, emptyIterator, ensureHasNext, filterDrop, filterKeep, mapWith, noElements
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.hp.hpl.jena.util.iterator.ExtendedIterator
filterDrop, filterKeep, mapWith
 

Field Detail

tripleResultSets

private java.util.ArrayList tripleResultSets
All TripleResultSets for this D2RQResultIterator. There can be serveral because query results can be stored in several tables (e.g. rdf:type)


tripleResultSetIterator

private java.util.Iterator tripleResultSetIterator
Iterator over all TripleResultSets


m_finished

private boolean m_finished
Flag that the iteration has finished


m_prefetched

private boolean m_prefetched
Flag that a triple has been prefetched


m_prefetchedTriple

private com.hp.hpl.jena.graph.Triple m_prefetchedTriple
Prefetched Triple


m_prefetchedTripleResultSet

private TripleResultSet m_prefetchedTripleResultSet
Prefetched TripleResultSet

Constructor Detail

D2RQResultIterator

public D2RQResultIterator()
Create an empty iterator.

Method Detail

addTripleResultSet

public void addTripleResultSet(TripleResultSet resultSet)
Adds a triple result set to the list of all result sets.


hasNext

public boolean hasNext()
Test if there is a next result to return

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Return the current row

Specified by:
next in interface java.util.Iterator

moveForward

private void moveForward()
More forward one triple. Iterates till there are no more triples in the current triple result set and moves to the next resultset afterwards. Sets the m_finished flag if there is no more to fetch.


remove

public void remove()
Delete the current row entry

Specified by:
remove in interface java.util.Iterator

removeNext

public java.lang.Object removeNext()
Specified by:
removeNext in interface com.hp.hpl.jena.util.iterator.ExtendedIterator

cantRemove

private void cantRemove()

close

public void close()
Clean up the allocated resources - result set and statement. If we know of an SQLCache return the statement there, otherwise close it.

Specified by:
close in interface com.hp.hpl.jena.util.iterator.ClosableIterator

finalize

public void finalize()
Clean up the database cursor. Normally the client should read to the end or explicity close but....


andThen

public com.hp.hpl.jena.util.iterator.ExtendedIterator andThen(com.hp.hpl.jena.util.iterator.ClosableIterator other)
return a new iterator which delivers all the elements of this iterator and then all the elements of the other iterator. Does not copy either iterator; they are consumed as the result iterator is consumed.

Specified by:
andThen in interface com.hp.hpl.jena.util.iterator.ExtendedIterator