java - fusioni 多个服务发现异常

标签 java sparql jena fuseki

我正在使用这个配置并且它正在工作

@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 ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .

[] rdf:type fuseki:Server ;
    fuseki:services (
        <#serviceTDBwithReasoner>
# <#serviceInMemoryWithReasoner>

    )
.

# TDB
    tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
    tdb:GraphTDB    rdfs:subClassOf  ja:Model .

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

<#serviceTDBwithReasoner> rdf:type fuseki:Service ;
    fuseki:name                       "rs" ;       # http://host:port/ds
    fuseki:serviceQuery               "query" ;    # SPARQL query service (alt name)
    fuseki:serviceUpdate              "update" ;   # SPARQL update service
    fuseki:serviceUpload              "upload" ;   # Non-SPARQL upload service
    fuseki:serviceReadWriteGraphStore "data" ;     # SPARQL Graph store protocol (read and write)

    fuseki:serviceReadGraphStore      "get" ;      # SPARQL Graph store protocol (read only)
    fuseki:dataset                   <#dataset> ;
.


<#dataset> rdf:type      ja:RDFDataset ;
    ja:defaultGraph       <#model_inf> ;
.


<#model_inf> a ja:InfModel ;
    ja:baseModel <#tdbGraph> ;
ja:reasoner [
       ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
   ]
.


<#tdbGraph> rdf:type tdb:GraphTDB ;
    tdb:dataset <#RSDataSet> .

<#RSDataSet> rdf:type  tdb:DatasetTDB ;
    tdb:location "RS" ;
 tdb:unionDefaultGraph true ;
.

现在我想要另一个没有有任何推理器的服务,我将我的配置更改为:

@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 ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .

[] rdf:type fuseki:Server ;
    fuseki:services (
        <#serviceTDBwithReasoner>
# <#serviceInMemoryWithReasoner>
    <#serviceWithoutReasoner>
    )
.

# TDB
    tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
    tdb:GraphTDB    rdfs:subClassOf  ja:Model .

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

<#serviceTDBwithReasoner> rdf:type fuseki:Service ;
    fuseki:name                       "rs" ;       # http://host:port/ds
    fuseki:serviceQuery               "query" ;    # SPARQL query service (alt name)
    fuseki:serviceUpdate              "update" ;   # SPARQL update service
    fuseki:serviceUpload              "upload" ;   # Non-SPARQL upload service
    fuseki:serviceReadWriteGraphStore "data" ;     # SPARQL Graph store protocol (read and write)

    fuseki:serviceReadGraphStore      "get" ;      # SPARQL Graph store protocol (read only)
    fuseki:dataset                   <#dataset> ;
.


<#dataset> rdf:type      ja:RDFDataset ;
    ja:defaultGraph       <#model_inf> ;
.


<#model_inf> a ja:InfModel ;
    ja:baseModel <#tdbGraph> ;
ja:reasoner [
       ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
   ]


.


<#tdbGraph> rdf:type tdb:GraphTDB ;
    tdb:dataset <#RSDataSet> .

<#RSDataSet> rdf:type  tdb:DatasetTDB ;
    tdb:location "RS" ;
 tdb:unionDefaultGraph true ;
.


<#serviceWithoutReasoner> rdf:type fuseki:Service ;
fuseki:name                       "rswithoutreasoner" ;
fuseki:serviceQuery               "query" ;    # SPARQL query service (alt name)
fuseki:serviceUpdate              "update" ;   # SPARQL update service
fuseki:serviceUpload              "upload" ;   # Non-SPARQL upload service
fuseki:serviceReadWriteGraphStore "data" ;     # SPARQL Graph store protocol (read and write)

fuseki:serviceReadGraphStore      "get" ;      # SPARQL Graph store protocol (read only)
fuseki:dataset                   <#datasetwithoutreasoner> ;
.

<#datasetwithoutreasoner> rdf:type      ja:RDFDataset ;
ja:defaultGraph       <#model_infwithoutreasoner> ;
.

<#model_infwithoutreasoner> a ja:InfModel ;
ja:baseModel <#tdbGraphwithoutreasoner> ;
.

