Creating a Class Using a Metaclass

Note: Before you create and use metaclasses, you should be confident with the basic Protégé interface and be comfortable designing a project, and creating and modifying classes, slots, forms and instances.

Once you have added one or more metaclasses to your project, either by creating them directly, or by including a project that already has metaclasses, you can select the metaclass you want to use to create a class. When you create a class using a non-standard metaclass, the class is given the attributes specified by the selected metaclass. Unless you make changes, every new subclass you create for the class will also use the selected metaclass.

This example uses the wines project, which includes a Wine template that supplies metaclass structure. 

If you create a class using the Create button, you will use the metaclass of the direct superclass as the metaclass for the new class. Unless you have made changes, this is the default :STANDARD-CLASS.

To create a class using a non-standard metaclass:

  1. In the Class Relationship Pane, find the class that you want as the superclass of the new class. 
  2. Click the right mouse button and select "Create subclass using metaclass..." 
  3. A dialog box displays the Concrete metaclasses, which are the classes you can use when creating a class. You cannot create a class as an instance of an Abstract metaclass.
  4. Select the metaclass that has the properties that you want and click OK. 
    The new class will be added under the highlighted class. It will have the Class Form determined by the selected metaclass. The name of the metaclass you used is displayed at the top of the Class Form, immediately after the name of the class. The Class Form may include additional widgets that are not part of :STANDARD-CLASS.
  5. Use the Class Form to name the class, choose its role, create constraints, and create and edit slots. 

Next: Changing the Metaclass of a Class

Classes Table of Contents