在我的Java程序中,我正在创建一个本地Sesame存储,如下所示:
File repoDir = new File("./RDF_repository/");
if (!repoDir.exists())
repoDir.mkdir();
repository = new SailRepository( new NativeStore(repoDir) );
repository.initialize();
我添加了新的RDF文件:
RepositoryConnection con = repository.getConnection();
try {
// As I may add some DBpedia files, I set these non fatal errors.
Set<RioSetting<?>> set = new HashSet<>();
set.add( BasicParserSettings.VERIFY_DATATYPE_VALUES );
set.add( BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES );
con.getParserConfig().setNonFatalErrors(set);//*/
con.add(uri.toURL(), null, RDFFormat.RDFXML);
}finally {
con.close();
}
奇怪的是,经过一段时间的执行后,程序崩溃,JVM生成了一个“hs_err_pid”日志文件。该文件的头部是:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f9215385e40, pid=6172, tid=140265570998016
#
# JRE version: 7.0_21-b02
# Java VM: OpenJDK 64-Bit Server VM (23.7-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# J org.openrdf.query.algebra.evaluation.impl.QueryJoinOptimizer$JoinVisitor.meet(Lorg/openrdf/query/algebra/Join;)V
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
# https://bugs.launchpad.net/ubuntu/+source/openjdk-7/
#
(我不确定文件的其余部分是否对分析问题很重要。如果是,请告诉我。)
已经发生过几次,每次根据这些信息,问题似乎是“org.openrdf.query.algebra.evaluation.impl.QueryJoinOptimizer
”类。或者,也许是我创建和添加新RDF文件的方式。
我使用的芝麻版本是2.7.3。和Java版本1.7。
有人知道发生了什么事吗? = /
谢谢!
编辑:
另外,我正在查询。代码如下:
con = repository.getConnection();
TupleQuery tupleQuery = con.prepareTupleQuery( QueryLanguage.SPARQL, query);
TupleQueryResult result = tupleQuery.evaluate();
try {
while (qResult.hasNext()) {
BindingSet set = qResult.next();
Value prop = set.getValue("prop");
if (prop != null)
result.add(prop.stringValue());
}
} finally {
qResult.close();
con.close();
}
上面,query
变量包含SPARQL查询。所有查询代码都遵循上面的代码。我的程序做了很多查询,它们并不复杂,也不是并发的。