我使用Apache Jena从Billion Triple Challange 2014数据集中查询RDF数据。我用tdbloader将数据集加载到Jena中。我特别使用包含带有tdbquery的属性路径的查询。当我开始这样的查询时,我经常得到例外:
Exception
org.apache.jena.atlas.RuntimeIOException: java.io.IOException: Illegal UTF-8: 0xFFFFFF80
at org.apache.jena.atlas.io.IO.exception(IO.java:216)
at org.apache.jena.atlas.io.BlockUTF8.exception(BlockUTF8.java:279)
at org.apache.jena.atlas.io.BlockUTF8.toCharsBuffer(BlockUTF8.java:152)
at org.apache.jena.atlas.io.BlockUTF8.toChars(BlockUTF8.java:75)
at org.apache.jena.atlas.io.BlockUTF8.toString(BlockUTF8.java:97)
at org.apache.jena.tdb.store.nodetable.NodecSSE.decode(NodecSSE.java:101)
at org.apache.jena.tdb.lib.NodeLib.decode(NodeLib.java:105)
at org.apache.jena.tdb.lib.NodeLib.fetchDecode(NodeLib.java:81)
at org.apache.jena.tdb.store.nodetable.NodeTableNative.readNodeFromTable(NodeTableNative.java:186)
at org.apache.jena.tdb.store.nodetable.NodeTableNative._retrieveNodeByNodeId(NodeTableNative.java:111)
at org.apache.jena.tdb.store.nodetable.NodeTableNative.getNodeForNodeId(NodeTableNative.java:70)
at org.apache.jena.tdb.store.nodetable.NodeTableCache._retrieveNodeByNodeId(NodeTableCache.java:128)
at org.apache.jena.tdb.store.nodetable.NodeTableCache.getNodeForNodeId(NodeTableCache.java:82)
at org.apache.jena.tdb.store.nodetable.NodeTableWrapper.getNodeForNodeId(NodeTableWrapper.java:54)
at org.apache.jena.tdb.store.nodetable.NodeTableInline.getNodeForNodeId(NodeTableInline.java:67)
at org.apache.jena.atlas.iterator.Iter$4.next(Iter.java:308)
at org.apache.jena.sparql.engine.main.iterator.QueryIterGraph$QueryIterGraphInner.nextIterator(QueryIterGraph.java:152)
at org.apache.jena.sparql.engine.main.iterator.QueryIterGraph$QueryIterGraphInner.hasNextBinding(QueryIterGraph.java:126)
at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
at org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:74)
at org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
at org.apache.jena.tdb.solver.OpExecutorTDB1.optimizeExecuteQuads(OpExecutorTDB1.java:212)
at org.apache.jena.tdb.solver.OpExecutorTDB1.execute(OpExecutorTDB1.java:148)
at org.apache.jena.sparql.engine.main.ExecutionDispatch.visit(ExecutionDispatch.java:66)
at org.apache.jena.sparql.algebra.op.OpQuadPattern.visit(OpQuadPattern.java:95)
at org.apache.jena.sparql.engine.main.ExecutionDispatch.exec(ExecutionDispatch.java:46)
at org.apache.jena.sparql.engine.main.OpExecutor.exec(OpExecutor.java:118)
at org.apache.jena.tdb.solver.OpExecutorTDB1.exec(OpExecutorTDB1.java:87)
at org.apache.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:232)
at org.apache.jena.sparql.engine.main.ExecutionDispatch.visit(ExecutionDispatch.java:130)
at org.apache.jena.sparql.algebra.op.OpSequence.visit(OpSequence.java:75)
at org.apache.jena.sparql.engine.main.ExecutionDispatch.exec(ExecutionDispatch.java:46)
at org.apache.jena.sparql.engine.main.OpExecutor.exec(OpExecutor.java:118)
at org.apache.jena.tdb.solver.OpExecutorTDB1.exec(OpExecutorTDB1.java:87)
at org.apache.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:393)
at org.apache.jena.sparql.engine.main.ExecutionDispatch.visit(ExecutionDispatch.java:267)
at org.apache.jena.sparql.algebra.op.OpProject.visit(OpProject.java:47)
at org.apache.jena.sparql.engine.main.ExecutionDispatch.exec(ExecutionDispatch.java:46)
at org.apache.jena.sparql.engine.main.OpExecutor.exec(OpExecutor.java:118)
at org.apache.jena.tdb.solver.OpExecutorTDB1.exec(OpExecutorTDB1.java:87)
at org.apache.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:415)
at org.apache.jena.sparql.engine.main.ExecutionDispatch.visit(ExecutionDispatch.java:275)
at org.apache.jena.sparql.algebra.op.OpDistinct.visit(OpDistinct.java:47)
at org.apache.jena.sparql.engine.main.ExecutionDispatch.exec(ExecutionDispatch.java:46)
at org.apache.jena.sparql.engine.main.OpExecutor.exec(OpExecutor.java:118)
at org.apache.jena.tdb.solver.OpExecutorTDB1.exec(OpExecutorTDB1.java:87)
at org.apache.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:403)
at org.apache.jena.sparql.engine.main.ExecutionDispatch.visit(ExecutionDispatch.java:307)
at org.apache.jena.sparql.algebra.op.OpSlice.visit(OpSlice.java:50)
at org.apache.jena.sparql.engine.main.ExecutionDispatch.exec(ExecutionDispatch.java:46)
at org.apache.jena.sparql.engine.main.OpExecutor.exec(OpExecutor.java:118)
at org.apache.jena.tdb.solver.OpExecutorTDB1.exec(OpExecutorTDB1.java:87)
at org.apache.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:89)
at org.apache.jena.sparql.engine.main.QC.execute(QC.java:52)
at org.apache.jena.sparql.engine.main.QueryEngineMain.eval(QueryEngineMain.java:53)
at org.apache.jena.tdb.solver.QueryEngineTDB.eval(QueryEngineTDB.java:112)
at org.apache.jena.sparql.engine.QueryEngineBase.evaluate(QueryEngineBase.java:136)
at org.apache.jena.sparql.engine.QueryEngineBase.createPlan(QueryEngineBase.java:106)
at org.apache.jena.sparql.engine.QueryEngineBase.getPlan(QueryEngineBase.java:87)
at org.apache.jena.tdb.solver.QueryEngineTDB$QueryEngineFactoryTDB.create(QueryEngineTDB.java:169)
at org.apache.jena.sparql.engine.QueryExecutionBase.getPlan(QueryExecutionBase.java:582)
at org.apache.jena.sparql.engine.QueryExecutionBase.startQueryIterator(QueryExecutionBase.java:526)
at org.apache.jena.sparql.engine.QueryExecutionBase.execResultSet(QueryExecutionBase.java:567)
at org.apache.jena.sparql.engine.QueryExecutionBase.execSelect(QueryExecutionBase.java:184)
at org.apache.jena.sparql.util.QueryExecUtils.doSelectQuery(QueryExecUtils.java:196)
at org.apache.jena.sparql.util.QueryExecUtils.executeQuery(QueryExecUtils.java:78)
at arq.query.queryExec(query.java:218)
at arq.query.exec(query.java:160)
at jena.cmd.CmdMain.mainMethod(CmdMain.java:93)
at jena.cmd.CmdMain.mainRun(CmdMain.java:58)
at jena.cmd.CmdMain.mainRun(CmdMain.java:45)
at tdb.tdbquery.main(tdbquery.java:33)
Caused by: java.io.IOException: Illegal UTF-8: 0xFFFFFF80
... 71 more
我的查询是否编码错误或数据集?
例如使用查询:SELECT DISTINCT?o {GRAPH?g {A B *?o}} LIMIT 3 其中A和B是有效的IRI,并返回有效的结果。但我想要查询该查询的所有结果,所以我删除了LIMIT 3并得到了例外。
我也直接使用了查询:
sudo ./tdbquery -time -loc=/path/to/database "SELECT DISTINCT ?o {GRAPH ?g {A B* ?o}}"
并从文件中
sudo ./tdbquery -time -loc=/path/to/database --query=/path/to/query.sparql
很抱歉,如果问题遗漏了任何重要信息。 任何想法为什么我得到异常以及我如何处理它?</ p>