<?xml version="1.0"?> <sparql xmlns="http://www.w3.org/2005/sparql-results#"> <head> <variable name="onto"/> </head> <results> <result> <binding name="onto"> <uri>http://www.w3.org/2002/07/owl#Thing</uri> </binding> </result> <result> <binding name="onto"> <uri>http://www.w3.org/2002/07/owl#Thing</uri> </binding> </result> <result> <binding name="onto"> <uri>http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing</uri> </binding> </result> </results> </sparql>
当我用Jena阅读它时,我尝试扫描它:
ResultSet r = ResultSetFactory.fromXML( xmlCode ); while ( r.hasNext() ) { QuerySolution soln = r.next() ... }
我总是得到以下异常:
com.hp.hpl.jena.sparql.resultset.ResultSetException: End of document while processing solution at com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.staxError(XMLInputStAX.java:503) at com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.getonesolution(XMLInputStAX.java:413) at com.hp.hpl.jena.sparql.resultset.XMLInputStAX$ResultSetStAX.hasNext(XMLInputStAX.java:218)
这是耶拿虫还是其他什么?
编辑:为了完整,我报告a thread about this error:
When some help from the bio2rdf
mailing list,we were able to track
the error down a bit more.Arq 2.8.3 works fine Arq 2.8.4 fails
with the described error Arq 2.8.5
fails with the described error So I
guess I will keep Art 2.8.3 for my
tests. Let me kNow if I can help to
debug this error a bit more.Weird. The error is coming from the
STaX parser – all the base level XML
parsing is subcontracted to woodstox.
It’s almost if it is reading faster
than the input arrives and sees EOF
rather than blocking for new input. I
tried reading the whole stream then
parsing the bytes read and it works
OK. Why 2.8.3 should be different is
unclear to me at the moment it might
just be timing.Workaround: switch the XML parsers
with:ARQ.getContext().setTrue(ARQ.useSAX) ;
before making the call to
QueryExecutionFactory.sparqlService
Andy
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。