Arrayindexoutofboundsexception During Query Execution Using Count() And Brackets (Doc ID 1105033.1)

Last updated on FEBRUARY 08, 2017

Applies to:

Oracle Spatial - Version: 11.1.0.7 to 11.1.0.7 - Release: 11.1 to 11.1
Information in this document applies to any platform.

Symptoms

The following query (and almost any other query combining a "select count" and a node written with brackets) raises an ArrayIndexOutOfBoundsException:

PREFIX someinfo:<http://.......someuri/info#>
SELECT count(?item) ?kind
{
?item someinfo:Kind [someinfo:Value ?kind]
}
GROUP BY ?kind


Here is part of the stack trace:

java.lang.ArrayIndexOutOfBoundsException: 2
at com.hp.hpl.jena.graph.query.Domain.get(Domain.java:48)
at oracle.spatial.rdf.client.jena.OracleLeanQueryIter.moveToNextBinding(OracleLeanQueryIter.java:148)
at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.nextBinding(QueryIteratorBase.java:98)
at com.hp.hpl.jena.sparql.engine.iterator.QueryIterConvert.moveToNextBinding(QueryIterConvert.java:56)
at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.nextBinding(QueryIteratorBase.java:98)
at com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.moveToNextBinding(QueryIterRepeatApply.java:76)
at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.nextBinding(QueryIteratorBase.java:98)
at com.hp.hpl.jena.sparql.engine.iterator.QueryIterGroup.calc(QueryIterGroup.java:50)
at com.hp.hpl.jena.sparql.engine.iterator.QueryIterGroup.<init>(QueryIterGroup.java:32)
at oracle.spatial.rdf.client.jena.OracleOpExecutor.execute(OracleOpExecutor.java:1676)
at oracle.spatial.rdf.client.jena.OracleExecutionDispatch.visit(OracleExecutionDispatch.java:341)
at com.hp.hpl.jena.sparql.algebra.op.OpGroupAgg.visit(OpGroupAgg.java:36)
at oracle.spatial.rdf.client.jena.OracleExecutionDispatch.exec(OracleExecutionDispatch.java:100)
at oracle.spatial.rdf.client.jena.OracleOpExecutor.executeOp(OracleOpExecutor.java:665)
[....]

The same query works perfectly fine with an in-memory Jena model

The following query (only difference : no brackets) works fine:

PREFIX someinfo:<http://.......someuri/info#>
SELECT count(?item) ?kind
{
?item someinfo:Kind ?k .
?k someinfo:Value ?kind
}
GROUP BY ?kind

Here is the code launching the query:

String queryString;
//some code that returns the query string
Query query = QueryFactory.create(queryString, Syntax.syntaxARQ) ;
QueryExecution qexec = QueryExecutionFactory.create(query, rdfModel);
ResultSet results = qexec.execSelect() ;

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms