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

Quick Search    Search Deep

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

java.lang.Object
  extended bynl.aidministrator.rdf.ral.rdbms.RecursiveSQLResourceIterator
All Implemented Interfaces:
nl.aidministrator.rdf.ral.ResourceIterator

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

A ResourceIterator that executes SQL queries recursively by re-inserting part of the query's results into the query. The query should contain EXACTLY ONE IN-parameter (i.e. there is one '?' in the query) and the ResultSet should contain the following columns: id (int), namespace (String) and localname (String). The first value (the id) will be re-inserted into the query.

Version:
1.4, 01/02/02

Field Summary
protected  java.sql.Connection _databaseCon
          Connection to the database.
protected  java.util.Set _iterated
          Stores Resources that have already been iterated.
protected  java.util.Vector _resultsQueue
          Queue containing the results.
protected  java.sql.PreparedStatement _statement
          The query in the form of a PreparedStatement.
 
Constructor Summary
RecursiveSQLResourceIterator(java.sql.Connection databaseCon, java.lang.String query, IdResource initialResource)
          Constructor.
 
Method Summary
private  void _add(nl.aidministrator.rdf.sail.model.Resource resource)
           
private  void _fillQueue(int value)
           
 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.
 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

_databaseCon

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


_statement

protected java.sql.PreparedStatement _statement
The query in the form of a PreparedStatement.


_resultsQueue

protected java.util.Vector _resultsQueue
Queue containing the results.


_iterated

protected java.util.Set _iterated
Stores Resources that have already been iterated. This prevents looping of the iterator and therefore supports multiple inheritance and loops in the class or property hierarchy.

Constructor Detail

RecursiveSQLResourceIterator

public RecursiveSQLResourceIterator(java.sql.Connection databaseCon,
                                    java.lang.String query,
                                    IdResource initialResource)
                             throws java.sql.SQLException
Constructor.

Method Detail

_add

private void _add(nl.aidministrator.rdf.sail.model.Resource resource)

_fillQueue

private void _fillQueue(int value)

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()
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.