在Fuseki服务器上使用Pellet推理器时出错

时间:2016-04-20 16:43:15

标签: apache jena owl fuseki pellet

我尝试使用Pellet推理器和Jena启动Fuseki服务器。我发现another thread有类似的问题,但是(1)我的错误信息不同,(2)看起来在引用的线程中没有提供最终的解决方案。

问题是Fuseki说

no reasoner called file:///home/gosper/Desktop/tools/jena-fuseki1-1.3.1/org.mindswap.pellet.jena.PelletReasonerFactory

目前尚不清楚为什么它指向这个根,我显然没有一个名为org.mindswap.pellet.jena.PelletReasonerFactory的文件。

这是我的config.ttl文件,我按如下方式启动Fuseki服务器:

./fuseki-server --update --config=config.ttl

config.ttl

# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
## Basic Fuseki configuation file.
##
## See also config-tdb.ttl for TDB specific examples.
## See also config-examples.ttl for commented examples.

@prefix : <#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .

[] rdf:type fuseki:Server ;

fuseki:services (

<#tdb>

) .

# Custom code.
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .

########################################################################

# TDB
<#tdb> rdf:type fuseki:Service ;
fuseki:name "tdb" ; # http://localhost:3030/tdb
fuseki:serviceQuery "query" ; # SPARQL query service
fuseki:serviceQuery "sparql" ; # SPARQL query service
fuseki:serviceUpdate "update" ; # SPARQL query service
fuseki:serviceUpload "upload" ; # Non-SPARQL upload service
fuseki:serviceReadGraphStore "get"; # SPARQL Graph store protocol (read only)
fuseki:dataset <#dataset2> ; #select which set to
. #use
tdb:GraphTDB rdfs:subClassOf ja:Model .

<#dataset2> rdf:type ja:RDFDataset ;
ja:defaultGraph <#model2>;
.

<#model2> a ja:InfModel;
ja:baseModel <#tdbGraph>;
ja:reasoner
[ ja:reasonerURL
<org.mindswap.pellet.jena.PelletReasonerFactory>];
.
<#tdbGraph> rdf:type tdb:GraphTDB;
tdb:location "DB";
.

我从here下载了所有必需的Jena库,并按照here所述将它们添加到Fuseki根目录。最后,我修改过的fuseki-server脚本如下所示:

#!/bin/sh

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

export FUSEKI_HOME="${FUSEKI_HOME:-$PWD}"

if [ ! -e "$FUSEKI_HOME" ]
then
    echo "$FUSEKI_HOME does not exist" 1>&2
    exit 1
    fi

JAR1="$FUSEKI_HOME/fuseki-server.jar"
JAR2="$FUSEKI_HOME/jena-fuseki-*-server.jar"
JAR=""

for J in "$JAR1" "$JAR2"
do
    # Expand
    J="$(echo $J)"
    if [ -e "$J" ]
    then
    JAR="$J"
    break
    fi
done

if [ "$JAR" = "" ]
then
    echo "Can't find jarfile to run"
    exit 1
fi

# Deal with Cygwin path issues
cygwin=false
case "`uname`" in
    CYGWIN*) cygwin=true;;
esac
if [ "$cygwin" = "true" ]
then
    JAR=`cygpath -w "$JAR"`
    FUSEKI_HOME=`cygpath -w "$FUSEKI_HOME"`
fi

JVM_ARGS=${JVM_ARGS:--Xmx1200M}


# By default this line should be uncommented
# exec java  $JVM_ARGS -jar "$JAR" "$@"

# By default these lines should be commented out
java $JVM_ARGS -cp "$JAR:$APPJAR" org.apache.jena.fuseki.FusekiCmd "$@"

APPJAR=aterm-java-1.6.jar:pellet-cli.jar:pellet-core.jar:pellet-datatypes.jar:pellet-dig.jar:pellet-el.jar:pellet-explanation.jar:pellet-jena.jar:pellet-modularity.jar:pellet-owlapiv3.jar:pellet-pellint.jar:pellet-query.jar:pellet-rules.jar:pellet-test.jar:commons-collections-3.2.jar

