fuseki Multiple services found exception

南笙酒味 提交于 2021-01-29 04:08:00

问题


I was using this config and it is working

@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 ;
.

Now I want to have another service that does not have any reasoner, I changed my config to this:

@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 ;
.

but when i run my fuseki server, i get this error:

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)

Does anyone know how to solve it please?

Update

I tried to debug the problem, i would remove each triple that I add until there is no problem appears,

I found out when i remove the triples for serviceWithoutReasoner, it works, but i couldn't know what was wrong with these triples and how to solve them

Update2

It sounds like fuseki 2.3 doesn't support multi services, but i am not sure

Update 3

As @Joshua Taylor suggests, i tried the configuration on fueseki 2.0.0 and it works perfectly, that means in fuseki 2.3, they stopped using mutil services, that makes it easy that it is not my mistake.


回答1:


The documentation page says that you can only have one service per file. So you can probably have multiple services, but you'll need multiple config files, or to use the single service configuration file. From the documentation (emphasis added):

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.

Even so, the old configuration files are supposed to "just work" as well. From the same page:

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/

That said, maybe you want a named graph with reasoning and a named graph without reasoning, both in the same dataset. I don't think you'd need multiple services for that, just multiple graphs in the dataset.



来源:https://stackoverflow.com/questions/36422644/fuseki-multiple-services-found-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!