0

Let's say we have the owl:Class Person and the owl:Class Fruit. Besides that we have the owl:ObjectProperty loves (Domain: Person, Range: Fruit). There are several instances of both classes.

Is it possible to express in OWL that one particular instance of the class Person likes all fruits except apples (instance of Fruit) without having to manually define all of the loves-relations between that person and all the other Fruit instances (except apple)?

On a more abstract level: Is it possible to define relations between an instance and a range of instances (either on a class-level or for the instance itself)?

phil155
  • 75
  • 6

2 Answers2

2

OneOf restrictions are used for what you're describing. To exclude one instance from a class (for the first part of your question) you can intersect the fruit class and the negation of OneOf(Apple), and use it to declare your apple hater as having as type a range assertion for your love property.

Ignazio
  • 10,504
  • 1
  • 14
  • 25
1

The solution to your problem depends whether "apple" is an instance of "fruit" or "apple" is a subclass of "fruit". It would make more sense to say that "apple" is a class, because there are many instances of apples. But since Ignazio presented a solution where "apple" is an instance, and that his answer was accepted, I will start with assuming that "apple" is an instance. Then you can achieve what you want with:

:Fruit  a  owl:Class .
:apple  a  :Fruit .
:Person a  owl:Class .
:bob    a  :Person .
:loves  a  owl:ObjectProperty .
[ a owl:Class;
  owl:intersectionOf (
    :Fruit
    [ a owl:Class; owl:complementOf [a owl:Class; owl:oneOf (:apple)] ]
  )
]  rdfs:subClassOf  [
  a owl:Restriction;
  owl:onProperty [ owl:inverseOf :loves ];
  owl:hasValue :bob
] .

This is saying that everything that is a :Fruit and is not :apple is necessary loved by :bob (assuming :bob is the identifier of the person who does not like apples. Note that this is different from Ignazio's solution, which does not exactly model what the OP wants.

Now, if there is a class of apples, then the solution would be:

:Fruit  a  owl:Class .
:Apple  rdfs:subClassOf  :Fruit .
:Person a  owl:Class .
:bob    a  :Person .
:loves  a  owl:ObjectProperty .
[ a owl:Class;
  owl:intersectionOf (
    :Fruit
    [ a owl:Class; owl:complementOf :Apple ]
  )
]  rdfs:subClassOf  [
  a owl:Restriction;
  owl:onProperty [ owl:inverseOf :loves ];
  owl:hasValue :bob
] .
Antoine Zimmermann
  • 5,314
  • 18
  • 36
  • My original intent was to see apple as an instance of Fruit. But I can see that it makes sense to assume that it's a class. Thank you for explaining both ways! – phil155 Feb 08 '17 at 22:16
  • I'm struggling to do what you suggested in Protégé (assuming that apple is an instance of Fruit): I added the Type: "loves only (Fruit and not {apple})" to the individual . Although there are several instances of Fruit and they are all distinct individuals, the reasoner is not inferring a single loves-relation. Even the Type: "loves only Fruit" is not resulting in any inference. Any ideas on what I'm missing here? Your help is highly appreciated! :) – phil155 Feb 09 '17 at 15:29
  • 1
    If you are using Protégé 5, select the class `Fruit`. In the "Description" area, there must be a "General class axioms". Click on the circled + and add the following text in the newly opened box: `Fruit and (not ({apple})) SubClassOf inverse (loves) value bob`. Then hit OK. – Antoine Zimmermann Feb 09 '17 at 15:43
  • Thank you a lot! This led to the solution. One more question: So is it generally wrong to try to achieve this by adding a Type to an individual? – phil155 Feb 09 '17 at 15:54