简体   繁体   English

RDFS-Plus 推理 rdfs:GraphDB 中的域和范围

[英]RDFS-Plus Reasoning for rdfs:domain and range in GraphDB

Consider two GraphDB repositories with different reasoning rulesets:考虑两个具有不同推理规则集的 GraphDB 存储库:

  • Repo A with ruleset "RDFS (Optimized)"带有规则集“RDFS(优化)”的回购协议 A
  • Repo B with ruleset "RDFS-Plus (Optimized)"具有规则集“RDFS-Plus(优化)”的回购 B

I executed the following SPARQL INSERT in both these repositories:我在这两个存储库中执行了以下 SPARQL INSERT:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ex: <http://www.example.com#>
INSERT DATA { 
    ex:hasPet a owl:ObjectProperty;
        rdfs:domain ex:Human;
        rdfs:range ex:Pet.
    ex:someHuman ex:hasPet ex:somePet. 
}

In both repositories, I would expect that through rdfs:domain and rdfs:range , the following class assertions should be inferred:在这两个存储库中,我希望通过rdfs:domainrdfs:range ,应该推断出以下 class 断言:

  • ex:someHuman rdf:type ex:Human
  • ex:somePet rdf:type ex:Pet

rdfs:domain and rdfs:range are RDFS properties so they should be inferred for Repo A . rdfs:domainrdfs:range是 RDFS 属性,因此应该为Repo A推断它们。 And because RDFS-Plus is an extension of RDFS, I thought they would also be inferred in Repo B .而且因为 RDFS-Plus 是 RDFS 的扩展,我认为它们也会在Repo B中被推断出来。

However, these tripels are only inferred with ruleset RDFS ( Repo A ).然而,这些三元组只能通过规则集 RDFS ( Repo A ) 推断出来。 If I execute the following SPARQL query, I only get a result in Repo A and no result in Repo B .如果我执行以下 SPARQL 查询,我只会在Repo A中得到结果,而在Repo B中没有结果。

PREFIX ex: <http://www.example.com#>
SELECT ?pet WHERE { 
    ?pet a ex:Pet.
}

Could somebody tell me why the two tripels above are only inferred with RDFS ruleset, but not with RDFS-Plus ruleset?有人能告诉我为什么上面的两个三元组只能用 RDFS 规则集推断出来,而不能用 RDFS-Plus 规则集推断出来吗?

Posting my solution as an answer so that someone having this problem in the future doesn't have to dig through the comments above.将我的解决方案作为答案发布,以便将来遇到此问题的人不必深入研究上面的评论。

As @DamyanOgnyanov pointed out in the comments to my question, the necessary rules to infer types based on rdfs:domain and rdfs:range are not included in GraphDB's RDFS-Plus and RDFS-Plus (Optimized) ruleset.正如@DamyanOgnyanov 在对我的问题的评论中指出的那样,基于rdfs:domainrdfs:range推断类型的必要规则不包含在 GraphDB 的 RDFS-Plus 和 RDFS-Plus(优化)规则集中。 They are, however, included in the RDFS ruleset, which is counter-intuitive because RDFS should be the basis for RDFS-Plus.然而,它们包含在 RDFS 规则集中,这是违反直觉的,因为 RDFS 应该是 RDFS-Plus 的基础。

In order to make the RDFS-Plus ruleset a proper extension of the RDFS ruleset and get support for rdfs:domain and rdfs:range , I added the following rules of RDFS to RDFS-Plus.为了使 RDFS-Plus 规则集成为 RDFS 规则集的适当扩展并获得对rdfs:domainrdfs:range的支持,我将以下 RDFS 规则添加到 RDFS-Plus。 The ruleset file can be found at <your-graphdb-folder>/configs/rules规则集文件可以在<your-graphdb-folder>/configs/rules中找到

    Id: rdfs2

      a b c [Constraint b != <rdf:type>]
      b <rdfs:domain> d
    ------------------------------------
      a <rdf:type> d


    Id: rdfs3

      a b c
      b <rdfs:range> d
    ------------------------------------
      c <rdf:type> d

Furthermore, I also added the rules with IDs rdfs6 , rdfs7 , rdfs12 , rdfs13 from RDFS to RDFS-Plus.此外,我还将ID rdfs6rdfs7rdfs12rdfs13的规则从 RDFS 添加到 RDFS-Plus。

I did not add rules rdfs5 , rdfs9 and rdfs11 .没有添加规则rdfs5rdfs9rdfs11 Rules rdfs5 and rdfs11 are covered by the transitive property rules and rdfs9 is covered by the axiom and rules about psys:transitiveOver .规则rdfs5rdfs11包含在传递属性规则中, rdfs9包含在关于psys:transitiveOver的公理和规则中。

Edit: GraphDB did not pick up these changes when I created a new repository with the edited RDFS-Plus ruleset.编辑:当我使用编辑后的 RDFS-Plus 规则集创建新存储库时,GraphDB 没有接受这些更改。 I had to select "Upload custom ruleset" and upload the ruleset that I had edited (ie the RDFS-Plus ruleset which still has the default name).我必须使用 select“上传自定义规则集”并上传我编辑过的规则集(即仍然具有默认名称的 RDFS-Plus 规则集)。

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

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