5

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

Wassadamo
  • 1,176
  • 12
  • 32
  • The full extent of my queries: https://stackoverflow.com/questions/51683587/trouble-inferring-properties-for-classes-individuals-in-protege-5-owl – Wassadamo Aug 05 '18 at 00:07
  • 2
    with that axiom you can't infer what you want. it just results in "kale" goes well with something that has taste something that is sweet. that must not necessary be the "pear". – UninformedUser Aug 05 '18 at 06:49
  • 1
    from my point of view, that can only work with SWRL as i) OWL class expressions do have a tree like structure only and ii) you don't have variables in OWL – UninformedUser Aug 05 '18 at 06:50
  • Is there a way to essentially "serialize" general axioms like this one in SWRL so that the desired inferences happen? I don't want my users to have to edit a long list of SWRL rules. I'd rather they specify all the good combinations they want in the ontology. – Wassadamo Aug 05 '18 at 21:09

2 Answers2

3

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.

Henriette Harmse
  • 4,167
  • 1
  • 13
  • 22
  • You say anonymous classes "will in general not form part of the reported inferences of a reasoner." Can you explain this a bit more? Restrictions that I subclass must be used when making inferences, yes? – Wassadamo Aug 05 '18 at 20:40
  • It's disappointing that an individual `kale a Kale` won't be inferred to have `hasTaste Bitter` or `hasTaste bitter` (where `bitter a Bitter`) -- despite these being necessary conditions for being a Kale. – Wassadamo Aug 05 '18 at 20:43
  • But Super Property Chaining `hasTaste` and maintaining food combinations is an excellent idea! Only downside of this approach is having to create an entity for every pair of ingredients (might even need triples, ..), like `PearKaleDelight`. This would make a user-facing taxonomy quite unwieldy. But I think I can manage that with some post-coordination and automate creation of those triples. – Wassadamo Aug 05 '18 at 20:48
  • 1
    The reason why reasoners do not report on anonymous classes is because there are an infinte number of them. I.e., if you have the inference 'A SubClassOf B' then 'A and X SubClassOf B and X' where 'X' is an arbitrary concept description, are also inferences. – Henriette Harmse Aug 05 '18 at 22:31
  • Where you have a named class for some complex concept description the reasonor may refer to the complex concept description rather than the named concept. I.e. 'PearKaleDelight' is classified as being a subclass of '(hasTaste some Bitter) and (hasTaste some Sweet)'. – Henriette Harmse Aug 05 '18 at 22:37
  • Yes, thank you. I appreciate this advice. I'll move my remaining concerns to a new question. – Wassadamo Aug 05 '18 at 22:47
  • 1
    I think you're trying too hard with classes. I know Protégé's interface is not the best for working with individuals, but when you'll move to real-world programming, all you'll ever deal with are individuals, not classes. – Richard-Degenne Aug 06 '18 at 12:26
  • 1
    @Richard-Degenne that is a viable solution that I acknowledged by upmarking even though the OP preferred using classes rather than individuals – Henriette Harmse Aug 06 '18 at 15:35
  • I have 3 solutions now, in fact. @HenrietteHarmse 's, Richard-Degenne 's, and my own via the goesWellWith composition. I love manipulating arrows this way. While SWRL rules seem the most expressive, I'm not sure they're the best for keeping this ontology read-write accessible to an average business user. Someone with domain knowledge should be able to simply describe what makes a good combination, or which properties go well together, and observe an inferred cascade of ingredient combinations. There will be further post-coordination via rdflib and data mining in python. – Wassadamo Aug 07 '18 at 00:59
2

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.

Richard-Degenne
  • 2,892
  • 2
  • 26
  • 43