简体   繁体   English

owl 和 rdfs 属性域范围如何工作?

[英]How do owl and rdfs property domain range work?

I am trying to understand the semantics of rdfs domain and range.我试图理解 rdfs 域和范围的语义。 Because I am from an object oriented background, I am struggling to understand the semantics and how to validate data against the rdfs statements.因为我来自面向对象的背景,所以我很难理解语义以及如何根据 rdfs 语句验证数据。

Here is a sample file in turtle format:这是海龟格式的示例文件:

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix tmpl: <http://template.example.com/>
prefix data: <http://data.example.com/>

    tmpl:Thing a owl:Class.
    tmpl:Employment rdfs:subClassOf tmpl:TemporalThing.
    tmpl:Party rdfs:subClassOf tmpl:Thing.
    tmpl:Individual rdfs:subClassOf tmpl:Party.
    tmpl:Organisation rdfs:subClassOf tmpl:Party.
    tmpl:LimitedLiabilityCompany rdfs:subClassOf tmpl:Organisation.
    tmpl:hasCurrentEmployer a owl:ObjectProperty;
        rdfs:domain tmpl:Party;
        rdfs:range tmpl:Party.
    data:Simon a tmpl:Individual;
        skos:prefLabel "Simon S".
    data:PtyLtd a tmpl:LimitedLiabilityCompany.
    data:Simon tmpl:hasCurrentEmployer data:PtyLtd.

    tmpl:Animal a owl:Thing.
    data:Beans a tmpl:Animal.
    data:Simon tmpl:hasCurrentEmployer data:Beans.

I am using GRAPHDB as my test environment.我使用 GRAPHDB 作为我的测试环境。 I would expect the last statement to fail with some sort of message because 'Beans' is an 'Animal' which is not a 'Party'.我希望最后一条语句会因某种消息而失败,因为“Beans”是一种“Animal”,而不是“Party”。

Yet, GRAPHDB just accepts the statement.然而,GRAPHDB 只是接受该语句。

Any ideas?有任何想法吗?

EDIT编辑

Based on Stanislav's comment below: While An inference engine might not have a problem with this, we can use the domain and range for error checking in an application.基于以下 Stanislav 的评论:虽然推理引擎可能没有这个问题,但我们可以使用域和范围在应用程序中进行错误检查。

As said in the comments, you misunderstood the semantics of domain and range.正如评论中所说,您误解了域和范围的语义。

P rdfs:domain D
P rdfs:range R

mean that if a statement s P o holds, then (with a reasoner running), it could be inferred that s rdf:type D and o rdf:type R .意味着如果语句s P o成立,那么(运行推理器),可以推断出s rdf:type Do rdf:type R

Domain and range are never restrictions on the the property.域和范围从不限制属性。 That has to be clear.这必须清楚。

To understand how things work, check for examplem OWL direct semantics for object properties here .要了解事物是如何工作的,请在此处查看对象属性的示例OWL 直接语义

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

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