Difference between revisions of "PrF UG meta metaclass example"

From Protege Wiki
Jump to: navigation, search
(Automated import of articles)
 
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
== Example: Creating and Using a Metaclass ==
 
== Example: Creating and Using a Metaclass ==
  
{{PrF_UG_TOC_meta}}<div id='prf_ug'>
+
<noinclude>{{PrF_UG_TOC_meta}}<div id='prf_ug'></noinclude>
  
 
This example gives an overview of how to create and use a metaclass.
 
This example gives an overview of how to create and use a metaclass.
  
 
Suppose you are creating a knowledge base of wines and wineries.
 
Suppose you are creating a knowledge base of wines and wineries.
In this knowledge base,
+
In this knowledge base, a type of wine, such as Chardonnay, is a class,
a type of wine,
 
such as Chardonnay,
 
is a class,
 
 
while a specific label is an instance of that class.
 
while a specific label is an instance of that class.
Suppose that,
+
Suppose that, for each class of wine,
for each class of wine,
+
you wanted to be able to enter the wineries that are, in your opinion,
you wanted to be able to enter the wineries that are,
 
in your opinion,
 
 
the best producers of that type of wine.
 
the best producers of that type of wine.
You could do this using metaclasses,
+
You could do this using metaclasses, as described below.
as described below.
 
  
 
=== Creating a Metaclass ===
 
=== Creating a Metaclass ===
  
First,
+
First, set up your metaclass:
set up your metaclass:
 
  
 
<ol class='a'>
 
<ol class='a'>
 
   <li><p>
 
   <li><p>
 
     [[PrF_UG_meta_metaclass_create|Create a metaclass]],
 
     [[PrF_UG_meta_metaclass_create|Create a metaclass]],
     <b>Wine Template,</b> to use for wines.
+
     <b>Wine Template</b>, to use for wines.
 
     You create this subordinate to <b>:STANDARD-CLASS</b>,
 
     You create this subordinate to <b>:STANDARD-CLASS</b>,
 
     so that it inherits all the structure of a typical class.
 
     so that it inherits all the structure of a typical class.
   
 
    </p><p> <div>[[Image:PrF_UG_meta_metaclass_hierarchy.png|metaclasses_metaclass_hierarchy]]</div>
 
 
     </p>
 
     </p>
 +
    <div>[[Image:PrF_UG_meta_metaclass_hierarchy.png|frame|none|
 +
          Class Browser, "Wine template" selected]]</div>
  
 
   <li><p>
 
   <li><p>
     [[PrF_UG_slots_create_slot|Create]]
+
     [[PrF_UG_slots_create_slot|Create]] an additional template slot,
    an additional template slot,
+
     <i>best wineries</i>, that allows you to enter a list of wineries.
     <i>best wineries</i>,
 
    that allows you to enter a list of wineries.
 
 
     </p>
 
     </p>
  
Line 48: Line 39:
 
   <ul>
 
   <ul>
 
     <li><p>
 
     <li><p>
       Set the
+
       Set the [[PrF_UG_slots_value_type_menu|Value Type]]
      [[PrF_UG_slots_value_type_menu|Value Type]]
+
       to [[PrF_UG_slots_value_type_instance|Instance]],
       to
 
      [[PrF_UG_slots_value_type_instance|Instance]],
 
 
       so that the values of this slot can be instances in the knowledge base.
 
       so that the values of this slot can be instances in the knowledge base.
 
       </p>
 
       </p>
Line 57: Line 46:
 
     <li><p>
 
     <li><p>
 
       Set the <b>Allowed Classes</b> to <b>Winery</b>,
 
       Set the <b>Allowed Classes</b> to <b>Winery</b>,
       so that,
+
       so that, specifically, these instances are wineries.
      specifically,
 
      these instances are wineries.
 
 
       </p>
 
       </p>
 
    
 
    
 
     <li><p>
 
     <li><p>
       Set the
+
       Set the [[PrF_UG_slots_slot_editor#Cardinality|Cardinality]]
      [[PrF_UG_slots_slot_editor#Cardinality|Cardinality]]
 
 
       to <b>Multiple</b> to allow more than one winery on the list for each class.
 
       to <b>Multiple</b> to allow more than one winery on the list for each class.
      </p><p> <div>[[Image:PrF_UG_meta_best_wineries_slot.png|metaclasses_best_wineries_slot]]</div>
 
 
       </p>
 
       </p>
 +
      <div>[[Image:PrF_UG_meta_best_wineries_slot.png|frame|none|
 +
          Template Slots, configured]]</div>
 
   </ul>
 
   </ul>
  
 
   <li><p>
 
   <li><p>
     [[PrF_UG_slots_attach_slot|Attach]]
+
     [[PrF_UG_slots_attach_slot|Attach]] <i>Best Wineries</i>
    <i>Best Wineries</i> to <b>Wine template</b> as a <b>template slot</b>,
+
    to <b>Wine template</b> as a <b>template slot</b>,
 
     if you have not already done so.
 
     if you have not already done so.
   
 
    </p><p> <div>[[Image:PrF_UG_meta_wine_template.png|metaclasses_wine_template]]</div>
 
 
     </p>
 
     </p>
 +
    <div>[[Image:PrF_UG_meta_wine_template.png|frame|none|
 +
          Wine template instance dialog]]</div>
 
</ol>
 
</ol>
  
 
=== Using the Metaclass ===
 
=== Using the Metaclass ===
  
Once you have created the metaclass,
+
Once you have created the metaclass, you can use it as follows:
you can use it as follows:
 
  
 
<ol class='a'>
 
<ol class='a'>
 
   <li><p>
 
   <li><p>
     [[PrF_UG_meta_create_class_use_meta|Create]]
+
     [[PrF_UG_meta_create_class_use_meta|Create]] a class, such as <b>Chardonnay</b>,
    a class,
 
    such as <b>Chardonnay</b>,
 
 
     using <b>Wine template</b> as the metaclass.
 
     using <b>Wine template</b> as the metaclass.
     Or,
+
     Or, if you have already created the classes for your wines,
    if you have already created the classes for your wines,
+
     [[PrF_UG_meta_change_meta_sub|change the metaclass]] to <b>Wine template</b>.
     [[PrF_UG_meta_change_meta_sub|change the metaclass]]
+
     When you do this, the <i>best wineries</i> slot that you attached to the template
    to <b>Wine template</b>.
+
    shows up as a new field (located at the lower left) in the Class Editor for your class.
     When you do this,
 
    the <i>best wineries</i> 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.
 
    </p><p> <div>[[Image:PrF_UG_meta_chardonnay.png|metaclasses_chardonnay]]</div>
 
 
     </p>
 
     </p>
 +
    <div>[[Image:PrF_UG_meta_chardonnay.png|frame|none|
 +
          Chardonnay instance dialog]]</div>
  
 
   <li><p>
 
   <li><p>
     You can now use the <b>Best Wineries</b> field to select one or more wineries from your instances.
+
     You can now use the <b>Best Wineries</b> field
 +
    to select one or more wineries from your instances.
 
     </p>
 
     </p>
 
</ol>
 
</ol>
  
  
</div>
+
<noinclude></div></noinclude>

Latest revision as of 17:27, November 13, 2008

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.