简体   繁体   中英

owl:allValuesFrom and rdfs:range difference

I'm working on semantic webs and I'm wondering: is there any difference in a semanitc of writing a restriction like:

:Person
  a owl:Class ;
  rdfs:subClassOf
    [ a owl:Restriction ;
      owl:onProperty :hasParent ;
      owl:allValuesFrom :Person
   ] .

and writing a range restriction like:

:hasParent rdfs:range :Person.

It seems to me that it means the same: a parent has to have a type of Person. Isn't there any difference?

The first snippet means that a :Person who has a parent necessarily have a :Person -parent. However, a :Dog may have a parent who is not a :Person , for instance. The second snippet says that anything who has a parent necessarily has a :Person -parent, regardless of what this thing is.

Edit after krajol's comment:

The allValuesFrom restriction of the first snippet is not equivalent to:

:hasParent  rdfs:domain  :Person;
            rdfs:range   :Person .

In the case of the allValuesFrom restriction, it is still possible that there are parents that are not persons. In the case of the rdfs:domain / rdfs:range combination, it is not possible. With allValuesFrom restrictions, it's possible to say that persons have person-parents and that dogs have dog-parents, etc. With domain/range, you cannot.

There's another difference worth noting. When there are more than one rdfs:range (or rdfs:domain) triple on a class, the range or domain is the conjunction (intersection) of the stated ranges/domains. See the RDFS spec , though the wording is ambiguous, and this post .

If inferencing is performed on the ontology, you'll find that rdfs:range/domain triples are inferred for all of the superclasses of the stated range/domain class(es). While semantically correct, this may be confusing or difficult to work with. This won't happen with allValuesFrom .

(Adding an answer to an already answered question since I found the essence of the accepted answer lacking.)

[ a owl:Restriction ;
    owl:onProperty :hasParent ;
    owl:allValuesFrom :Person
]

can be read as "the class of all things for which any value for the hasParent predicate (potentially none) is of the type Person ".

By saying that Person is a subclass of this class, we say that it is a more specialised version of this class. So, Person still can only have other Person s as value for hasParent .

This differs from rdfs:range because we make no statement about the valid domain/range for hasParent itself. To recycle Antoine's example , we can still say:

:dog1 a :Dog.
:dog2 a :Dog.
:dog1 :hasParent :dog2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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