2 Replies Latest reply on Nov 18, 2009 7:01 PM by 715399

    Invalid column index from SPARQL

    687900
      I'm using the Jena Adaptor 2.0, with 11g R1, Jena 2.5.6, OJDBC6, to make a SPARQL query, and I'm getting a SQLException:

      java.sql.SQLException: Invalid column index
      at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
      at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)
      at oracle.jdbc.driver.ORacleResultSetImpl.getString(OracleResultSetImpl.java:957)
      ...
      at oracle.spatial.rdf.client.jena.ORacleSemIterator.getNodesFromResultSet(OracleSemIterator.java:410)
      at oracle.spatial.rdf.client.jena.ORacleSemIterator.next(OracleSemIterator.java:315)
      at com.hp.hpl.jena.sparql.engine.iterator.QueryIterBlockTriplesQH$StagePattern.moveToNextBinding(QueryIterBlockTriplesQH.java:104)
      ...

      My SPARQL has this pattern (using p, p1, and p2 as shorthand for property URIs):

      SELECT DISTINCT ?s
      WHERE {
      ?s p t1 .
      { { ?s p1 ?t }
      UNION
      { ?s p2 ?t .
      OPTIONAL { ?s p1 ?t2 } .
      FILTER(!bound(?t2)) }
      }
      }
      ORDER BY DESC(?t)

      The intent of this query is to get the ?s that match the first pattern, (?s p t1), then sort the results by the p1 value, and use the p2 value as the sort value for those that do not have a p1 value.

      Any ideas why the Jena adapter throws this error?

      Brian