Robert Mercer created JENA-940:
----------------------------------
Summary: SPARQL SERVICE Query against dbpedia.org doesnt work
Key: JENA-940
URL: https://issues.apache.org/jira/browse/JENA-940
Project: Apache Jena
Issue Type: Bug
Affects Versions: Jena 2.13.0, Jena 2.11.0
Reporter: Robert Mercer
I've specified Affects versions against the version of Jena that I've tested,
although it looks like it affects all versions of Jena.
Basically it boils down to this, if you specify dbpedia.org in a SERVICE query
now you receive an error message with the following stack trace:
com.hp.hpl.jena.sparql.resultset.ResultSetException: Failed when initializing
the StAX parsing engine
at com.hp.hpl.jena.sparql.resultset.XMLInputStAX.<init>(XMLInputStAX.java:118)
at com.hp.hpl.jena.sparql.resultset.XMLInput.make(XMLInput.java:73)
at com.hp.hpl.jena.sparql.resultset.XMLInput.fromXML(XMLInput.java:42)
at com.hp.hpl.jena.sparql.resultset.XMLInput.fromXML(XMLInput.java:37)
at com.hp.hpl.jena.query.ResultSetFactory.fromXML(ResultSetFactory.java:321)
at com.hp.hpl.jena.sparql.engine.http.Service.exec(Service.java:117)
at
com.hp.hpl.jena.sparql.engine.main.iterator.QueryIterService.nextStage(QueryIterService.java:51)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:113)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:65)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterConvert.hasNextBinding(QueryIterConvert.java:59)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108)
at
com.hp.hpl.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:72)
at
org.topbraidcomposer.sparql.view.SPARQLView$8.handleResultSet(SPARQLView.java:371)
at
org.topbraidcomposer.sparql.view.SPARQLView$10.runSelectOrDescribe(SPARQLView.java:470)
at org.topbraidcomposer.sparql.view.SPARQLView$10.run(SPARQLView.java:439)
at org.topbraidcomposer.core.util.ThreadUtil$1$1.run(ThreadUtil.java:64)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at
com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl.next(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown
Source)
at
com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.processHead(XMLInputStAX.java:387)
at
com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.init(XMLInputStAX.java:197)
at
com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.<init>(XMLInputStAX.java:189)
at com.hp.hpl.jena.sparql.resultset.XMLInputStAX.worker(XMLInputStAX.java:148)
at com.hp.hpl.jena.sparql.resultset.XMLInputStAX.<init>(XMLInputStAX.java:111)
... 21 more
This is because dbpedia.org recently upgraded to XML 1.1 from 1.0 and
apparently the XercesImpl that is packaged with Jena doesnt support this, which
is the core issue.
Case 1. Here's a query using SERVICE against the normal DBpedia endpoint. It
fails with the StAX exception. (empty.ttl is an empty file.)
sparql --data empty.ttl "SELECT * { SERVICE <http://dbpedia.org/sparql> { ?s ?p
?o } } LIMIT 1"
Case 2. Here's a remote SPARQL query against the normal endpoint (so Jena
doesn't evaluate the query at all, but sends the complete query to the
endpoint, and only parses the results). It succeeds.
rsparql --service=http://dbpedia.org/sparql "SELECT * { ?s ?p ?o } LIMIT 1"
So it looks like Jena is doing something differently between cases 1 and 2 in
the way it sends the query or handles the results.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)