Fuseki如何添加颗粒推理机



我想在Fuseki 2.3.1 中使用颗粒推理机

首先:我在配置.ttl中添加了Pellet推理器,如下所示:

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

所以现在我必须将Pellet的罐子添加到fuseki 中

本页介绍如何将罐子(不是特定的pellete)添加到fuseki

https://jena.apache.org/documentation/permissions/example.html

所以我用通讯

exec$JAVA$JVM_ARGS-jar"$jar"$@"

我取消了这条线路的连接

java$JVM_ARGS-cp"$JAR:$APPJAR"org.apache.jena.fuseki.cmd.FusekiCmd"$@"

并取消注释以APPJAR= 开头的行

现在我仍然需要知道下载佩莱的罐子,我找到了这个链接https://datababel.wordpress.com/2013/06/26/fuseki-using-pellet-inference/上面写着哪些是罐子,

我从maven下载了最新的可用版本,它们是:

pellet-jena-ignazio1977-2.4.0-ignazio 1977.jar

pellet-rules-2.3.6-ansell.jar

pellet-el-2.3-ansell.jar

pellet-datatypes-2.3.6-ansell.jar

pellet-core-ignazio1977-2.4.0-ignazio 1977.jar

aterm-java-1.8.2-p1.jar

公共集合4-4.1-javadoc.jar

公用集合4-4.1.jar

我将它们添加到fuseki服务器脚本中,如下所示:

APPJAR=pellet-jena-ignazio1977-2.4.0-ignazio1977.jar:pellet-rules-2.3.6-ansell.jar:pellet-el-2.3.6-ansell.jar:pellet-datatypes-2.3.6-ansell.jar:pellet-core-ignazio1977-2.4.0-ignazio1977.jar:aterm-java-1.8.2-p1.jar:commons-collections4-4.1-javadoc.jar:commons-collections4-4.1.jar

(它们在fuseki的主目录中)

我跑了/fuseki服务器,我得到这个错误

[2016-03-30 16:49:06] Server     INFO  Fuseki 2.3.1 2015-12-08T09:24:07+0000
[2016-03-30 16:49:07] Config     INFO  FUSEKI_HOME=/usr/local/apache-jena-fuseki-2.3.1
[2016-03-30 16:49:07] Config     INFO  FUSEKI_BASE=/usr/local/apache-jena-fuseki-2.3.1/run
[2016-03-30 16:49:07] Servlet    INFO  Initializing Shiro environment
[2016-03-30 16:49:07] Config     INFO  Shiro file: file:///usr/local/apache-jena-fuseki-2.3.1/run/shiro.ini
[2016-03-30 16:49:07] Config     INFO  Load configuration: file:///usr/local/apache-jena-fuseki-2.3.1/run/configuration/config.ttl
[2016-03-30 16:49:07] AssemblerHelp WARN  ja:loadClass: Migration to Jena3: Converting com.hp.hpl.jena.tdb.TDB to org.apache.jena.tdb.TDB
[2016-03-30 16:49:07] Server     ERROR Exception in initialization: com/hp/hpl/jena/reasoner/ReasonerFactory
Exception in thread "main" java.lang.NoClassDefFoundError: com/hp/hpl/jena/reasoner/ReasonerFactory
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.apache.jena.assembler.assemblers.AssemblerBase.loadClass(AssemblerBase.java:109)
    at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.getReasonerFactoryByClassName(ReasonerFactoryAssembler.java:140)
    at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.getReasonerFactory(ReasonerFactoryAssembler.java:131)
    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.build.Builder.buildDataService(Builder.java:75)
    at org.apache.jena.fuseki.build.Builder.buildDataAccessPoint(Builder.java:60)
    at org.apache.jena.fuseki.build.FusekiConfig.readConfiguration(FusekiConfig.java:249)
    at org.apache.jena.fuseki.build.FusekiConfig.readConfigurationDirectory(FusekiConfig.java:223)
    at org.apache.jena.fuseki.server.FusekiServer.initializeDataAccessPoints(FusekiServer.java:212)
    at org.apache.jena.fuseki.server.FusekiServerListener.init(FusekiServerListener.java:78)
    at org.apache.jena.fuseki.server.FusekiServerListener.contextInitialized(FusekiServerListener.java:46)
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:835)
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:530)
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:808)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:342)
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1368)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1335)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:772)
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:259)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:511)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
    at org.eclipse.jetty.server.Server.start(Server.java:405)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:106)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
    at org.eclipse.jetty.server.Server.doStart(Server.java:372)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.apache.jena.fuseki.jetty.JettyFuseki.start(JettyFuseki.java:120)
    at org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.exec(FusekiCmd.java:359)
    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.cmd.FusekiCmd$FusekiCmdInner.innerMain(FusekiCmd.java:95)
    at org.apache.jena.fuseki.cmd.FusekiCmd.main(FusekiCmd.java:60)
Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.reasoner.ReasonerFactory
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 71 more

请帮忙

提示:我不知道我尝试的是对是错,我只想把佩莱推理机加入fuseki

更新

在ignazio告诉我我正在搅拌罐子之后,

我去了Pellet git小屋,下载了src,并使用maven编译并获得了罐子

