jena-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Seaborne <andy.seabo...@epimorphics.com>
Subject Re: Unexpected end of input errors on reading from dbpedia
Date Tue, 08 Feb 2011 13:37:26 GMT
Simon,

Thanks for a complete, minimal example.  I get the same error.

I suspect it's not woodstox per se, but a lower level networking issue 
because I can get things to work by reading the data as fast as 
possible.  Maybe woodstow's use of the inputstream is seeing the 
connection close flag without making sure there isn't more data to read.

The code in ARQ SVN has a workaround for this - it slurps up the network 
bytes as fast as possible, then passes them to woodstox; woodstox is not 
then working over the network input stream but instead a 
ByteArrayInputStream.

(An alternative, I tried was adding a buffering layer to the input 
stream but that didn't work).

	Andy

On 07/02/11 23:09, Simon Wibberley wrote:
> Hi there,
>
> I'm trying to query dbpedia for a list of company names. I'm
> inconsistently getting WstxEOFException's caught by jena, which then
> raises a ResultSetException. This happens after some data has been read
> successfully. Following the tcp stream in wireshark shows a complete
> response from the dbpedia server.
>
> Is this a bug in woodstox? I've tried replacing the libs with wstx4 and
> stax2, but same error occurred. Is there anything I'm doing wrong/badly
> with jena/sparql? (I'm relatively new to this). The minimal test case
> below seems to reproduce the error (output also below) reliably. I've
> tried this on both windows7 and OS X 10.6 from different locations.
> Could you check to see if you get the same error?
>
> Any ideas?
>
> Many thanks,
>
> Simon Wibberley
>
> import com.hp.hpl.jena.query.Query;
> import com.hp.hpl.jena.query.QueryExecution;
> import com.hp.hpl.jena.query.QueryExecutionFactory;
> import com.hp.hpl.jena.query.QueryFactory;
> import com.hp.hpl.jena.query.QuerySolution;
> import com.hp.hpl.jena.query.ResultSet;
> import com.hp.hpl.jena.rdf.model.RDFNode;
>
> public class TestJena {
> public static void main(String[] args) {
>
> String queryString = "PREFIX rdf:
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#>"
> + "PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>"
> + "SELECT ?var "
> + "WHERE { ?var rdf:type dbpedia-owl:Company . }";
>
> Query query = QueryFactory.create(queryString);
>
> QueryExecution qexec = QueryExecutionFactory.sparqlService(
> "http://dbpedia.org/sparql", query);
> ResultSet rs = null;
>
> rs = qexec.execSelect();
> qexec.close();
>
> while(rs.hasNext()) {
> QuerySolution sqs = rs.next();
> RDFNode node = sqs.get("var");
> System.out.println(node);
> }
> }
>
>
> }
>
> com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting a close
> tag for element <uri>
> at [row,col {unknown-source}]: [106,47]
> at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:686)
> at
> com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2730)
> at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019)
> at
> com.ctc.wstx.sr.BasicStreamReader.getElementText(BasicStreamReader.java:669)
>
> at
> com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.getOneSolution(XMLInputStAX.java:480)
>
> at
> com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.hasNext(XMLInputStAX.java:216)
>
> at sw206.TestJena.main(TestJena.java:31)
> Exception in thread "main"
> com.hp.hpl.jena.sparql.resultset.ResultSetException: XMLStreamException:
> Unexpected EOF; was expecting a close tag for element <uri>
> at [row,col {unknown-source}]: [106,47]
> at
> com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.staxError(XMLInputStAX.java:510)
>
> at
> com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.hasNext(XMLInputStAX.java:220)
>
> at sw206.TestJena.main(TestJena.java:31)
> Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was
> expecting a close tag for element <uri>
> at [row,col {unknown-source}]: [106,47]
> at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:686)
> at
> com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2730)
> at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019)
> at
> com.ctc.wstx.sr.BasicStreamReader.getElementText(BasicStreamReader.java:669)
>
> at
> com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.getOneSolution(XMLInputStAX.java:480)
>
> at
> com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.hasNext(XMLInputStAX.java:216)
>
> ... 1 more
> 22:59:25,250 WARN XMLInputStAX$ResultSetStAX:73 - StAX error:
> XMLStreamException: Unexpected EOF; was expecting a close tag for
> element <uri>
> at [row,col {unknown-source}]: [106,47]
> com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting a close
> tag for element <uri>
> at [row,col {unknown-source}]: [106,47]
> at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:686)
> at
> com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2730)
> at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019)
> at
> com.ctc.wstx.sr.BasicStreamReader.getElementText(BasicStreamReader.java:669)
>
> at
> com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.getOneSolution(XMLInputStAX.java:480)
>
> at
> com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.hasNext(XMLInputStAX.java:216)
>
> at sw206.TestJena.main(TestJena.java:31)
>
>
>
>

Mime
View raw message