jena-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Wibberley <Simon.Wibber...@sussex.ac.uk>
Subject Unexpected end of input errors on reading from dbpedia
Date Mon, 07 Feb 2011 23:09:49 GMT
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