然后我把我使用的罐子改成:

commons-collections4-4.1-javadoc.jar:commons-collections4-4.1.jar:pellet-cli-2.4.0-SNAPSHOT.jar:jena-core-2.13.0.jar:pellet-jena-2.4.0-SNAPSHOT.jar:pellet-modularity-2.4.0-SNAPSHOT.jar:pellet-owlapi-2.4.0-SNAPSHOT.jar:pellet-pellint-2.4.0-SNAPSHOT.jar

但我得到了一个例外:

[2016-03-30 17:42:09] AssemblerHelp WARN  ja:loadClass: Migration to Jena3: Converting com.hp.hpl.jena.tdb.TDB to org.apache.jena.tdb.TDB
[2016-03-30 17:42:10] RDFDefaultErrorHandler WARN  unknown-source: {W136} Relative URIs are not permitted in RDF: specifically <ont-policy.rdf>
[2016-03-30 17:42:10] Server     ERROR Exception in initialization: expected class org.apache.jena.reasoner.ReasonerFactory, but had class org.mindswap.pellet.jena.PelletReasonerFactory
[2016-03-30 17:42:10] WebAppContext WARN  Failed startup of context o.e.j.w.WebAppContext@5bcde458{/,file:///usr/local/apache-jena-fuseki-2.3.1/webapp/,STARTING}
org.apache.jena.assembler.exceptions.NotExpectedTypeException: expected class org.apache.jena.reasoner.ReasonerFactory, but had class org.mindswap.pellet.jena.PelletReasonerFactory
  doing:
    root: 79f74f0ed3a21ef24b1cbccda7d37b62 with type: http://jena.hpl.hp.com/2005/11/Assembler#ReasonerFactory assembler class: class org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler
    root: file:///usr/local/apache-jena-fuseki-2.3.1/run/configuration/config.ttl#model_inf with type: http://jena.hpl.hp.com/2005/11/Assembler#InfModel assembler class: class org.apache.jena.assembler.assemblers.InfModelAssembler
    root: file:///usr/local/apache-jena-fuseki-2.3.1/run/configuration/config.ttl#dataset 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.mustBeReasonerFactory(ReasonerFactoryAssembler.java:169)
    at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.getReasonerFactoryByClassName(ReasonerFactoryAssembler.java:141)
    at org.apache.jena.assembler.assemblers.ReasonerFactoryAssembler.getReasonerFactory(ReasonerFactoryAssembler.java:131)
    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.build.Builder.buildDataService(Builder.java:75)
    at org.apache.jena.fuseki.build.Builder.buildDataAccessPoint(Builder.java:60)
    at org.apache.jena.fuseki.build.FusekiConfig.readConfiguration(FusekiConfig.java:249)
    at org.apache.jena.fuseki.build.FusekiConfig.readConfigurationDirectory(FusekiConfig.java:223)
    at org.apache.jena.fuseki.server.FusekiServer.initializeDataAccessPoints(FusekiServer.java:212)
    at org.apache.jena.fuseki.server.FusekiServerListener.init(FusekiServerListener.java:78)
    at org.apache.jena.fuseki.server.FusekiServerListener.contextInitialized(FusekiServerListener.java:46)
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:835)
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:530)
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:808)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:342)
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1368)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1335)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:772)
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:259)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:511)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
    at org.eclipse.jetty.server.Server.start(Server.java:405)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:106)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
    at org.eclipse.jetty.server.Server.doStart(Server.java:372)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.apache.jena.fuseki.jetty.JettyFuseki.start(JettyFuseki.java:120)
    at org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.exec(FusekiCmd.java:359)
    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.cmd.FusekiCmd$FusekiCmdInner.innerMain(FusekiCmd.java:95)
    at org.apache.jena.fuseki.cmd.FusekiCmd.main(FusekiCmd.java:60)
[2016-03-30 17:42:10] Server     INFO  Started 2016/03/30 17:42:10 WEST on port 3030

解决方案:请改用openllet。只需在配置文件中更改为ja:reasonerClass "openllet.jena.PelletReasonerFactory",然后将openllet分发版和其他需要的jar文件下载到类路径中。

说明:错误

expected class org.apache.jena.reasoner.ReasonerFactory, but had class org.mindswap.pellet.jena.PelletReasonerFactory

是由于芯块的org.mindswap.pellet.jena.PelletReasonerFactory实现了与Fuseki中使用的接口(org.apache.jena.reasoner.ReasonerFactory)不同的旧接口(com.hp.hpl.jena.reasoner.ReasonerFactory)。

openllet的openllet.jena.PelletReasonerFactory实现了正确的接口(org.apache.jena.reasoner.ReasonerFactory)。

检查他们的源代码:

openllet的PelletReasonerFactory.java

pellet的PelletReasonerFactory.java

您的错误是

expected class org.apache.jena.reasoner.ReasonerFactory, but had class org.mindswap.pellet.jena.PelletReasonerFactory

我不是专家,但看起来您类路径中当前Jena的Pellet工厂与预期的类不匹配。

Fuseki提供了哪个版本的Jena,Pellet目前使用的是哪个版本?

相关内容

  • 没有找到相关文章

最新更新