owl:allValuesFrom and rdfs:range difference
Asked Answered
C

3

12

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?

Camboose answered 7/8, 2012 at 7:52 Comment(0)
P
10

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.

Paillette answered 7/8, 2012 at 8:44 Comment(2)
Well, that's right. But if a statement like: :hasParent rdfs:domain :Person. was added, would it be the same then?Camboose
@krajol, setting the domain to :Person means that everyone that has a parent is a Person. If you combine that with the OWL restriction above, then yes, the logical consequence is that everything that has a parent is a Person, and everything that is a parent is a Person. The difference between domain/range on the one hand and class restrictions on the other is that domain/range are always global, while class restrictions are only valid for the class you define them on.Ko
D
1

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.

Demisemiquaver answered 8/10, 2014 at 18:11 Comment(1)
What do you mean by "this won't happen with allValuesFrom"? If you have :Person rdfs:subClassOf [ a owl:Restriction; owl:onProperty :hasParent; owl:allValuesFrom :Person ] and :Person rdfs:subClassOf :Agent, then you can infer that :Person rdfs:subClassOf [ a owl:Restriction; owl:onProperty :hasParent; owl:allValuesFrom :Agent ].Paillette
T
1

(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 Persons 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.
Teniacide answered 1/12, 2016 at 11:7 Comment(2)
"the class of all things that have a Person as value for the hasParent predicate" could be misleading. This class includes, for instance, things that do not have any value for the hasParent property. It'd be better to say "the class of all things of which all parents are persons."Paillette
Good remark - I've updated the description to clarify that it also applies when the hasParent doesn't occur.Teniacide

© 2022 - 2024 — McMap. All rights reserved.