Exception while executing request

I am trying to query the Dbpedia dataset through their sparql remote endpoints. So far, I have managed to connect to the endpoints and perform normal requests. But when I run the following query I get some results and then an exception that I am not aware of. Can someone help. The request and the exception are as follows.

SELECT DISTINCT ?p ?o WHERE 
{ ?p ?x <http://dbpedia.org/resource/Nepal>.
  ?p <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o. }

      

and the exception looks like this

16:51:30 WARN  XMLInputStAX$ResultSetStAX :: StAX error: XMLStreamException: Unexpected EOF; was expecting a close tag for element <result>
 at [row,col {unknown-source}]: [2068,3]
com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting a close tag for element <result>
 at [row,col {unknown-source}]: [2068,3]
        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.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.getOneSolution(XMLInputStAX.java:410)
        at com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.hasNext(XMLInputStAX.java:217)
        at sat.Algorithm.incomingLink(Algorithm.java:128)
        at sat.Main.main(Main.java:20)
2 [main] WARN com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX  - StAX error: XMLStreamException: Unexpected EOF; was expecting a close tag for element <result>
 at [row,col {unknown-source}]: [2068,3]..........

      

This is due to a lot of results and Jena is not coping with it? Personally, I'm not sure, because the number of results that are displayed successfully seems to be different on each execution. So someone can help.

+3


source to share


1 answer


Try using projections like LIMIT and OFFSET to control the size of the result set. DPBEDIA is capped at 10,000 by default, although depending on the amount of memory allocated to the JVM this shouldn't be a problem. I am using it using Jena ARQ API and using sparqlService method. Something like that:



QueryExecution qe = QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql", "SELECT DISTINCT ?p ?o WHERE { ?p ?x <http://dbpedia.org/resource/Nepal>. ?p <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o. }");
ResultSet queryResults = qe.execSelect(); 

      

+1


source







All Articles