使用TDB2和OWL Reasoner配置fuseki [英] configure fuseki with TDB2 and OWL Reasoner

查看:226
本文介绍了使用TDB2和OWL Reasoner配置fuseki的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

New to fuseki/jena here. I managed to get fuseki to run with OWLFBRuleReasoner using tdb1 no problem, but can't make it work with tdb2 (http://jena.apache.org/2016/tdb#). I could not find an explicit example of configuration that uses both TDB2 and OWLFBRuleReasoner, so I just converted this one (that works)

    @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属性进行了测试)

(this one works fine. I tested with a owl:inverseOf property)

进入这一行(无效)

@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推理不起作用.

As you can see, I basically just replace tdb with tdb2 (namespaces and all). Fuseki starts and runs fine, but OWL inference does not work.

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

Anyone can point me to relevant documentation / example ? or maybe I totally misunderstood TDB1 vs TDB2 deal.

谢谢

修复了我的TDB2配置文件(仍然不起作用).

fixed my TDB2 configuration file (still does not work).

推荐答案

这是我的工作:

@prefix :      <http://base/#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix tdb2:  <http://jena.apache.org/2016/tdb#> .
@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                    "TDB2 food" ;
        fuseki:dataset                :tdb_dataset_readwrite ;
        fuseki:name                   "food" ;
        fuseki:serviceQuery           "query" , "sparql" ;
        fuseki:serviceReadGraphStore  "get" ;
        fuseki:serviceReadWriteGraphStore
                "data" ;
        fuseki:serviceUpdate          "update" ;
        fuseki:serviceUpload          "upload" .

:tdb_dataset_readwrite a ja:RDFDataset;
		ja:defaultGraph :modelInf;
		.

:modelInf a ja:InfModel;
		ja:reasoner [ ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>] ;
		#ja:reasoner [ ja:reasonerURL <http://jena.hpl.hp.com/2003/GenericRuleReasoner> ; 
                     # ja:rulesFrom <file:///C:/Users/shaoj/Documents/IntelligentQA/apache-jena-fuseki-3.8.0/run/databases/rules.ttl> ] ;
		ja:baseModel :gra ;
		.
:gra a tdb2:GraphTDB;
        tdb2:location  "C:\\Users\\shaoj\\Documents\\IntelligentQA\\apache-jena-fuseki-3.8.0\\run/databases/food" ;
		tdb2:unionDefaultGraph true ; 
		.

这篇关于使用TDB2和OWL Reasoner配置fuseki的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