简体   繁体   English

Fuseki猫头鹰推理机无法与TDB一起使用

[英]Fuseki owl reasoner not working with TDB

This is my configuration file 这是我的配置文件

# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

## Fuseki Server configuration file.

@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 (
        <#service1>
    )
.

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

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

<#service1> rdf:type fuseki:Service ;
fuseki:name                       "rs" ;       # http://host:port/ds
fuseki:serviceQuery               "sparql" ;   # SPARQL query service
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)
# A separate read-only graph store endpoint:
fuseki:serviceReadGraphStore      "get" ;      # SPARQL Graph store protocol (read only)
fuseki:dataset                   <#dataset> ;
.


<#dataset> rdf:type      tdb:DatasetTDB ;
    tdb:location "RS" ;
    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 ;
.

when I run fuseki (2.3) I can see my data set which uses TDB (not in memeory) I can upload my rdf triple, and even when i close fuseki and re open it, the triples are there, but the reaoner is not working 当我运行fuseki (2.3)时,我可以看到使用TDB的数据集(不在内存中),我可以上传我的rdf三元组,即使我关闭fuseki并重新打开它,三元组也存在,但是reaoner不能正常工作

this is my data 这是我的数据

@prefix : <http://example.org/rs#>
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

:A   rdfs:subClassOf :B .
:B   rdfs:subClassOf :C .
:i  a   :A .

when i do this query 当我做这个查询

select * where {
:i a ?e
}

I get just :A where i should have gotten :B and :C 我得到:A我应该到达:A地方:B:C

whats wrong in my configuration please? 请问我的配置有什么问题?

I guess you might not load the configuration file correctly, when you run the fuseki. 我猜您在运行fuseki时可能无法正确加载配置文件。 Did you explicitly ask fuseki to use your configuration file? 您是否明确要求fuseki使用您的配置文件?

I have my fuseki running well with reasoning capability, by following the instruction in this tutorial ( http://krr.cs.vu.nl/wp-content/uploads/2013/09/protege-fuseki-yasgui-manual.pdf ). 通过遵循本教程中的说明,我的funki在推理能力方面运行良好( http://krr.cs.vu.nl/wp-content/uploads/2013/09/protege-fuseki-yasgui-manual.pdf ) 。 Check the page 3, and I hope you would solve your problem. 检查第3页,希望您能解决您的问题。

This line 这条线

<#dataset> rdf:type      tdb:DatasetTDB ;

says it's TDB database but that isn't what is needed. 表示这是TDB数据库,但这不是必需的。 You need a ja:RDFDataset to contain the inf graph that uses TDB as it's base data. 您需要一个ja:RDFDataset来包含将TDB用作基础数据的inf图。

(needs testing) (需要测试)

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

Not being familiar with the specifics of Fuseki, I'd bet you need to explicitly invoke an inference engine on an OWL or RDFS profile. 我不熟悉Fuseki的细节,我敢打赌您需要在OWL或RDFS配置文件上显式调用推理引擎。 Once that is completed you should see the entailments you want. 完成后,您应该会看到所需的附件。 OTOH, there is a common SPARQL query that will get the same entailed results: OTOH,有一个常见的SPARQL查询将获得相同的必要结果:

SELECT ?e
WHERE {
   :i a ?cls .
   ?cls rdfs:subClassOf* ?e .
}

Or, more compactly using property paths: 或者,更紧凑地使用属性路径:

SELECT ?e
WHERE {
   :i rdf:type/rdfs:subClassOf* ?e .
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM