org.openrdf.sesame.sailimpl.rdbms.iterators
Class RdbmsStatementIterator

java.lang.Object
  extended byorg.openrdf.sesame.sailimpl.rdbms.iterators.RdbmsStatementIterator
All Implemented Interfaces:
StatementIterator

public class RdbmsStatementIterator
extends Object
implements StatementIterator

A StatementIterator that executes an SQL query. The ResultSet should contain 3 columns for each resource or literal that is not fixed. For a resource this is: id, namespace and localname. For a literal this is: id, language and value. The total number of columns expected depends on the number of values/positions that have been specified by the caller. E.g. if the caller asks for all statements with a specific subject, the subject is 'fixed', and doesn't have to be queried from the database. In this case, the query is expected to have six columns: three for the predicate and three for the object.

Author:
Peter van 't Hof, Arjohn Kampman

Constructor Summary
RdbmsStatementIterator(RdfSource source, String[] namespaceNames, Connection databaseCon, String queryResources, String queryLiterals, Resource subject, URI predicate, Value object)
          Constructor.
 
Method Summary
 void close()
          Closes the iterator and frees any resources that it uses (e.g.
 boolean hasNext()
          Checks whether there are any more statements available.
 Statement next()
          Gets the next statement.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RdbmsStatementIterator

public RdbmsStatementIterator(RdfSource source,
                              String[] namespaceNames,
                              Connection databaseCon,
                              String queryResources,
                              String queryLiterals,
                              Resource subject,
                              URI predicate,
                              Value object)
Constructor.

Parameters:
source - the object to supply as 'creator' to created IdValues.
namespaceNames - an array of namespace names that are index using their IDs.
databaseCon - connection to the repository
queryResources - query specified for the resources table, or null if statements with resources as object do not need to be queried.
queryLiterals - query specified for the literals table, or null if statements with literals as object do not need to be queried.
subject - A (fixed) subject, or null if the subject should be queried from the database.
predicate - A (fixed) predicate, or null if the predicate should be queried from the database.
object - A (fixed) object, or null if the object should be queried from the database.
Method Detail

hasNext

public boolean hasNext()
Description copied from interface: StatementIterator
Checks whether there are any more statements available.

Specified by:
hasNext in interface StatementIterator
Returns:
true if there are more statements available, false otherwise.

next

public Statement next()
Description copied from interface: StatementIterator
Gets the next statement.

Specified by:
next in interface StatementIterator
Returns:
the next statement.

close

public void close()
Description copied from interface: StatementIterator
Closes the iterator and frees any resources that it uses (e.g. connections to databases). Every StatementIterator should be properly closed when it has returned all of its statements, or when it is no longer needed.

Specified by:
close in interface StatementIterator


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.