PrF UG meta create class use meta

From Protege Wiki
Jump to: navigation, search

Creating a Class Using a Metaclass


Protege-Frames User's Guide
Metaclasses
Understanding Metaclasses
Example: Creating and Using a Metaclass
Looking at :STANDARD- CLASS
Creating a Metaclass
Creating a Class Using a Metaclass
Changing the Metaclass of a Class
Changing the Metaclass of Subclasses
Setting the Default Metaclass
Customizing the Class or Slot Editor
Understanding Slot Metaclasses
Creating a Slot Metaclass
Changing the Slot Metaclass of a Slot
Creating a Subslot Using a Slot Metaclass
Changing the Slot Metaclass of Subslots
Setting the Default Slot Metaclass
Glossary, Editing Help

If you have non-standard metaclasses in your project, you can select the metaclass you want to use when you create a class. You can add metaclasses either by creating them directly, or by including a project that already has metaclasses.

By default, when you create a class using the Create Class (classes_class.create) button, you 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.) If you have used a non-standard metaclass for a class, every new subclass you create for the class will also use the selected metaclass. When you create a class using a non-standard metaclass, the class is given the attributes specified by the selected metaclass.

To create a class using a specified metaclass:

  1. In the Class Browser, select the class that you want as the superclass of the new class.

    Class Browser, "White wine" selected
  2. Click the right mouse button and select "Create subclass using metaclass..."

    "Create subclass using ..." selected in menu
  3. A dialog box will display 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.

    [[Image:PrF_UG_meta_select_metaclass.png|frame|none| Select Metaclass dialog, "Wine template" selected]
  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 Editor from the selected metaclass, with entry fields determined by the template slots of the metaclass. In the Wineries example, there is an extra entry field called Best Wineries, displayed below the Template Slots pane in the Class Editor. The name of the metaclass you used will be displayed at the top of the Class Editor, immediately after the name of the class.

    Class Browser, "wines_Class_2" selected
  5. Use the Class Editor to name the class, choose its role, create constraints, and create and edit slots.