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?

krajol
  • 818
  • 3
  • 13
  • 34

3 Answers3

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.

Antoine Zimmermann
  • 5,314
  • 18
  • 36
  • Well, that's right. But if a statement like: :hasParent rdfs:domain :Person. was added, would it be the same then? – krajol Aug 07 '12 at 08:54
  • @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. – Jeen Broekstra Aug 07 '12 at 23:18
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.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
Ed Staub
  • 15,480
  • 3
  • 61
  • 91
  • 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 ]`. – Antoine Zimmermann Dec 03 '16 at 10:03
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.
Community
  • 1
  • 1
DieterDP
  • 4,039
  • 2
  • 29
  • 38
  • 1
    "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." – Antoine Zimmermann Dec 03 '16 at 10:13
  • Good remark - I've updated the description to clarify that it also applies when the `hasParent` doesn't occur. – DieterDP Dec 05 '16 at 10:20