Search code examples
ontologyprotege

Protege ontology - can an individual reference a class?


Is there any way to have a property (on an individual) which is actually a reference to another class?

For example, in the sample Wine ontology (http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine), I'd like to specify a Wine property pairsWellWith which for a specific wine like LaneTannerPinotNoir, could refer to another class like RedMeat.

I want a reference from the Individual (LaneTannerPinotNoir) to a class like RedMeat -- not to an individual like Steak. A reference from one individual to another is trivial (Object Property).

I would like to do this without having to mess with the hierarchy. i.e.LaneTannerPinotNoir is NOT a RedMeat and therefore any solution that involves a polyhierarchy would likely be wrong.

Perhaps I could somehow infer all the possible individuals? That would be ok, too.


Solution

  • Imagine you are cooking a spicy roasted beaf with vegetables. Let's assume that you have a bottle of Lane Tanner Pinot Noir Julia's Vineyard 2006 in your cellar. You don't remember about this bottle and you'd like your digital wine pairing assistant to help you choose the right wine for the meal. The assistant knows about all the bottles you have in your cellar, and can access the neighbouring wine boutique's linked data to advise you what to buy.

    What you actually would like this tool to say is:

    lt:JuliaVineyard2006  onto:pairsWellWith  my:spicyRoastedBeef .
    

    knowing that:

    my:spicyRoastedBeef  a  onto:RedMeat .
    lt:JuliaVineyard2006  a  lt:PinotNoir .
    

    This is a situation where you would like the knowledge base to know that all LT's Pinot Noirs pair well with all red meat dishes. This can be said in OWL but it's not trivial. Fortunately, Lane Tanner's knowledge base has these axioms about its wines:

    ex:r1  a  owl:ObjectProperty .
    ex:r2  a  owl:ObjectProperty .
    onto:pairsWellWith  owl:propertyChainAxiom  ( ex:r1 ex:r2 ) .
    ex:a   a  owl:Thing .
    lt:PinotNoir  a  owl:Class;
       rdfs:subClassOf  [
          a  owl:Restriction;
          owl:onProperty  ex:r1;
          owl:someValuesFrom  [a owl:Class; owl:oneOf ( ex:a )]
       ] .
    onto:RedMeat  a  owl:Class;
       rdfs:subClassOf  [
          a  owl:Restriction;
          owl:onProperty  [owl:inverseOf ex:r2];
          owl:someValuesFrom  [a owl:Class; owl:oneOf ( ex:a )]
       ] .
    

    The assistant simply has to ask:

    SELECT ?wine WHERE {
       ?wine  onto:pairsWellWith  my:spicyRoastedBeef .
    }
    

    querying the right combination of data sources and applying the right reasoning. You'd get all the wines from your cellar that are fit for your meal, as well as suggestions to buy from the neighbouring shop.

    Edit after OP's comment: to make the ontology less expressive, it would also be possible to simply relate each individual wine to red meat (saying that the wine pairs well with all red meats, like so:

    onto:RedMeat  a  owl:Class;
        rdfs:subClassOf  [
            a  owl:Restriction;
            owl:onProperty  onto:pairsWellWith;
            owl:hasValue  lt:JuliaVineyard2006
        ] .
    

    You would have to do this with all wines that pair well with red meat.

    If you think this is still too expressive, you can also explicitly add explicitly all the pairs (wine,meal) that pair well together, which is efficient from the consumer's point of view but amounts to saying "f**k semantics" and putting a lot of overhead on the publisher's side.

    Another option is to ignore OWL alltogether and provide equivalent meaning with other techniques, such as rule-base reasoning. There is a standard for rule interchange (RIF), such that you can share your rule-ontology with the world, but RIF has not been very successful in its adoption, so most people/system would ignore it. Other non standard ways of defining rules exist, such as SWRL, SPIN, n3. The rule is fairly simple to express and reason with:

    ?x  a  lt:PinotNoir .
    ?y  a  onto:RedMeat .
    ----------------------------
    ?x  onto:pairsWellWith  ?y .
    

    There are other ways of relating an individual to a class, such as using an owl:AnnotationProperty or with punning. However, non of these techniques would convey the right semantics that you want.