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

Quick Search    Search Deep

nl.aidministrator.rdf.sail.sql92.iterators
Class SQL92StatementIterator  view SQL92StatementIterator download SQL92StatementIterator.java

java.lang.Object
  extended bynl.aidministrator.rdf.sail.sql92.iterators.SQL92StatementIterator
All Implemented Interfaces:
nl.aidministrator.rdf.sail.StatementIterator

public class SQL92StatementIterator
extends java.lang.Object
implements nl.aidministrator.rdf.sail.StatementIterator

A StatementIterator that executes an SQL query. The ResultSet should contain 6 columns: namespace(String) and localname(String) of subject, namespace(String) and localname(String) of predicate and namespace(String), localname(String) if object is instance of rdfs:Resource or language(String) and value(String) if object is instance of rdfs:Literal. With getObject() a StatementIterator returns the object of the statement it is pointing at. An object can be of type rdfs:Resource or rdfs:Literal, therefore it should know whether to construct a Resource or a Literal out of the ResultSet. A way to establish this is to execute 2 queries, one where object of table triples is joined with id of table resources and one where it is joined with id of table literals. Boolean _literalsHasBeenQueried identifies which query is executed, so whether to construct a Resource or a Literal out of the ResultSet.

Version:
1.1, 01/17/02

Field Summary
protected  java.sql.Connection _databaseCon
          Connection to the database.
protected  boolean _hasNext
          Flag indicating whether there are any more results.
protected  boolean _literalsHasBeenQueried
          Indicates which query is executed.
protected  nl.aidministrator.rdf.sail.model.Value _nextObject
          Object of statement iterator is currently pointing at.
protected  nl.aidministrator.rdf.sail.model.Resource _nextPredicate
          Predicate of statement iterator is currently pointing at.
protected  nl.aidministrator.rdf.sail.model.Resource _nextSubject
          Subject of statement iterator is currently pointing at.
protected  boolean _objectFixed
          Is object fixed.
protected  boolean _predicateFixed
          Is predicate fixed.
protected  java.lang.String _queryLiterals
          The query to execute.
protected  java.lang.String _queryResources
          The 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.
protected  boolean _subjectFixed
          Is subject fixed.
 
Constructor Summary
SQL92StatementIterator(java.sql.Connection databaseCon, java.lang.String queryResources, java.lang.String queryLiterals, nl.aidministrator.rdf.sail.model.Resource subject, nl.aidministrator.rdf.sail.model.Resource predicate, nl.aidministrator.rdf.sail.model.Value object)
          Constructor.
 
Method Summary
private  void _execQuery(java.lang.String query)
           
private  void _proceed()
           
 void close()
          Closes the iterator and frees any resources that it uses (e.g.
protected  void finalize()
          Called by the garbage collector on SQL92ValueIterator when garbage collection determines that there are no more references to the SQL92ValueIterator.
 nl.aidministrator.rdf.sail.model.Value getObject()
          Gets the object of the current statement.
 nl.aidministrator.rdf.sail.model.Resource getPredicate()
          Gets the predicate of the current statement.
 nl.aidministrator.rdf.sail.model.Resource getSubject()
          Gets the subject of the current statement.
 boolean hasNext()
          Checks whether there are any more statements available.
 void next()
          Go to the next statement.
 
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.


_queryResources

protected java.lang.String _queryResources
The query to execute.


_queryLiterals

protected java.lang.String _queryLiterals
The query to execute.


_hasNext

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


_nextSubject

protected nl.aidministrator.rdf.sail.model.Resource _nextSubject
Subject of statement iterator is currently pointing at.


_nextPredicate

protected nl.aidministrator.rdf.sail.model.Resource _nextPredicate
Predicate of statement iterator is currently pointing at.


_nextObject

protected nl.aidministrator.rdf.sail.model.Value _nextObject
Object of statement iterator is currently pointing at.


_subjectFixed

protected boolean _subjectFixed
Is subject fixed.


_predicateFixed

protected boolean _predicateFixed
Is predicate fixed.


_objectFixed

protected boolean _objectFixed
Is object fixed.


_literalsHasBeenQueried

protected boolean _literalsHasBeenQueried
Indicates which query is executed.

Constructor Detail

SQL92StatementIterator

public SQL92StatementIterator(java.sql.Connection databaseCon,
                              java.lang.String queryResources,
                              java.lang.String queryLiterals,
                              nl.aidministrator.rdf.sail.model.Resource subject,
                              nl.aidministrator.rdf.sail.model.Resource predicate,
                              nl.aidministrator.rdf.sail.model.Value object)
Constructor.

Method Detail

_proceed

private void _proceed()

_execQuery

private void _execQuery(java.lang.String query)

hasNext

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

Specified by:
hasNext in interface nl.aidministrator.rdf.sail.StatementIterator

next

public void next()
Description copied from interface: nl.aidministrator.rdf.sail.StatementIterator
Go to the next statement.

Specified by:
next in interface nl.aidministrator.rdf.sail.StatementIterator

getSubject

public nl.aidministrator.rdf.sail.model.Resource getSubject()
Description copied from interface: nl.aidministrator.rdf.sail.StatementIterator
Gets the subject of the current statement.

Specified by:
getSubject in interface nl.aidministrator.rdf.sail.StatementIterator

getPredicate

public nl.aidministrator.rdf.sail.model.Resource getPredicate()
Description copied from interface: nl.aidministrator.rdf.sail.StatementIterator
Gets the predicate of the current statement.

Specified by:
getPredicate in interface nl.aidministrator.rdf.sail.StatementIterator

getObject

public nl.aidministrator.rdf.sail.model.Value getObject()
Description copied from interface: nl.aidministrator.rdf.sail.StatementIterator
Gets the object of the current statement.

Specified by:
getObject in interface nl.aidministrator.rdf.sail.StatementIterator

close

public void close()
Description copied from interface: nl.aidministrator.rdf.sail.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 nl.aidministrator.rdf.sail.StatementIterator

finalize

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