owlontologyprotegedescription-logic

Adding statements of knowledge to an OWL Ontology in Protege)


In my Ontology I have three classes, Player, Team, and Competition. I also have the two object properties, employs, and competesIn. The domain of employs is Team, and the range Player, the domain of competesIn is Team or Player and the range Competition.

I want the Ontology to infer that if a Player is employed by a Team and that Team competes in a Competition then the Player also competes in that Competition. Is there any way to add this information to an Ontology without putting in the {Player} competesIn {Competition} for every single individual in the ontology?


Solution

  • First, it would be easier to answer this if you had provided the minimal ontology as a starting point. Fortunately, it's pretty simple. Here it is in the Turtle serialization:

    @prefix :      <https://stackoverflow.com/q/22688901/1281433/competitions#> .
    @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix owl:   <http://www.w3.org/2002/07/owl#> .
    @prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
    @prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    
    <https://stackoverflow.com/q/22688901/1281433/competitions>
            a       owl:Ontology .
    
    :Player  a      owl:Class .
    :Team   a       owl:Class .
    :Competition  a  owl:Class .
    
    :employs  a          owl:ObjectProperty ;
            rdfs:domain  :Team ;
            rdfs:range   :Player .
    
    :competesIn  a       owl:ObjectProperty ;
            rdfs:domain  [ a            owl:Class ;
                           owl:unionOf  ( :Player :Team )
                         ] ;
            rdfs:range   :Competition .
    

    We don't actually need the domain and range declarations on the property to make this work, but I've included them anyway, since you mentioned them. You're trying to express the statement that “If team employs a player and the team competes in a competition, then the player competes in the competition.” Logically, we can represent that as:

    employs(?team,?player) ∧ competesIn(?team,?competition) → competesIn(?player,?competition)

    It's useful to draw a picture of what the relations that we have are, and what we'd like to get:

    enter image description here

    The solid arrows are what we actually have, and the dashed arrow is what we'd like to infer. We can do this using a subproperty chain in OWL. There's path, or chain of properties, from ?player to ?competiton along the solid arrows. The first edge of the path follows an arrow in reverse direction, so it's an inverse property (employs-1), and the second edge follows an arrow in the forward direction, it's simply competesIn. We're trying to say that wherever there's such a path, there's competesIn relationship between the beginning and end of the path. The chain is written as “employs-1 • competesIn” and we want to assert that it's a subproperty of competesIn:

    employs-1 • competesIn ⊑ competesIn

    In Protégé, this looks like this:

    enter image description here

    This leaves us with the final ontology:

    @prefix :      <https://stackoverflow.com/q/22688901/1281433/competitions#> .
    @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix owl:   <http://www.w3.org/2002/07/owl#> .
    @prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
    @prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    
    :Player  a      owl:Class .
    :Team   a       owl:Class .
    :Competition  a  owl:Class .
    
    <https://stackoverflow.com/q/22688901/1281433/competitions>
            a       owl:Ontology .
    
    :employs  a          owl:ObjectProperty ;
            rdfs:domain  :Team ;
            rdfs:range   :Player .
    
    :competesIn  a                  owl:ObjectProperty ;
            rdfs:domain             [ a            owl:Class ;
                                      owl:unionOf  ( :Player :Team )
                                    ] ;
            rdfs:range              :Competition ;
            owl:propertyChainAxiom  ( [ owl:inverseOf
                              :employs ] :competesIn ) .
    

    Restricting the subjects that this applies to

    It wasn't mentioned in the original question, but was revealed in the comments that things other than Players can can be employed by a Team, and some of those things should not be inferred to compete in a competition. This can still be handled, but it gets a little bit more complete. The trick is to realize that you need a new axiom of the form:

    p • employs-1 • competesIn ⊑ competesIn

    where p is some special property that relates each player to himself or herself. Constructing such a property is is called rolification. That technique has been described in some detail in another Stack Overflow question, OWL 2 rolification, as well as the academic publication that's linked from that question. There are some other answers on Stack Overflow that involve rolification, too. There are also some on answers.semanticweb.com. At any rate, the idea is to define a new property, RPlayer corresponding to the class, and to define the class Player with the axiom:

    Player ≡ RPlayer some Self

    This says that x is a Player if and only if RPlayer(x,x), and that's exactly the property that we need to fill in for p. This gives us the following ontology:

    @prefix :      <https://stackoverflow.com/q/22688901/1281433/competitions#> .
    @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix owl:   <http://www.w3.org/2002/07/owl#> .
    @prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
    @prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    
    <https://stackoverflow.com/q/22688901/1281433/competitions>
            a       owl:Ontology .
    
    :R_Player  a    owl:ObjectProperty .
    
    :employs  a          owl:ObjectProperty ;
            rdfs:domain  :Team ;
            rdfs:range   :Player .
    
    :competesIn  a                  owl:ObjectProperty ;
            rdfs:domain             [ a            owl:Class ;
                                      owl:unionOf  ( :Player :Team )
                                    ] ;
            rdfs:range              :Competition ;
            owl:propertyChainAxiom  ( :R_Player [ owl:inverseOf
                              :employs ] :competesIn ) .
    
    :Team   a       owl:Class .
    
    :Competition  a  owl:Class .
    
    :Player  a                   owl:Class ;
            owl:equivalentClass  [ a               owl:Restriction ;
                                   owl:hasSelf     true ;
                                   owl:onProperty  :R_Player
                                 ] .