现在,当我尝试启动Fuseki服务器时,出现以下错误:

root@gosper-HP-EliteBook-8460p:/home/gosper/Desktop/tools/jena-fuseki1-1.3.1# ./fuseki-server --update --config=config-tdb-pelletreasoner.ttl
18:30:53 WARN  ja:loadClass: Migration to Jena3: Converting com.hp.hpl.jena.tdb.TDB to org.apache.jena.tdb.TDB
org.apache.jena.assembler.exceptions.UnknownReasonerException: no reasoner called file:///home/gosper/Desktop/tools/jena-fuseki1-1.3.1/org.mindswap.pellet.jena.PelletReasonerFactory for d968cc61bfbe1366298b7276173e9fd2 [ja:reasoner of :model2]
  doing:
    root: d968cc61bfbe1366298b7276173e9fd2 with type: http://jena.hpl.hp.com/2005/11/Assembler#ReasonerFactory assembler class: class org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler
    root: file:///home/gosper/Desktop/tools/jena-fuseki1-1.3.1/config-tdb-pelletreasoner.ttl#model2 with type: http://jena.hpl.hp.com/2005/11/Assembler#InfModel assembler class: class org.apache.jena.assembler.assemblers.InfModelAssembler
    root: file:///home/gosper/Desktop/tools/jena-fuseki1-1.3.1/config-tdb-pelletreasoner.ttl#dataset2 with type: http://jena.hpl.hp.com/2005/11/Assembler#RDFDataset assembler class: class org.apache.jena.sparql.core.assembler.DatasetAssembler

    at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.getReasonerFactoryByURL(ReasonerFactoryAssembler.java:192)
    at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.getReasonerFactory(ReasonerFactoryAssembler.java:133)
    at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.open(ReasonerFactoryAssembler.java:50)
    at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:130)
    at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:117)
    at org.apache.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
    at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:39)
    at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:35)
    at org.apache.jena.assembler.assemblers.InfModelAssembler.getReasonerFactory(InfModelAssembler.java:53)
    at org.apache.jena.assembler.assemblers.InfModelAssembler.getReasoner(InfModelAssembler.java:46)
    at org.apache.jena.assembler.assemblers.InfModelAssembler.openEmptyModel(InfModelAssembler.java:34)
    at org.apache.jena.assembler.assemblers.ModelAssembler.openModel(ModelAssembler.java:36)
    at org.apache.jena.assembler.assemblers.ModelAssembler.open(ModelAssembler.java:43)
    at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:130)
    at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:117)
    at org.apache.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
    at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:39)
    at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:35)
    at org.apache.jena.assembler.assemblers.AssemblerGroup.openModel(AssemblerGroup.java:35)
    at org.apache.jena.sparql.core.assembler.DatasetAssembler.createDataset(DatasetAssembler.java:59)
    at org.apache.jena.sparql.core.assembler.DatasetAssembler.open(DatasetAssembler.java:43)
    at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:130)
    at org.apache.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:117)
    at org.apache.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
    at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:39)
    at org.apache.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:35)
    at org.apache.jena.fuseki.server.FusekiConfig.processService(FusekiConfig.java:242)
    at org.apache.jena.fuseki.server.FusekiConfig.configure(FusekiConfig.java:131)
    at org.apache.jena.fuseki.FusekiCmd.exec(FusekiCmd.java:448)
    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 org.apache.jena.fuseki.FusekiCmd.main(FusekiCmd.java:161)

1 个答案:

答案 0 :(得分:1)

ja:reasoner
        [ ja:reasonerClass
        "org.mindswap.pellet.jena.PelletReasonerFactory";]

与汇编程序不同。

(此示例位于您提供的第一个链接中)