Arrayindexoutofboundsexception During Query Execution Using Count() And Brackets

(Doc ID 1105033.1)

Last updated on FEBRUARY 08, 2017

Applies to:

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


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(
at oracle.spatial.rdf.client.jena.OracleLeanQueryIter.moveToNextBinding(
at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.nextBinding(
at com.hp.hpl.jena.sparql.engine.iterator.QueryIterConvert.moveToNextBinding(
at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.nextBinding(
at com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.moveToNextBinding(
at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.nextBinding(
at com.hp.hpl.jena.sparql.engine.iterator.QueryIterGroup.calc(
at com.hp.hpl.jena.sparql.engine.iterator.QueryIterGroup.<init>(
at oracle.spatial.rdf.client.jena.OracleOpExecutor.execute(
at oracle.spatial.rdf.client.jena.OracleExecutionDispatch.visit(
at com.hp.hpl.jena.sparql.algebra.op.OpGroupAgg.visit(
at oracle.spatial.rdf.client.jena.OracleExecutionDispatch.exec(
at oracle.spatial.rdf.client.jena.OracleOpExecutor.executeOp(

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() ;


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