1

在我的 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 文件的方式。

我使用的 Sesame 版本是 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 查询。所有查询代码都遵循上面的代码。我的程序做了很多查询,它们并不复杂,也不并发。

4

0 回答 0