<#tdbGraphwithoutreasoner> rdf:type tdb:GraphTDB ;
tdb:dataset <#RSDataSetwithoutreasoner> .

<#RSDataSetwithoutreasoner> rdf:type  tdb:DatasetTDB ;
tdb:location "RSWithoutReasoner" ;
tdb:unionDefaultGraph true ;
.

但是当我运行 fusioni 服务器时,我收到此错误:

2016-04-05 10:32:08] Server     INFO  Fuseki 2.3.1 2015-12-08T09:24:07+0000
[2016-04-05 10:32:08] Config     INFO  FUSEKI_HOME=/usr/local/apache-jena-fuseki-2.3.1
[2016-04-05 10:32:08] Config     INFO  FUSEKI_BASE=/usr/local/apache-jena-fuseki-2.3.1/run
[2016-04-05 10:32:08] Servlet    INFO  Initializing Shiro environment
[2016-04-05 10:32:08] Config     INFO  Shiro file: file:///usr/local/apache-jena-fuseki-2.3.1/run/shiro.ini
[2016-04-05 10:32:08] Config     INFO  Load configuration: file:///usr/local/apache-jena-fuseki-2.3.1/run/configuration/config.ttl
[2016-04-05 10:32:08] Config     ERROR Multiple services found
[2016-04-05 10:32:08] Server     ERROR Exception in initialization: null
[2016-04-05 10:32:08] WebAppContext WARN  Failed startup of context o.e.j.w.WebAppContext@4275c20c{/,file:///usr/local/apache-jena-fuseki-2.3.1/webapp/,STARTING}
org.apache.jena.fuseki.FusekiConfigException
    at org.apache.jena.fuseki.build.FusekiConfig.readConfiguration(FusekiConfig.java:244)
    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)

有谁知道怎么解决吗?

更新

我尝试调试问题,我会删除添加的每个三元组,直到没有问题出现,

我发现当我删除 serviceWithoutReasoner 的三元组时,它可以工作,但我不知道这些三元组出了什么问题以及如何解决它们

Update2

听起来fuseki 2.3不支持多服务,但我不确定

更新3

@Joshua Taylor建议,我在fueseki 2.0.0上尝试了配置,它运行得很好,这意味着在fuseki 2.3中,他们停止使用mutil服务,这很容易证明这不是我的错误。

最佳答案

documentation page表示每个文件只能拥有一项服务。因此,您可能可以拥有多个服务,但您需要多个配置文件,或者使用单个服务配置文件。来自文档(添加了重点):

The data services configuration can come from:

  1. The directory FUSEKI_BASE/configuration/ with one data service assembler per file (includes endpoint details and the dataset description.)
  2. The system database. This includes uploaded assembler files. It also keeps the state of each data service (whether it's active or offline).
  3. The service configuration file. For compatibility, the service configuration file can also have data services. See below.
  4. The command line, if not running as a web application from a .war file.

即便如此,旧的配置文件也应该“正常工作”。来自同一页面:

Compatibility with Fuseki 1 configuration

Configurations from Fuseki 1, where all dataset and server setup is in a single configuration file, will still work. It is less flexible (you can't restart these services after stopping them in a running server) and user should plan to migrate to the new layout.

To convert a Fuseki 1 configuration setup to Fuseki 2 style, move each data service assembler and put in it's own file under FUSEKI_BASE/configuration/

也就是说,也许您想要一个带推理的命名图和一个不带推理的命名图,两者都在同一个数据集中。我认为您不需要为此提供多种服务,只需要数据集中的多个图表即可。

关于java - fusioni 多个服务发现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36422644/

相关文章:

java - 如何测试我的 FIX 客户端?那里有我可以使用的假 FIX 交易所吗?

java - 使用 Jena 将子子项添加到 RDF

java - 让用户输入文件名

rdf - 如何编写有效匹配字符串文字同时忽略大小写的 SPARQL 查询

java - EditText.getText.toString() 返回空字符串

Java:为什么我在输出中得到空值?

SPARQL 查询以获取定义了命名空间前缀的所有类标签

python - 使用 wordnet nltk 确定 Hypernym 或 Hyponym

java - JENA:端点返回内容类型:text/html

java - 通过附加 API 检测 Java 类