PrF UG meta metaclass example

From Protege Wiki
Jump to: navigation, search

Example: Creating and 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

This example gives an overview of how to create and use a metaclass.

Suppose you are creating a knowledge base of wines and wineries. In this knowledge base, a type of wine, such as Chardonnay, is a class, while a specific label is an instance of that class. Suppose that, for each class of wine, you wanted to be able to enter the wineries that are, in your opinion, the best producers of that type of wine. You could do this using metaclasses, as described below.

Creating a Metaclass

First, set up your metaclass:

  1. Create a metaclass, Wine Template, to use for wines. You create this subordinate to :STANDARD-CLASS, so that it inherits all the structure of a typical class.

    Class Browser, "Wine template" selected
  2. Create an additional template slot, best wineries, that allows you to enter a list of wineries.

  3. Configure best wineries as follows:

    • Set the Value Type to Instance, so that the values of this slot can be instances in the knowledge base.

    • Set the Allowed Classes to Winery, so that, specifically, these instances are wineries.

    • Set the Cardinality to Multiple to allow more than one winery on the list for each class.

      Template Slots, configured
  4. Attach Best Wineries to Wine template as a template slot, if you have not already done so.

    Wine template instance dialog

Using the Metaclass

Once you have created the metaclass, you can use it as follows:

  1. Create a class, such as Chardonnay, using Wine template as the metaclass. Or, if you have already created the classes for your wines, change the metaclass to Wine template. When you do this, the best wineries slot that you attached to the template shows up as a new field (located at the lower left) in the Class Editor for your class.

    Chardonnay instance dialog
  2. You can now use the Best Wineries field to select one or more wineries from your instances.