1 Reply Latest reply: Jul 23, 2012 11:26 PM by alwu-Oracle RSS

    NullPointerException while executing SPARQL through Jena

    950528
      Hi,

      I was trying to execute a SPARQL through Jena API. I am getting the following exception when invoking the "ResultSetFormatter.out(System.out, results);" method. Any idea why this happens ? Appreciate any help on this.


      I connect to Oracle using the following Jena code
      ============================================
      Oracle oracle = new Oracle(szJdbcURL, szUser, szPasswd);
      Model model = ModelOracleSem.createOracleSemModel(
      oracle, szModelName);
      ==============================================

      This is the exception I am getting.

      java.lang.NullPointerException
           at oracle.spatial.rdf.client.jena.OracleRepeatApply.nextStage(OracleRepeatApply.java:794)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:101)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:53)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:86)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIterProcessBinding.hasNextBinding(QueryIterProcessBinding.java:49)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:86)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIterConvert.hasNextBinding(QueryIterConvert.java:54)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:86)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIterConvert.hasNextBinding(QueryIterConvert.java:54)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:86)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIterDistinctReduced.hasNextBinding(QueryIterDistinctReduced.java:42)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:86)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:30)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:86)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:30)
           at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:86)
           at com.hp.hpl.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:57)
           at com.hp.hpl.jena.sparql.resultset.ResultSetMem.<init>(ResultSetMem.java:82)
           at com.hp.hpl.jena.sparql.resultset.TextOutput.write(TextOutput.java:133)
           at com.hp.hpl.jena.sparql.resultset.TextOutput.write(TextOutput.java:116)
           at com.hp.hpl.jena.sparql.resultset.TextOutput.write(TextOutput.java:104)
           at com.hp.hpl.jena.sparql.resultset.TextOutput.format(TextOutput.java:51)
           at com.hp.hpl.jena.query.ResultSetFormatter.out(ResultSetFormatter.java:96)
           at com.hp.hpl.jena.query.ResultSetFormatter.out(ResultSetFormatter.java:48)

      Thanks
      Mahesh