org.trippi
Class TupleIterator

java.lang.Object
  extended by org.trippi.TupleIterator
Direct Known Subclasses:
DistinctTupleIterator, JenaTupleIterator, KowariTupleIterator, LimitedTupleIterator, PoolAwareTupleIterator, SesameTupleIterator, SparqlTupleIterator, SynchronizedTupleIterator

public abstract class TupleIterator
extends java.lang.Object

An iterator over a series of tuples. Each tuple is a Map of JRDF Node objects keyed by query binding variable names.

Author:
cwilper@cs.cornell.edu

Field Summary
static RDFFormat[] INPUT_FORMATS
          Formats supported for reading.
static RDFFormat[] OUTPUT_FORMATS
          Formats supported for writing.
 
Constructor Summary
TupleIterator()
           
 
Method Summary
abstract  void close()
          Release resources held by this TupleIterator.
 int count()
          Get the number of tuples in the iterator, then close it.
 void finalize()
          Ensure close() gets called at garbage collection time.
static TupleIterator fromStream(java.io.InputStream in, RDFFormat format)
          Get an iterator over the tuples in the given stream.
abstract  boolean hasNext()
          Return true if there are more results.
static void main(java.lang.String[] args)
           
abstract  java.lang.String[] names()
          Get the names of the binding variables.
abstract  java.util.Map next()
          Return the next result.
 java.util.List nextTriples(TriplePattern[] patterns)
          Return the next result as a List of Triple objects.
 void setAliasMap(java.util.Map aliases)
           
 int toStream(java.io.OutputStream out, RDFFormat format)
          Serialize to the given stream.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INPUT_FORMATS

public static final RDFFormat[] INPUT_FORMATS
Formats supported for reading.

See Also:
fromStream(InputStream, RDFFormat)

OUTPUT_FORMATS

public static final RDFFormat[] OUTPUT_FORMATS
Formats supported for writing.

See Also:
toStream(OutputStream, RDFFormat)
Constructor Detail

TupleIterator

public TupleIterator()
Method Detail

hasNext

public abstract boolean hasNext()
                         throws TrippiException
Return true if there are more results.

Throws:
TrippiException

next

public abstract java.util.Map next()
                            throws TrippiException
Return the next result.

Throws:
TrippiException

names

public abstract java.lang.String[] names()
                                  throws TrippiException
Get the names of the binding variables. These will be the keys in the map for result.

Throws:
TrippiException

close

public abstract void close()
                    throws TrippiException
Release resources held by this TupleIterator.

Throws:
TrippiException

nextTriples

public java.util.List nextTriples(TriplePattern[] patterns)
                           throws TrippiException
Return the next result as a List of Triple objects.

Throws:
TrippiException

finalize

public void finalize()
              throws TrippiException
Ensure close() gets called at garbage collection time.

Overrides:
finalize in class java.lang.Object
Throws:
TrippiException

setAliasMap

public void setAliasMap(java.util.Map aliases)

count

public int count()
          throws TrippiException
Get the number of tuples in the iterator, then close it.

Throws:
TrippiException

toStream

public int toStream(java.io.OutputStream out,
                    RDFFormat format)
             throws TrippiException
Serialize to the given stream. After successfully writing, the TupleIterator will be closed, but not the outputstream.

Throws:
TrippiException

fromStream

public static TupleIterator fromStream(java.io.InputStream in,
                                       RDFFormat format)
                                throws java.io.IOException,
                                       TrippiException
Get an iterator over the tuples in the given stream.

Throws:
java.io.IOException
TrippiException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception