gpt4 book ai didi

rdf - 使用 TDB2 和 OWL Reasoner 配置 fuseki

转载 作者:行者123 更新时间:2023-12-05 07:37:14 25 4
gpt4 key购买 nike

这里是 fuseki/jena 的新手。我设法让 fuseki 使用 tdb1 与 OWLFBRuleReasoner 一起运行没问题,但不能让它与 tdb2 ( 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。

关于rdf - 使用 TDB2 和 OWL Reasoner 配置 fuseki,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48770691/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com