owl - protege not inferring correctly? how to defi

2020-06-22 03:02发布

问题:

I have been stuck for two days now trying to understand why the following scenario isn't working:

screenshots here: http://dl.dropbox.com/u/4677548/screenshots.html

I have a VegetarianFood class (subclass of Food) that is equivalent to "Food and (Eggs or MilkAndDerivates or VeganFood)" as you can see in the screenshot number 1

The VeganFood class, on turn, is equivalent to other classes (NutsAndSeeds, Cereals, Fruit, etc...) screenshot 2

as you can see there are two individuals (cheddar cheese and cashew) created as MilkAndDerivates and NutsAndSeeds screenshot 3 and they are correctly inferred as VegetarianFood and VeganFood member

Then I created two individuals as recipes, one only with cashew (PastaVega) and one with both cheddar chese and cashew (PastaVege), using the object property hasIngredient screenshot 4 and 5

and they have been inferred as Recipe...BUT none falls into the category of VegatarianRecipe and VeganRecipe, defined as follows screenshot 6 and 7

I have no clues, Why they are not inferred as VegetarianRecipe (or vegan)??What am I missing?

Edit:

If I change VegetarianRecipe (or vegan) from "Recipe and (hasIngredient ONLY VegetarianFood)"

to "Recipe and (hasIngredient SOME VegetarianFood)"

screenshot 8

the recepies individuals are showed, but of course this is not what I am trying to do, as in this way it will include recipes with mixed meat and vegetarianFood. So how to define a vegetarianrecipe and veganrecipe class to allow the reasoner to infer correctly when a recipe is vegetarian or vegan????

回答1:

You have hit upon a consequence of the fact that OWL reasoning uses an open-world assumption.

The reason your PastaVege recipe is not inferred to be a VegetarianRecipe is that, although the ingredients that you explicitly list in the recipe are indeed all VegeratianFood instances, it could well be that some currently unknown ingredient of your recipe is not a vegetarian food.

Since your constraint on VegetarianRecipe is that all ingredients should be VegetarianFoods (not just the ones we currently know about), it cannot be definitively concluded (in an open world) that your recipe is indeed a VegetarianRecipe.

There are a number of ways to deal with this, but none really do exactly what you want - you need to approach it from a slightly different angle.

Without going into the exact modeling details: although it is quite difficult to infer if a recipe is vegetarian given your current model, it is relatively simple to infer if a recipe is not vegetarian; any recipe that has at least one non-vegetarian ingredient is a non-vegetarian recipe.

An alternative approach is that you create a closed set of (vegetarian) ingredients (using an OWL enumerated class via the oneOf constraint), but that is a significant change to your model, and of course it is tedious to have to list all possible ingredients in this fashion.