Inference on Complex Classes in Protege

2019-06-27 09:28发布

I want to make inferences such as the property represented by the grey-dotted line in this diagram:

kale goes well with pear because it tastes bitter which complements pear's sweet

I have asserted a general axiom:

(hasTaste some Bitter) SubClassOf: goesWellWith some (hasTaste some Sweet)

where 'bitter' is of type Bitter and 'sweet' is of type Sweet.

I thought owl:someValuesFrom (or Manchester's "some") meant that at least one such relation must exist. Yet this does not happen after making the bold diagram assertions and the general axiom.

How can I make this work?

EDIT (Edit 2, I figured it out)

I just thought of a super-property chain that works! I just specify

hasTaste o complements o isTasteOf

as a super property chain of goesWellWith. In fact, by making hasTaste, hasTexture, etc...all sub-properties of of a general hasTrait, then I can replace hasTaste and isTasteOf with hasTrait and isTraitOf, respectively:

hasTrait o complements o isTraitOf

The result captures every permutation of food properties complementing each other.

enter image description here

2条回答
在下西门庆
2楼-- · 2019-06-27 09:48

In answering you question I will (1) explain why your approach fails and (2) provide a possible solution.

Why your approach fails

Reasoners in genereal only give feedback on inferences based on named classes, not anonymous classes. In your example (hasTaste some XXX) and goesWellWith some (hasTaste some YYY) are anonymous classes and therefore they will in general not form part of the reported inferences of a reasoner.

A possible solution

ObjectProperty: hasIngredient
    Characteristics: Transitive
    Domain: 
        FoodCombination    
    Range: 
        Food       

ObjectProperty: hasTaste
    SubPropertyChain: 
        hasIngredient o hasTaste
    Characteristics: 
        Transitive
    Domain: 
        Food
    Range: 
        Taste

Class: Bitter
    SubClassOf: 
        Taste

Class: BitterSweetCombination
    EquivalentTo: 
        (hasTaste some Bitter)
         and (hasTaste some Sweet)
    SubClassOf: 
        TastyCombination

Class: CulinaryDish
    SubClassOf: 
        FoodCombination

Class: DespicableCombination
    SubClassOf: 
        FoodCombination

Class: Food
    DisjointWith: 
        Taste

Class: FoodCombination
    SubClassOf: 
        Food
    DisjointUnionOf: 
        DespicableCombination, TastyCombination

Class: Kale
    SubClassOf: 
        Food,
        hasTaste some Bitter
    DisjointWith: 
        Pear

Class: Pear
    SubClassOf: 
        Food,
        hasTaste some Sweet
    DisjointWith: 
        Kale

Class: PearKaleDelight
    SubClassOf: 
        CulinaryDish,
        hasIngredient some Kale,
        hasIngredient some Pear

Class: Sweet
    SubClassOf: 
        Taste

Class: Taste
    DisjointUnionOf: 
        Bitter, Sweet
    DisjointWith: 
        Food

Class: TastyCombination
    SubClassOf: 
        FoodCombination

This ontology will classify the PearKaleDelight class as being a subclass of BitterSweetCombination.

查看更多
淡お忘
3楼-- · 2019-06-27 10:01

OWL is great for making inferences about ontologies themselves: classes, subclasses, properties, symmetry, reflexivity... When describing domain knowledge (such as food associations in your example), you'll be far better off working with custom inferences.

I suggest you took a look at SWRL to learn how to write such inference rules.


TL;DR

Keep your ontology as simple as possible. The ontology (almost) only describes the structure of your domain's knowledge. Inferences that don't affect the knowledge structure itself should be stored as separate rules.


Here, you'll find an onotology I've written to answer your example.

The ontology holds two classes:

  • Ingredient
  • Taste

I've created three object properties:

  • tastes: Links an Ingredient to its Taste;
  • complements: Symmetric, links two Tastes together;
  • goesWellWith: Symmetric, links to Ingredients together.

I've also created individuals just like in your example.

  • sweet and bitter: Two Tastes that complements each other;
  • pear: An Ingredient which tastes sweet;
  • kale: An Ingredient which tastes bitter.

Go to "Window" > "Tabs", and check "SWRLTab", then go to the newly created "SWRLTab".

The SWRL tab

You'll see that my ontology also includes a SWRL rule, which looks like

tastes(?ingredient1, ?taste1) ^ tastes(?ingredient2, ?taste2) ^ complements(?taste1, ?taste2) -> goesWellWith(?ingredient1, ?ingredient2)

So, what does that mean?

Given the following conditions are present:

  • ingredient1 tastes taste1
  • ingredient2 tastes taste2
  • taste1 complements taste2

Then infer the following triple:

  • ingredient1 goesWellWith ingredient2

And there you have it. Go back to the "Entities" > "Individuals" tabs, click on pear and start the reasoner.

The inferred statement

As you can see, the reasoner has successfully inferred that pear goesWellWith kale (and vice versa). You can click on the question mark icon next to the statement to see how the reasoner was able to infer the statement.

查看更多
登录 后发表回答