user3658799
user3658799

Reputation: 35

How do you add 2 subclassof's in an OWL class?

enter image description here

I'm trying to make a class statement for Canon Camera. But I don't know if 2 subclassOf statements are allowed in the Canon Camera class which points to both "Camera" and "Canon Product".

This is what I have so far:

<owl:Class rdf:ID=”product”>
    <rdfs:comment>Products form a class. </rdfs:comment>
</owl:Class>

<owl:Class rdf:ID=”Camera”>
    <rdfs:comment>Photography device</rdfs:comment>
    <rdfs:label>Device</rdfs:label>
    <rdfs:subClassOf rdf:resource=”#product”/>
</owl:Class>

<owl:Class rdf:ID=”Canon Product”>
    <rdfs:comment>A canon device</rdfs:comment>
    <rdfs:label>Device</rdfs:label>
    <rdfs:subClassOf rdf:resource=”#product”/>
</owl:Class>

I need to know if this is possible and correct:

<owl:Class rdf:ID="Canon Camera">
    <rdfs:comment>A canon camera</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#Canon Product"/>
    <rdfs:subClassOf rdf:resource="#Camera"/>
</owl:Class>

Thanks :)

Upvotes: 1

Views: 86

Answers (1)

Jeen Broekstra
Jeen Broekstra

Reputation: 22042

Apart from the fact that spaces are not legal characters in IRIs (so #Canon Product and Canon Camera are not syntactically legal identifiers), your example is fine. You've expressed an ontology in which every instance of Canon Camera is inferred to be an instance of both Canon Product and Camera.

Note, however, that what you have not captured is the reverse inference: your model does not express that everything that is both a "Camera" and a "Canon Product" is always a "Canon Camera".

If you want to capture this inverse relationship as well, you need to work with an OWL-specific construct, instead of just adding rdfs:subClassOf relations. One easy way to express it is using owl:intersectionOf, like this:

<owl:Class rdf:ID="CanonCamera">
    <rdfs:comment>A canon camera</rdfs:comment>
    <owl:intersectionOf rdf:parseType="Collection">
      <owl:Class rdf:about="#CanonProduct"/>
      <owl:Class rdf:about="#Camera"/>
    </owl:intersectionOf>
</owl:Class>

or using Turtle syntax (which is easier to read than RDF/XML):

  :CanonCamera a owl:Class ;
      owl:intersectionOf ( :CanonProduct :Camera ) .

This says that the class extension of :CanonCamera is exactly equal to the intersection of the class extensions of :CanonProduct and :Camera. In other words:

  1. all things which are both a :CanonProduct and a :Camera are inferred to be a :CanonCamera
  2. all things which are a :CanonCamera are inferred to be both a :CanonProduct and a :Camera

Upvotes: 2

Related Questions