Class SelectResultSet

java.lang.Object
cz.cvut.kbss.ontodriver.jena.query.AbstractResultSet
cz.cvut.kbss.ontodriver.jena.query.SelectResultSet
All Implemented Interfaces:
ResultSet, AutoCloseable, Iterable<ResultRow>

public class SelectResultSet extends AbstractResultSet
  • Constructor Summary

    Constructors
    Constructor
    Description
    SelectResultSet(org.apache.jena.query.QueryExecution execution, org.apache.jena.query.ResultSet jenaResult)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes this result set releasing any sub-resources it holds.
    int
    findColumn(String variableName)
    Retrieves index of a column with the specified label.
    boolean
    getBoolean(int variableIndex)
    Retrieves value from column at the specified index and returns it as a boolean.
    boolean
    getBoolean(String variableName)
    Retrieves value from column with the specified label and returns it as a boolean.
    byte
    getByte(int variableIndex)
    Retrieves value from column at the specified index and returns it as byte.
    byte
    getByte(String variableName)
    Retrieves value from column with the specified label and returns it as byte.
    int
    Gets the count of available columns.
    double
    getDouble(int variableIndex)
    Retrieves value from column at the specified index and returns it as double.
    double
    getDouble(String variableName)
    Retrieves value from column with the specified label and returns it as double.
    float
    getFloat(int variableIndex)
    Retrieves value from column at the specified index and returns it as float.
    float
    getFloat(String variableName)
    Retrieves value from column with the specified label and returns it as float.
    int
    getInt(int variableIndex)
    Retrieves value from column at the specified index and returns it as int.
    int
    getInt(String variableName)
    Retrieves value from column with the specified label and returns it as int.
    long
    getLong(int variableIndex)
    Retrieves value from column at the specified index and returns it as long.
    long
    getLong(String variableName)
    Retrieves value from column with the specified label and returns it as long.
    getObject(int variableIndex)
    Retrieves value from column at the specified index and returns it as Object.
    <T> T
    getObject(int variableIndex, Class<T> cls)
    Retrieves value from column at the specified index and returns it as an instance of the specified class.
    getObject(String variableName)
    Retrieves value from column with the specified label and returns it as Object.
    <T> T
    getObject(String variableName, Class<T> cls)
    Retrieves value from column with the specified label and returns it as an instance of the specified class.
    short
    getShort(int variableIndex)
    Retrieves value of column at the specified index and returns it as short.
    short
    getShort(String variableName)
    Retrieves value of column with the specified label and returns it as short.
    getString(int variableIndex)
    Retrieves value of column at the specified index and returns it as String.
    getString(String variableName)
    Retrieves value of column with the specified label and returns it as String.
    boolean
    Returns true if the cursor does not point at the last row in this result set.
    boolean
    isBound(int variableIndex)
    Checks whether a value at the specified index is bound in the current result row.
    boolean
    isBound(String variableName)
    Checks whether a value of the specified variable is bound in the current result row.
    void
    Move the cursor one row forward.

    Methods inherited from class cz.cvut.kbss.ontodriver.jena.query.AbstractResultSet

    first, getRowIndex, getStatement, isFirst, isOpen, last, previous, relative, setRowIndex

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach

    Methods inherited from interface cz.cvut.kbss.ontodriver.ResultSet

    iterator, spliterator, stream
  • Constructor Details

    • SelectResultSet

      public SelectResultSet(org.apache.jena.query.QueryExecution execution, org.apache.jena.query.ResultSet jenaResult)
  • Method Details

    • findColumn

      public int findColumn(String variableName)
      Description copied from interface: ResultSet
      Retrieves index of a column with the specified label.
      Parameters:
      variableName - Label of the column
      Returns:
      index of the column or -1 if there is no such column
    • getColumnCount

      public int getColumnCount()
      Description copied from interface: ResultSet
      Gets the count of available columns.

      This number corresponds to the number of result variables bound in the query.

      Returns:
      Number of columns in the result set
    • isBound

      public boolean isBound(int variableIndex)
      Description copied from interface: ResultSet
      Checks whether a value at the specified index is bound in the current result row.

      Note that this method will return false also in case the index is out of range of the variables known to the result set as a whole.

      Parameters:
      variableIndex - Index of the variable
      Returns:
      true when value is bound in the current row, false otherwise
    • isBound

      public boolean isBound(String variableName)
      Description copied from interface: ResultSet
      Checks whether a value of the specified variable is bound in the current result row.

      Note that this method will return false also in case the variable is not known to the result set at all.

      Parameters:
      variableName - Variable name
      Returns:
      true when value is bound in the current row, false otherwise
    • getBoolean

      public boolean getBoolean(int variableIndex) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column at the specified index and returns it as a boolean.
      Parameters:
      variableIndex - Column index, the first column has index 0
      Returns:
      boolean value
      Throws:
      JenaDriverException
    • getBoolean

      public boolean getBoolean(String variableName) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column with the specified label and returns it as a boolean.
      Parameters:
      variableName - Label of the column
      Returns:
      boolean value
      Throws:
      JenaDriverException
    • getByte

      public byte getByte(int variableIndex) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column at the specified index and returns it as byte.
      Parameters:
      variableIndex - Column index, the first column has index 0
      Returns:
      byte value
      Throws:
      JenaDriverException
    • getByte

      public byte getByte(String variableName) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column with the specified label and returns it as byte.
      Parameters:
      variableName - Label of the column
      Returns:
      byte value
      Throws:
      JenaDriverException
    • getDouble

      public double getDouble(int variableIndex) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column at the specified index and returns it as double.
      Parameters:
      variableIndex - Column index, the first column has index 0
      Returns:
      double value
      Throws:
      JenaDriverException
    • getDouble

      public double getDouble(String variableName) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column with the specified label and returns it as double.
      Parameters:
      variableName - Label of the column
      Returns:
      double value
      Throws:
      JenaDriverException
    • getFloat

      public float getFloat(int variableIndex) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column at the specified index and returns it as float.
      Parameters:
      variableIndex - Column index, the first column has index 0
      Returns:
      float value
      Throws:
      JenaDriverException
    • getFloat

      public float getFloat(String variableName) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column with the specified label and returns it as float.
      Parameters:
      variableName - Label of the column
      Returns:
      float value
      Throws:
      JenaDriverException
    • getInt

      public int getInt(int variableIndex) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column at the specified index and returns it as int.
      Parameters:
      variableIndex - Column index, the first column has index 0
      Returns:
      int value
      Throws:
      JenaDriverException
    • getInt

      public int getInt(String variableName) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column with the specified label and returns it as int.
      Parameters:
      variableName - Label of the column
      Returns:
      int value
      Throws:
      JenaDriverException
    • getLong

      public long getLong(int variableIndex) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column at the specified index and returns it as long.
      Parameters:
      variableIndex - Column index, the first column has index 0
      Returns:
      long value
      Throws:
      JenaDriverException
    • getLong

      public long getLong(String variableName) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column with the specified label and returns it as long.
      Parameters:
      variableName - Label of the column
      Returns:
      long value
      Throws:
      JenaDriverException
    • getObject

      public Object getObject(int variableIndex)
      Description copied from interface: ResultSet
      Retrieves value from column at the specified index and returns it as Object.
      Parameters:
      variableIndex - Column index, the first column has index 0
      Returns:
      column value cast to Object
    • getObject

      public Object getObject(String variableName)
      Description copied from interface: ResultSet
      Retrieves value from column with the specified label and returns it as Object.
      Parameters:
      variableName - Label of the column
      Returns:
      column value cast to Object
    • getObject

      public <T> T getObject(int variableIndex, Class<T> cls) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column at the specified index and returns it as an instance of the specified class.

      The mechanism of transforming the value to the specified class is not specified, it can be merely type casting or calling a constructor of the specified type.

      Type Parameters:
      T - Return type
      Parameters:
      variableIndex - Column index, the first column has index 0
      cls - Requested class type
      Returns:
      Value of the column
      Throws:
      JenaDriverException
    • getObject

      public <T> T getObject(String variableName, Class<T> cls) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value from column with the specified label and returns it as an instance of the specified class.

      The mechanism of transforming the value to the specified class is not specified, it can be merely type casting or calling a constructor of the specified type.

      Type Parameters:
      T - Return type
      Parameters:
      variableName - Label of the column
      cls - Requested class type
      Returns:
      Value of the column.
      Throws:
      JenaDriverException
    • getShort

      public short getShort(int variableIndex) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value of column at the specified index and returns it as short.
      Parameters:
      variableIndex - Column index, the first column has index 0
      Returns:
      short value
      Throws:
      JenaDriverException
    • getShort

      public short getShort(String variableName) throws JenaDriverException
      Description copied from interface: ResultSet
      Retrieves value of column with the specified label and returns it as short.
      Parameters:
      variableName - Label of the column
      Returns:
      short value
      Throws:
      JenaDriverException
    • getString

      public String getString(int variableIndex)
      Description copied from interface: ResultSet
      Retrieves value of column at the specified index and returns it as String.
      Parameters:
      variableIndex - Column index, the first column has index 0
      Returns:
      String value
    • getString

      public String getString(String variableName)
      Description copied from interface: ResultSet
      Retrieves value of column with the specified label and returns it as String.
      Parameters:
      variableName - Label of the column
      Returns:
      String value
    • hasNext

      public boolean hasNext()
      Description copied from interface: ResultSet
      Returns true if the cursor does not point at the last row in this result set.
      Specified by:
      hasNext in interface ResultSet
      Overrides:
      hasNext in class AbstractResultSet
      Returns:
      True if there is at least one next row
    • next

      public void next()
      Description copied from interface: ResultSet
      Move the cursor one row forward.
      Specified by:
      next in interface ResultSet
      Overrides:
      next in class AbstractResultSet
    • close

      public void close() throws JenaDriverException
      Description copied from interface: ResultSet
      Closes this result set releasing any sub-resources it holds.

      After closing the result set is not usable any more and calling methods on it (except close and isOpen) will result in OntoDriverException.

      Calling close on already closed resource does nothing.

      Calling this method also results in immediate disconnection of all registered observers and cancellation of any running reasoning associated with this result set.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface ResultSet
      Overrides:
      close in class AbstractResultSet
      Throws:
      JenaDriverException