Search code examples
logicsemantic-webowl

Blank nodes in class definition for enforcing identity


I hope the question is not trivial, I spent a decent amount of time looking for an answer around. I am creating an ontology in OWL and I've been trying to enforce a particular constraint into a class description but not being able to do it with the tools provided by OWL and resorted to blank nodes as existential variables in the description of the class. Protege5 did not like it a bit. I'd like to model classes of spaces and movements from one space to another, and in particular I'd like to model a movement that has as a target the same space as the starting space. In logic I'd describe my InternalMovement class as:

InternalMovement = forall ?x exist ?y (Movement(?x) ^ space(?x,?y) ^ direction(?x,?y))

In OWL variables do not exist and enforcing the identity of a blank nodes throughout a class description doesn't seem possible. I resorted to blank nodes because they should be treated as existential variables and I hope using blank nodes ids would do the trick. I was wrong and I don't know how to model this simple class. The Turtle snippet is this:

:Movement rdf:type owl:Class .
:Space rdf:type owl:Class .

:direction rdf:type owl:FunctionalProperty ,
     owl:ObjectProperty ;
     rdfs:domain :Movement ;
     rdfs:range :Space .

:space rdf:type owl:FunctionalProperty ,
     owl:ObjectProperty ;
     rdfs:domain :Movement ;
     rdfs:range :Space .

:InternalMovement rdf:type owl:Class ;
    owl:equivalentClass [ rdf:type owl:Class ;
       owl:intersectionOf ( :Movement
          [ rdf:type owl:Restriction ;
            owl:onProperty :space ;
            owl:hasValue _:sp1
          ]
          [ rdf:type owl:Restriction ;
            owl:onProperty :target ;
            owl:hasValue _:sp1
          ]
        )
 ] . 

I would expect that the following individual would be classified as InternalMovement, but obviously it doesn't.

:internalmovement rdf:type :Movement ,
  :space :room1 ;
  :direction :room1 .

:room1 rdf:type :Space.

Can anyone help me, please? Thanks


Solution

  • It sounds like what you want is to define a class by specifying that it has the same value for two particular properties. If OWL supported property intersection (some description logics do), then you could write

    InternalMovement ≡ ∃(space ⊓ direction)

    Unfortunately, OWL doesn't have this. However, you could define a property that is a subproperty of both space and target and use that. That is:

    spaceAndDirection ⊑ space
    spaceAndDirection ⊑ target
    InternalMovement ≡ ∃spaceAndDirection

    This means that if x is an InternalMovement, then there exists a y such that spaceAndDirection(x,y), and then from the subproperty axioms, we may infer space(x,y) and direction(x,y).

    That will take care of some of what you want, but not all of it. If you just know that some movement x has some y as a space and as a direction, you still can't infer spaceAndDirection(x,y), and so you can't infer that x is an InternalMovement.

    If you add cardinality axioms that a movement has exactly one space and exactly one direction, then you can ensure that if x has y as its space and direction, then if it has a spaceAndDirection value, then that value must be y.

    If you also add the (min or exact) cardinality axiom that InternalMovement has (at least or exactly) one spaceAndDirection value, then if x is an InternalModement, then from any two of the following, you can infer the third:

    1. space(x,y)
      • Since x is an InternalMovement, it must have a spaceAndDirection value. Call it z. Then spaceAndDirection(x,z). Then, since spaceAndDirection is a subproperty of space and direction, we also have space(x,z) and direction(x,z). Since x is a Movement, it has exactly one space value, so y = z. Then we also have direction(x,y) and spaceAndDirection(x,y).
    2. direction(x,y)
      • Analogous to above.
    3. spaceAndDirection(x,y)
      • Since spaceAndDirection is a subproperty of space and direction, we immediately have space(x,y) and direction(x,y).