![]() |
| Previous Top Next |
Creating the Class Hierarchy |
In this section, you will learn how the three classes (Product, XMLSpy, and Edition) created in the previous section can be linked in a simple hierarchy. What we wish to do is:
| • | Define XMLSpy as a subclass of Product, which essentially states that any instance of the XMLSpy class must also be an instance of the Product class. |
| • | Use the Edition class to (i) define it as the range of a property called prod:hasEdition, and (ii) create instances of Edition. |
Creating a class as a subclass of another
To create the class XMLSpy as a subclass of the class Product, do the following:
| 1. | In the Classes tab of RDF/OWL View, click the Detail View button of the prod:XMLSpy class (screenshot below). |

This switches the view to the Detail View of the XMLSpy class (screenshot below). Notice the shape of the classes box. All classes in Detail View are indicated by this arbitrary-hexagon-shaped box.

| 2. | In Detail View, right-click the prod:XMLSpy classes box. This pops up a context menu (screenshot below). |

| 3. | Select Add subClassOf from the context menu. This adds a subClassOf connector to the prod:XMLSpy box (screenshot below). |

| 4. | Right-click the subClassOf connector, and, in the context menu that appears, select Add Class (screenshot below). |

A class box is added that is linked to the subClassOf connector (screenshot below), indicating that the class represented by this class box is a subclass of the XMLSpy class.
| 5. | To select which class this class box represents, click the downward-pointing arrow at the right-hand side of the class box. This drops down a list of available classes (screenshot below). |

Notice that the set of available classes consists of the classes you have declared in this ontology plus the two general OWL classes Thing and Nothing.
| 6. | Select prod:Product from the dropdown list to complete the definition (screenshot below). |

The diagonal arrow at bottom left of the Product class box indicates that the box is a reference to the class Product.
Having carried out the steps above, you have defined that the class XMLSpy is a subclass of the class Product. Now do the following:
| • | Check the Text View to see the RDF/XML serialization of your new definition. |
| • | Check the syntax and semantics of the modified ontology. Both syntax and semantics checks should return positive results. |
Relating a class to its properties and instances
In the steps above, you have learned how to define relationships between two classes. In SemanticWorks, relationships between classes are defined in the Detail View of the appropriate class. To define a relationship between a class and its property (for example, the domain and range of a property), the definition is made on the property. Similarly, the definition that an instance is an instance of a particular class is made on the instance.
In this tutorial, we wish to do the following:
| • | Define the class XMLSpy to be the domain of the property hasEdition, and the class Edition to be the range of the property hasEdition. This would mean that the property hasEdition applies to the class XMLSpy and takes values that are instance of the class Edition. |
| • | Declare instances of the class Edition. |
These property definitions and instance declarations are made in the following sections.
|