All Implemented Interfaces:
IteratorFunction

public class ITER_SQL extends IteratorStreamFunctionBase2
Iterator function SQL issues a SQL query to a database.
  • Param 1: (database): the JDBC URL of the database, with its user and password if it needs them, such as <jdbc:mysql://localhost/db?user=me&password=secret>, <jdbc:postgresql://localhost/db?user=me&password=secret> or <jdbc:sqlite:data.db>. Any JDBC driver of the classpath is used; the MySQL driver is included.
  • Param 2: (sql) the SQL query;
The rows of the result are one batch. The following variables may be bound:
  • Output 1 .. N: value of the ith column, encoded as a boolean, float, double, integer, string, dateTimeStamp, as it best fits.
Author:
Omar Qawasmeh, Maxime Lefrançois
  • Field Details

  • Constructor Details

    • ITER_SQL

      public ITER_SQL()
  • Method Details

    • getProperties

      public static Properties getProperties(String url)
      The connection properties: none, the user and password are those of the JDBC URL; a MySQL connection is in UTC.
    • exec

      public void exec(org.apache.jena.sparql.expr.NodeValue nodeSQL, org.apache.jena.sparql.expr.NodeValue querySQL, Consumer<List<List<org.apache.jena.sparql.expr.NodeValue>>> consumer)
      Description copied from class: IteratorStreamFunctionBase2
      Specified by:
      exec in class IteratorStreamFunctionBase2
    • getConnection

      public Connection getConnection(org.apache.jena.sparql.expr.NodeValue sql) throws Exception
      Throws:
      Exception
    • getListSQL

      public void getListSQL(Connection conn, org.apache.jena.sparql.expr.NodeValue querySQL, Consumer<List<List<org.apache.jena.sparql.expr.NodeValue>>> consumer)
    • checkBuild

      public void checkBuild(org.apache.jena.sparql.expr.ExprList args)
      Description copied from class: IteratorStreamFunctionBase2
      Partially checks if the iterator function can be executed with the given arguments.
      Overrides:
      checkBuild in class IteratorStreamFunctionBase2
      Parameters:
      args - -