Difference between revisions of "PrF UG meta metaclass example"
(Automated import of articles) |
|||
Line 7: | Line 7: | ||
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>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> | ||
<li><p> | <li><p> | ||
− | [[PrF_UG_slots_create_slot|Create]] | + | [[PrF_UG_slots_create_slot|Create]] an additional template slot, |
− | + | <i>best wineries</i>, that allows you to enter a list of wineries. | |
− | <i>best wineries</i>, | ||
− | |||
</p> | </p> | ||
Line 48: | Line 39: | ||
<ul> | <ul> | ||
<li><p> | <li><p> | ||
− | Set the | + | Set the [[PrF_UG_slots_value_type_menu|Value Type]] |
− | + | to [[PrF_UG_slots_value_type_instance|Instance]], | |
− | to | ||
− | |||
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. |
− | |||
− | |||
</p> | </p> | ||
<li><p> | <li><p> | ||
− | Set the | + | Set the [[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> | ||
</ul> | </ul> | ||
<li><p> | <li><p> | ||
− | [[PrF_UG_slots_attach_slot|Attach]] | + | [[PrF_UG_slots_attach_slot|Attach]] <i>Best Wineries</i> |
− | + | 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> | ||
</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>, |
− | |||
− | |||
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, |
− | + | [[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 |
− | + | shows up as a new field (located at the lower left) in the Class Editor for your class. | |
− | When you do this, | ||
− | |||
− | |||
</p> | </p> | ||
+ | <div>[[Image:PrF_UG_meta_chardonnay.png|metaclasses_chardonnay]]</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> |
Revision as of 10:54, October 16, 2008
Example: Creating and Using 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. 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:
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.
Create an additional template slot, best wineries, that allows you to enter a list of wineries.
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.
Attach Best Wineries to Wine template as a template slot, if you have not already done so.
Using the Metaclass
Once you have created the metaclass, you can use it as follows:
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.
You can now use the Best Wineries field to select one or more wineries from your instances.