9

I have a confusion about OWL class and subclass property inheritance. Some posts are saying there is no inheritance in OWL (OWL: How to get inheritance of property relations between two classes from those of superclasses?, http://answers.semanticweb.com/questions/619/rdfs-owl-inheritance-with-josekipellet). However, I have found some opposite discussion as well. For example "A Semantic Web Primer for Object-Oriented Software Developers" page (https://www.w3.org/TR/sw-oosd-primer/) mentioned that for both object-oriented language, OWL & RDF: "Classes can be arranged in a subclass hierarchy with inheritance" (section 3.3). https://www.w3.org/TR/rdf-schema/#ch_subclassof mentioned that "The property rdfs:subClassOf is an instance of rdf:Property that is used to state that all the instances of one class are instances of another." Hence, it is confusing to me. Now I have following questions:

  • Like object-oriented language, is rdfs:subclassOf inherits property from super class?
  • If not then

    • What is the meaning of inheritance in RDF/OWL?
    • Is it possible to construct object-oriented language type class-subclass inheritance with OWL/RDF?
    • Consider following example. Are all the properties of "Lecturer" and "Student" will be available to "Person" class?

      Example:
      --------
         ### Classes ###
       :CSModule rdf:type owl:Class ;
            rdfs:subClassOf :Module .
      
       :Lecturer rdf:type owl:Class ;
           rdfs:subClassOf :Person .
      
       :Student rdf:type owl:Class ;
          rdfs:subClassOf :Person .
      
       :Module rdf:type owl:Class .
      
       :Person rdf:type owl:Class .
      
      ### Object Properties ###
      
      :studies rdf:type owl:ObjectProperty ;
      
         rdfs:domain :Student ;
         rdfs:range :Module .
      
      :teaches rdf:type owl:ObjectProperty ;
      
         rdfs:domain :Lecturer ;
         rdfs:range :Module .
      
      ### Data properties ###
      
      :name rdf:type owl:DatatypeProperty ;
        rdfs:domain :Person ;
        rdfs:range xsd:string .
      
      :staffID rdf:type owl:DatatypeProperty ;
        rdfs:domain :Lecturer ;
        rdfs:range xsd:integer .
      
      :studentID rdf:type owl:DatatypeProperty ;
        rdfs:domain :Student ;
        rdfs:range xsd:integer .
      
      ### Individuals ###
      
      :CS101 rdf:type owl:NamedIndividual ,
       :CSModule .
      
      :Lecturer1 rdf:type owl:NamedIndividual ,
       :Lecturer ;
       :teaches :CS101 ;
       :name "Dr.John" ;
       :staffID 7777 .
      
      :Student1 rdf:type owl:NamedIndividual ,
       :Student ;
       :studies :CS101 ;
       :name "James" ;
       :studentID 1234 .
      

If someone provide me an answer with a good example that will be very helpful. Thank you in advance.

Stanislav Kralin
  • 10,115
  • 4
  • 30
  • 52
Beautiful Mind
  • 4,552
  • 4
  • 17
  • 32

2 Answers2

8

Like object-oriented language, is rdfs:subclassOf inherits property from super class?

To say that the domain of property p is the class D means that when you have a triple

x p y

you can infer the triple

x rdf:type D

There's no notion of inheritance of a property. If you know that E is a subclass of D, and you see the triples

e p y  
e rdf:type E  
E rdfs:subClassOf D

you now have two ways to know that e rdf:type D. The first is because e p y implies e rdf:type D. The second is because you know that e is an E and E is a subclass of D, e is also a D.

What is the meaning of inheritance in RDF/OWL?

Classes in RDF and OWL are sets. When you know that E is a subclass of D, it means that every element of E is an element of D; that is, the set of individuals of E is a subset of the set of individuals of D.

Similarly for properties. If q is a subproperty of p, it means that x q y implies x p y.

Is it possible to construct object-oriented language type class-subclass inheritance with OWL/RDF?

It's not really clear what you mean here. You'd need to specify exactly what you mean by OO-langueg type class-subclass inheritance. You get a lot of the same behaviors. E.g., if you know that every instance of D has a particular, then you know that every instance of E does, too, by virtue of the fact that every instance of E is an instance of D. E.g., if you have

D SubClassOf (hasColor some Color)

then you can infer that

E SubClassOf (hasColor some Color)

so in that sense there's inheritance.

Consider following example. Are all the properties of "Lecturer" and "Student" will be available to "Person" class?

"Available" might be misleading. There's no sense in which properties are available or not available to a class (i.e., to the individuals in a class). If you have a hierarchy like:

Lecturer rdfs:subClassOf Person  
teachesCourse rdfs:domain Lecturer
teachesCourse rdfs:range Course

that means that when you see a triple

Jones teachesCourse Calculus

you can infer that

Jones rdf:type Lecturer  
Jones rdf:type Person  
Calculus rdf:type Course

The property teachesCourse is "available" to every Person, in a sense, but as soon as it is used, it means that that Person must be a Lecturer. That's really pretty similar to what you'd have in an object oriented programming language, isn't it? E.g., if you have in Java:

class Person { }

class Lecturer {
  Course[] getCourses() { /* ... */ }
}

then there can be instances of Person that have a getCourses() method. It just happens that those instances of Person must be instances of Lecturer, too.

floatingpurr
  • 5,024
  • 5
  • 30
  • 79
Joshua Taylor
  • 80,876
  • 9
  • 135
  • 306
2

I'll try and answer some of your questions

What is the meaning of inheritance in RDF/OWL?
Inheritance in owl works a bit differently than it does in Object-Oriented languages. We can think of it in terms of set theory. Owl classes basically denote sets of individuals. Properties are then used to specify facts about individuals. So when you "define" a property on an owl class, you are basically saying that individuals of that class have that property (all or some depending on how a property was defined).
From the post you linked :
"Subclass denotes a class is a subset of another class, meaning that an implication (via inference) is that all members of a subclass are members of the (super)class"

Thus if you say a class is a subclass of another, it basically means that any properties on the individuals of the superclass(super-set) can be on individuals of the subclass(sub-set)

From your own example, you ask :
Are all the properties of "Lecturer" and "Student" will be available to "Person" class?
Well no, since you have defined Lecutrer and Student to be sub classes (sub-sets) of the class (set) Person. Basically, every Student or Lecturer is a Person but not vice-versa. Thus properties defined on Person can be used by Lecturer and Student.

Is it possible to construct object-oriented language type class-subclass inheritance with OWL/RDF
Well yes, but it is a bit difficult. This is all made a bit more murky because of the open world assumption.

Hopefully this clears up your confusion a bit. I would recommend playing with an ontology and reasoner to see how these assertions actually behave. There is a lot of interesting behavior (partially rooted in DL but mainly due to the open world assumption). Protege is an excellent tool for this.

Kunal Khaladkar
  • 463
  • 3
  • 16
  • 1
    I think the issue gets confused when one states that RDFS/OWL has any form of inheritance. It works by implication on set theory/predicate logic semantics. Some of these can be interpreted to be similar to inheritance in OO systems, but over time, in many settings, I have found it better to be clear that inheritance does not exist in RDFS/OWL and explain how sets, subsets, and standard reasoning profiles (the implications) work. – scotthenninger Jun 16 '16 at 16:51
  • Thanks for your answer. You mentioned that "Thus if you say a class is a subclass of another, it basically means that any properties on the individuals of the superclass(super-set) can be on individuals of the subclass(sub-set) ." However, @Joshua Taylor: said that "There's no notion of inheritance of a property." Isn't it contradictory? If I have a class called "Person" and it has two properties "age" and "address" and let say "Lecturer" is a subClassOf of "Person". Then properties "age" and "address" will be available to "Lecturer" like OO languages? – Beautiful Mind Jun 16 '16 at 17:03
  • 1
    No, the statements are not contradictory. A class definition of `:Person` with properties `:age` and `:address` will have no effect whatsoever on the instances of `:Person` and will not be available to `:Lecturer`. `:age` and `:address` will be available to the `:Person` class definition only. That is an essential difference between RDFS and OO programming languages. – scotthenninger Jun 16 '16 at 23:10
  • Actually, I suspect that "Thus if you say a class is a subclass of another, it basically means that any properties on the individuals of the superclass(super-set) can be on individuals of the subclass(sub-set) ." is a mis-quote or badly worded. Can you point to where I said this? – scotthenninger Jun 16 '16 at 23:22
  • Perhaps badly worded on my part, as Joshua mentions above there is no sense which properties are "available" to a class. If you create an individual of class Lecturer, you can infer that it is also an individual of Person. It is not inconsistent for you to then say that your individual can have "address" and "age". – Kunal Khaladkar Jun 17 '16 at 01:01
  • Keep in mind that owl classes are sets of things, data and object properties are just characteristics which define membership to a set. Saying a class (Lecturer) is a subclass of another (Person) is basically saying that class (Lecturer) is a subset of the other (Person) . So the elements of the subclass (Lecturer) will have the characteristics of the superclass (Person) because they are also members of the superclass. – Kunal Khaladkar Jun 17 '16 at 01:14
  • 1
    No. In RDFS and OWL class/subclass is about class membership (sets) only. There are no other semantics for rdfs:subClassOf. – scotthenninger Jun 17 '16 at 13:10
  • @scotthenninger: Thanks for your reply. My previous comment was about "Kunal Khaladkar " answer. Please check the following link (https://www.cambridgesemantics.com/semantic-university/rdfs-introduction). They have a discussion about "rdfs:subClassOf" with an example. Is it right or wrong? What do you think? – Beautiful Mind Jun 17 '16 at 18:28
  • Well, it's conflating a couple of things subclass and property domain/range. Note they move quickly to using `rdfs:domain` and that's where they get "inherit" properties. Basically, I'd say the section is not correct because the "inheritance" is only available through inference, not by RDFS assertions alone. ...and I would never say "inherit" when talking about RDFS classes. It just leads to misconceptions and confusion, and I suspect the section was written under the influence of such misconceptions. – scotthenninger Jun 17 '16 at 19:28