1

I've been searching around but couldn't find a good way to model the following, I have two classes in owl and one is the base class of the other:

:Base rdf:type owl:Class .
:Sub rdf:type owl:Class;
     rdfs:subClassOf :Base .
:hasDescription rdf:type owl:DatatypeProperty .

I want all instances of :Base to have a fixed description (:hasDescription "BASE"), and all instances of :Sub to have a different fixed description (:hasDescription "SUB"). But I want to avoid creating a triple for every instances such as

 :Base1 rdf:type :Base; 
       :hasDescription "BASE" .

I tried using owl:Restriction :

:Base rdf:type owl:Class .
      rdf:subClassOf [ rdf:type owl:Restriction ;
                              owl:onProperty :hasDescription ;
                              owl:hasValue "BASE"
                      ] .
:Sub rdf:type owl:Class;
     rdfs:subClassOf :Base ,
                     [ rdf:type owl:Restriction ;
                              owl:onProperty :hasDescription ;
                              owl:hasValue "SUB" 
                     ] .

but this wouldn't work because then :Sub would have both "BASE" and "SUB" as description since it's a subclass of :Base, which in turn is a subclass of the restriction with value "BASE". Anyone has any suggestion on how this can be done in owl? Thanks.

tarepanda
  • 13
  • 2

1 Answers1

0

I think that this is probably possible, but it highlight the differences between object oriented programming languages and the class hierarchies as present in OWL. They're very different things, and it might make sense to consider changing your model, because you may not find a satisfactory solution to this issue.

Every instance of a subclass is an instance of all of its ancestors. That's why if you assert something like

    Base SubClassOf (hasDescription value "BASE")

all the instances of the subclassses of Base will also have that value. (You already know that, of course; you described it in the question.)

You can say that instances of Base that are not instances of Sub have the value "BASE" and that instances of Sub have the value "SUB" with two axioms. One says that instances of Sub have the value "SUB" (you already know how to do this):

    Sub SubClassOf (hasDescription value "SUB")

To say that instances of Base that are not instances of Sub have the value "BASE", you use a general class axiom like:

    Base and (not Sub) SubClassOf (hasDescription value "BASE")

The process of creating general class axioms has been discussed in other questions and answers, and isn't difficult. See, e.g.:

The difficulty that you may run into is getting this axiom to be used. In general, when you assert that something is an instance of Base, you don't explicitly assert that it's not an instance of a subclass. That's a manifestation of the Open World Assumption: just because you don't know that something is true does not mean that you don't know that it's false.

You can do that, of course, by adding an additional type assertion to individuals. For instance, if x is a Base and not a Sub, you just need to say that:

    x : Base
    x : not Sub

Community
  • 1
  • 1
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353