使用TDB2和OWL Reasoner配置fuseki

2024-02-22

这里是 fusioni/jena 的新手。我设法让 fusioni 使用 tdb1 与 OWLFBRuleReasoner 一起运行没有问题,但无法使其与 tdb2 一起工作(http://jena.apache.org/2016/tdb# http://jena.apache.org/2016/tdb#)。我找不到同时使用 TDB2 和 OWLFBRuleReasoner 的配置的明确示例,因此我只是转换了这个(有效)

    @prefix :      <http://base/#> .
@prefix tdb:   <http://jena.hpl.hp.com/2008/tdb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .

# fuseki configuration to have OWL entailment
# this is the configuration on s-stf-gin (fuseki data folder is on c:\)

:service_tdb_all  a                   fuseki:Service ;
        rdfs:label                    "TDB gsip" ;
        fuseki:dataset                :tdb_dataset_readwrite ;
        fuseki:name                   "gsip" ; 
        fuseki:serviceQuery           "query" , "sparql" ;
        fuseki:serviceReadGraphStore  "get" ;
        fuseki:serviceReadWriteGraphStore
                "data" ; 
        fuseki:serviceUpdate          "update" ; 
        fuseki:serviceUpload          "upload" . 

        # above, remove data, update and upload in prod
:tdb_dataset_readwrite
        a             ja:RDFDataset;
        rdfs:label "GSIP";
        ja:defaultGraph       <#model_inf> ;
        tdb:location  "c:\\fuseki/databases/gsip" .

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

<#graph> rdf:type tdb:GraphTDB ;
  tdb:dataset :tdb_dataset_readwrite .

(这个工作正常。我用 owl:inverseOf 属性进行了测试)

进入这个(不起作用)

@prefix :      <http://base/#> .
@prefix tdb2:   <http://jena.apache.org/2016/tdb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .

:service_tdb_all  a                   fuseki:Service ;
        fuseki:dataset                :dataset ;
        fuseki:name                   "gsip" ;
        fuseki:serviceQuery           "query" , "sparql" ;
        fuseki:serviceReadGraphStore  "get" ;
        fuseki:serviceReadWriteGraphStore "data" ;
        fuseki:serviceUpdate          "update" ;
        fuseki:serviceUpload          "upload" .

:dataset a ja:RDFDataset ;
    ja:defaultGraph       <#model_inf> ;
    tdb2:location  "c:\\fuseki/databases/gsip"
     .

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

<#graph> rdf:type tdb2:GraphTDB ; # also tried tdb2:GraphTDB2
  tdb2:dataset :dataset .

正如您所看到的,我基本上只是将 tdb 替换为 tdb2(命名空间等)。 Fuseki 启动并运行良好,但 OWL 推理不起作用。

任何人都可以向我指出相关文档/示例吗?或者也许我完全误解了 TDB1 与 TDB2 的交易。

感谢您

编辑:修复了我的 TDB2 配置文件(仍然不起作用)。


以下对我有用:

@prefix :      <http://base/#> .
@prefix tdb:   <http://jena.hpl.hp.com/2008/tdb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .

:service_tdb_all  a                   fuseki:Service ;
        rdfs:label                    "TDB [MyDatasetName]" ;
        fuseki:dataset                :inferred_dataset ;
        fuseki:name                   "[MyDatasetName]" ;
        fuseki:serviceQuery           "query" , "sparql" ;
        fuseki:serviceReadGraphStore  "get" ;
        fuseki:serviceReadWriteGraphStore
                "data" ;
        fuseki:serviceUpdate          "update" ;
        fuseki:serviceUpload          "upload" .

:inferred_dataset a ja:RDFDataset ;
        ja:defaultGraph :inference_model .

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

:tdb_graph a tdb:GraphTDB ;
        tdb:dataset :tdb_dataset_readwrite .

:tdb_dataset_readwrite
        a             tdb:DatasetTDB ;
        tdb:location  "[MyDatasetLocationOnDisk]" .

与您的版本的主要区别是没有推理的单独数据集(而不是已经注意到的回送“Barry NL”)和 tdb 前缀的不同命名空间。请注意,命名空间前缀可以自由选择(它们没有语义意义),并且只要它指向相同的命名空间 URL,更改命名空间前缀就没有关系。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用TDB2和OWL Reasoner配置fuseki 的相关文章

随机推荐