2

Let's say for example:

-Food(class
 -Bread(instance of Food!
-Species(class
  -Animal(class
    - Horse(class
      -Unicorn(instance

Now I need to be able to set Bread -> eatableBy -> Horse. But I can't make a object property assertion to a class. So I could set it eatable by and add all the instances of Horse, but I have a lot of instances so that would be a bit redundant. Does anybody know a good efficient way to do achieve the same effect?

E.g. If I need to know what Horses can eat it needs to return Bread also. If I want to know all the food an Unicorn can eat, it needs to return Bread (because it's a horse and all horses eat bread). If I need to know what the subclasses of Animal eat, it also has to return Bread.

vincent kleine
  • 724
  • 1
  • 6
  • 22

1 Answers1

3

If I understand you correctly, you have an instance Bread and want to ensure that it is eatable by every instance of the class Horse. OWL has value restrictions which let you describe the set of individuals that stand in some relation to some particular value. E.g., the expression

        likes value Pizza

is the class of all individuals that like pizza. OWL also lets you use the inverse of properties, so that the expression

        inverse(likes) value Joe

is the class of all things that Joe likes. These class expressions can be used in axioms, including subclass axioms. In particular, you could say that

        Horse SubClassOf canEat value Bread

to say that every individual of type Horse can eat the individual Bread. Rather than a canEat property, though, you've got an eatableBy property. That's just the inverse of canEat, though, so you can say that every individual of type Horse can eat the individual Bread with the axiom:

        Horse SubClassOf inverse(eatableBy) value Bread

In Protégé, that looks like:

protege screenshot

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • Thanks for your reply. I set the subclass inverse rule but when querying uni:Horse canEat ?y gives no results. Also querying uni:Bread uni:eatableBy ?y gives no result. Tried it with SPARQL and Snap SPARQL – vincent kleine Mar 26 '15 at 12:29
  • @vincentkleine The axiom "Horse SubClassOf (eatableBy value Bread)" *does* say that Bread is eatableBy every instance of Horse, and a reasoner will be able to confirm that. So, a couple of questions: 1. Do you have any instances of Horse declared? 2. Do you have a reasoner enabled? 3. Does the SPARQL engine you're using include the results from reasoners? – Joshua Taylor Mar 26 '15 at 12:49
  • I was trying to query uni:Horse(class) uni:canEat ?y, I now see when I query uni:Unicorn(instance of horse) uni:canEat ?y does gives the right result. To determine what a Horse or Animal(superclass of Horse) can eat I just need to query what the instances of Horse, or the instances of the subclasses from Animal can eat. So thank you it works now! – vincent kleine Mar 26 '15 at 13:00
  • I would add the fact that eatableBy is likely not symmetric - I don't think bread is going to eat unicorns - is `Bread -> eatableBy(symmetric) -> Horse` a typo? – Ignazio Mar 27 '15 at 07:21