How do owl and rdfs property domain range work?

五迷三道 提交于 2020-01-03 04:16:35

问题


I am trying to understand the semantics of rdfs domain and range. Because I am from an object oriented background, I am struggling to understand the semantics and how to validate data against the rdfs statements.

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. I would expect the last statement to fail with some sort of message because 'Beans' is an 'Animal' which is not a 'Party'.

Yet, GRAPHDB just accepts the statement.

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.


回答1:


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.

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.



来源:https://stackoverflow.com/questions/44397250/how-do-owl-and-rdfs-property-domain-range-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!