Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

nl.aidministrator.rdf.ral.rdbms
Class SQLValueIterator  view SQLValueIterator download SQLValueIterator.java

java.lang.Object
  extended bynl.aidministrator.rdf.ral.rdbms.SQLValueIterator
All Implemented Interfaces:
nl.aidministrator.rdf.ral.ResourceIterator
Direct Known Subclasses:
SQLLiteralIterator, SQLResourceIterator

public abstract class SQLValueIterator
extends java.lang.Object
implements nl.aidministrator.rdf.ral.ResourceIterator

A ResourceIterator that executes an SQL query. SQLValueIterator is an abstract class, no instances of SQLValueIterator can be created. A subclass of SQLValueIterator is defined that either iterates rdfs:Resources or rdfs:Literals. This subclass must implement getResult(), the implementation of getResult() must call the proper contructor of either rdfs:Resource or rdfs:Literal.

Version:
1.3, 12/13/01

Field Summary
protected  java.sql.Connection _databaseCon
          Connection to the database.
protected  boolean _hasNext
          Flag indicating whether there are any more results.
protected  java.lang.String _query
          Query to execute.
protected  java.sql.ResultSet _resultSet
          ResultSet for the query.
protected  java.sql.Statement _statement
          SQL Statement that was used to generate the ResultSet.
 
Constructor Summary
SQLValueIterator(java.sql.Connection databaseCon, java.lang.String query)
          Constructor.
 
Method Summary
private  void _execQuery()
           
 void close()
          Closes all connections to the repository.
protected  void finalize()
          Called by the garbage collector on SQLValueIterator when garbage collection determines that there are no more references to the SQLValueIterator.
protected abstract  nl.aidministrator.rdf.sail.model.Value getResult()
          Gets the result from the ResultSet.
 boolean hasNext()
          Checks whether there are any more results available.
 nl.aidministrator.rdf.sail.model.Value next()
          Gets the next result.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_resultSet

protected java.sql.ResultSet _resultSet
ResultSet for the query.


_statement

protected java.sql.Statement _statement
SQL Statement that was used to generate the ResultSet. It cannot be closed until all results have been read from the ResultSet.


_databaseCon

protected java.sql.Connection _databaseCon
Connection to the database.


_query

protected java.lang.String _query
Query to execute.


_hasNext

protected boolean _hasNext
Flag indicating whether there are any more results.

Constructor Detail

SQLValueIterator

public SQLValueIterator(java.sql.Connection databaseCon,
                        java.lang.String query)
Constructor.

Method Detail

_execQuery

private void _execQuery()

hasNext

public boolean hasNext()
Description copied from interface: nl.aidministrator.rdf.ral.ResourceIterator
Checks whether there are any more results available.

Specified by:
hasNext in interface nl.aidministrator.rdf.ral.ResourceIterator

next

public nl.aidministrator.rdf.sail.model.Value next()
Description copied from interface: nl.aidministrator.rdf.ral.ResourceIterator
Gets the next result.

Specified by:
next in interface nl.aidministrator.rdf.ral.ResourceIterator

close

public void close()
Description copied from interface: nl.aidministrator.rdf.ral.ResourceIterator
Closes all connections to the repository.

Specified by:
close in interface nl.aidministrator.rdf.ral.ResourceIterator

finalize

protected void finalize()
Called by the garbage collector on SQLValueIterator when garbage collection determines that there are no more references to the SQLValueIterator.


getResult

protected abstract nl.aidministrator.rdf.sail.model.Value getResult()
                                                             throws java.sql.SQLException
Gets the result from the ResultSet. Must be implemented by SQLResourceIterator or SQLLiteralIterator in order to call the proper constructor of either Resource or Literal.