PrF UG inst all
Contents
- 1 Instances
- 1.1 The Instances Tab
- 1.2 The Class Browser at the Instances Tab
- 1.3 The Instance Browser
- 1.4 The Instances Window
- 1.5 The Instance Buttons
- 1.6 The Instance Menu
- 1.7 The Types Pane
- 1.8 The Instance Editor
- 1.9 The Standard Field Types
- 1.10 Fields with Multiple Cardinality
- 1.11 The Boolean Fields
- 1.12 The Class Fields
- 1.13 The Float Fields
- 1.14 The Instance Fields
- 1.15 The Integer Fields
- 1.16 The String Fields
- 1.17 The Symbol Fields
- 1.18 Creating an Instance
- 1.19 Creating Multiple Instances
- 1.20 Displaying the Instance Editor
- 1.21 Setting the Display Slot
- 1.22 Showing Subclass Instances
- 1.23 Editing an Instance
- 1.24 Copying an Instance
- 1.25 Deleting an Instance
- 1.26 Finding an Instance
- 1.27 Changing the Class of an Instance
- 1.28 Working with Instance Types
- 1.29 The Instance Icons
Instances
This section of the User's Guide covers the concepts of understanding, creating, and using Protege-Frames instances.
Note: Before you create and use classes, you should be confident with the basic Protege-Frames interface. You should also be comfortable with Protege-Frames projects, project types, windows, classes, slots, and forms.
To return to the main table of contents, click the Protege-Frames User's Guide link (located at the top of the table of contents on the right-hand side of this page).
The Instances Tab
The Instances tab provides a window in which you may view, create, and edit instances. (Classes model concepts in your domain, slots model properties of classes and any relationships between them, and instances model the actual data.)
An example of the Instances tab is shown below. The window consists of three panes:
The Class Browser, at the left, shows the classes in a superclass/subclass relationship. The Instances tab lets you view classes, but you cannot edit or rearrange them. See the Classes tab for information about working with classes.
The Instance Browser, in the center, shows all of the direct instances, if any, for the selected class. It allows you to view, edit, create, and delete direct instances.
When a single instance is selected, the Instance Editor for the selected instance is displayed to the right. The Instance Editor displays all the slots which apply to the instance, and allows you to edit them. The Instance Editor can also be displayed as a separate window by clicking the View Instance () button in the Instance Browser or anywhere else it appears.
The Class Browser at the Instances Tab
The Class Browser at the Instances tab shows the classes in your knowledge base in a superclass/subclass relationship. When a class with instances is selected, its instances are shown in the Instance Browser to the right. By navigating through the classes, you can select the class whose instances you wish to see.
Parenthesized numbers to the right of a class give information about the number of direct instances that class has. For example, Editor has four instances. If no number is displayed, the class does not have any instances.
This window is similar to the standard Class Browser, but you cannot change the hierarchy or add or delete classes. Therefore, there are a number of options that are not available at the Instances tab.
Note: You can choose to have Protege-Frames always highlight the class that is currently selected in the Classes tab. To do this, select Windows | Automatically Synchronize Class Trees. See Synchronizing Class Trees for more information.
The Instance Browser
The Instance Browser shows all the instances, if any, for the class selected in the Class Browser at the Instances tab. It also allows you to view, edit, create, and delete instances. If the class you want is not currently displayed, you may need to navigate to it via the class hierarchy.
Note: To ensure that the class is the same as the last class selected at the Classes tab, you can synchronize class trees.
A direct instance is an instance that has been created directly under the class. However, because of inheritance, an instance of a class is also an instance of all that class's superclasses. Therefore, an instance can be an instance of many classes of which it is not a direct instance.
This pane has the following components:
The Instance buttons allow you to edit, view references to, create, copy, and delete instances.
The Instance menu allows you to control the text that is displayed in the Instance window.
The Instances window displays an alphabetical list of the instances for the selected class.
The Instance search bar allows you to find an instance in the Instance Browser, by typing the instance name and clicking the Search for Instance () button.
The Types pane allows you to assign a single instance to multiple classes.
The Instances Window
When a single class is selected in the Class Browser at the Instances tab, the Instances window shows all of the instances belonging to that class.
The Instances window shows the following information:
Instances are displayed by the text in the display slot, which is the slot that has been designated as the identifying slot for the class. If no display slot has been selected, Protege-Frames uses a default display slot, <instance name>, which is displayed as a number, such as newspaper_0017. See The Display Slot menu for more information.
When a single instance is selected, the information for that instance is shown in the Instance Editor, to the right.
When Show Subclass Instances is selected from the Instance menu, all instances (not just direct instances) are shown for the selected class; the class where the instance was created is shown in parentheses, to the right of the instance name.
The color of the icon to the left of the instance name gives information about the instance:
The instance can be edited. You can enter your edits directly to the right, or click the View Instance () button to open the Instance Editor. | |
The instance cannot be edited. Instances cannot be edited if they are included from another project. See Including a Project for more information. |
The Instance Buttons
The Instance buttons, located at the top right of the Instance Browser, allow you to view/edit, view references to, create, copy, or delete an instance. Note that these icons have a similar action wherever they appear.
The buttons have the following actions:
View Instance: Opens the Instance Editor for the highlighted instance. See Displaying an Instance. | |
View References to Instance: Shows all the objects that reference the highlighted instance. See Viewing References. | |
Create Instance: Creates a new instance for the class highlighted in the Class Browser at the Instances tab. See Creating an Instance Directly. | |
Copy Instance: Copies the selected instance. See Copying an Instance. | |
Delete Instance button: Deletes the highlighted instance. See Deleting an Instance. |
If the View Instance or Delete Instance button is grayed out, this indicates that the current instance cannot be edited or deleted. Such an instance always has a pale icon to its left. Instances cannot be edited if they are included from another project.
If the Create Instance button is grayed out, no instances can be created for the class selected in the Class Browser. This is the case if the class is abstract, shown by a class icon with a hole (e.g., , ).
Additional Buttons
The buttons above have the same operation wherever they appear. Additional buttons in the Protege-Frames interface allow you to add and remove the instances specified for a relationship.
Add Instance: Displays a dialog box that allows you to select one or more existing instances. | |
Remove Instance: Removes the instance from the current relationship without deleting it from the knowledge base. |
The Instance Menu
The Instance menu is located to the right of the Instance buttons, at the top of the Instance Browser.
The Instance menu allows you to control the display of instances in the Instance window:
Set the Display Slot: selects which slot(s) are used to list instances in the Instance Browser.
Show Subclass Instances: when selected (shown with a check), all instances subordinate to a class (including instances of subclasses) will be shown in the Instance window. When deselected (as above), only direct instances are shown.
The Types Pane
The Types pane in the Instance Browser allows you to add and remove class types for an instance, that is, the classes for which the selected instance is a direct instance. A multi-type instance is shown in the Instance Browser whenever one of its class types is selected.
Multi-type Instances
Assigning multiple types to an instance allows you to build an instance which combines the field characteristics from two or more classes. For a multi-type instance, the Instance Editor for an instance shows a separate entry form for each class type; these forms can be shown one above the other in the same window or they can be shown in individual tabs. If two or more classes share a slot, the value entered in a shared field is the same for all class forms.
Type Buttons
Add Class: Displays a dialog box that allows you to select one or more additional class types. | |
Remove Class: Removes the direct instance relationship between the instance and the class. If the instance has only one class type, the relationship cannot be removed. |
See Working with Instance Types for more information.
The Instance Editor
The Instance Editor can be used to define and edit the slot attributes of the instance selected in the Instance Browser. If a single class is selected in the Class Browser at the Instances tab, the Instance Editor is displayed at the right of the Instances tab. To ensure that the class is the same one that was selected at the Classes tab, you can synchronize class trees.
The Instance Editor is also displayed separately in a free-standing window whenever you click on the View Instance () button in the Instance Browser or anywhere else it appears.
Protege-Frames automatically creates an initial layout of the Instance Editor for you, based on the slots and slot types of the class. You can customize the Instance Editor for a class, using the Forms tab.
Whenever you enter changes into the Instance Editor, they take effect immediately. To save the changes to disk, select Save from the Project menu.
Note Icons
The note icons (, , ) at the upper right of the form, allow you to hide, add, and remove yellow sticky notes. The note, which is not part of your knowledge base, is always displayed when the instance is selected at the Instance tab. For information on how to add notes to any frame (class, instance, or slot), see Working with Notes.
Entry Fields
For each slot in the instance, the Instance Editor displays a field where you can enter the information for that slot. The different field types are based on the value type of the corresponding slot. For example, a slot of value type String is represented by a String entry field. The display and options for the field depend on the type of information that is included in the field. See The Standard fields, as well as the individual topics for the various field types, for more information.
The Standard Field Types
Template slots for a class are translated to entry fields for an instance of that class. For each slot in the class, the Instance Editor displays a field where a user can enter information corresponding to that slot. For example, the headline slot for the Article class becomes a field where the user can enter a headline for an instance. The display and options for the field depend on the type of information that can be entered in the field.
The different field types are based on the value type of the corresponding slot. For example, a slot of value type String is represented by a String entry field.
Note: These topics describe the default fields only. You can select different formats for some fields, using the Forms tab.
Protege-Frames provides the following fields for both Single and Multiple cardinality. For simplicity, only the Single cardinality is shown:
Field Type | Default Field |
---|---|
a checkbox field that is true or false | |
a display field and buttons that allow you to specify a class as the field value | |
an entry field that verifies that the entered value is a valid decimal number | |
a display field and buttons that allow you to create or specify an instance as the field value | |
an entry field that verifies that the entered value is a valid whole number | |
an entry field that verifies that the entered value is a valid string | |
a drop-down list that displays the Symbol's preset list of values |
Fields with Multiple Cardinality
If the slot corresponding to a field has Multiple Cardinality, then the field allows multiple entries. How the information is entered and displayed depends on the field type.
For Boolean, Float, Integer, String, and Symbol entry fields, the field is shown as a display list with three field buttons at the top right:
For these fields, the field buttons do the following:
View Value: Opens an entry box for any highlighted value(s) and allows you to make changes. | |
Create Value or Add Value: Opens an entry box for a new value and allows you to edit it. | |
Remove Value: Removes any highlighted value(s). |
For Boolean fields, viewing or creating a value displays a dialog box with a drop-down menu containing two choices: true or false. Select one and click OK.
For Float, Integer, String, and Symbol entry fields, viewing () or creating/adding () a value displays a dialog box where you can type. Enter a valid value in the dialog box and click OK. Removing () removes the highlighted value.
For Class and Instance entry fields, single and multiple cardinality fields have the same buttons and the same methods for viewing (, ), creating ( - Instance only), adding (, ), and removing (, ) values. The only difference is that multiple values can be stored in the field.
The Boolean Fields
When an instance is created for a class with a slot of Boolean value type, the entry field corresponding to the slot is a Boolean field, and contains a value which is either true or false.
Single Cardinality
An instance with a Boolean field with Single cardinality displays as a checkbox. To set or change the value for a Boolean/single slot, click in the box to add or remove the checkmark.
For example, the Personals_Ad class contains the Boolean slot Urgent; the Silly instance of Personals_Ad is not Urgent, while the M137 instance is:
The Class Fields
When an instance is created for a class with a slot of Class value type, the entry field corresponding to the slot is a Class entry field, and contains values which are descendants of the classes specified as allowed superclasses for the slot. For an example, see the Class Value Type topic.
Single Cardinality
The entry field corresponding to a slot of value type Class with Cardinality Single can contain a single class. It appears as a display bar; three standard class buttons let you edit, add, or remove a class:
Multiple Cardinality
An instance with a Class field with Cardinality Multiple shows a display list. The value of this field is a list of classes:
Note the following:
To select multiple classes to view or remove, use the CTRL (Cmd) key; use the Shift key to select a range.
Adding a class does not replace a previous one.
If the at most value is set in the Cardinality field for the slot, there is a limit on the number of classes you can enter.
Adding a Class
To select a class as the value of the slot, or to change the existing value:
Click the Add Class () button. A Select Classes dialog box will be displayed.
Select a single class as the value of the slot.
Click OK.
The class you selected will be shown in the display bar. If another class was displayed previously, it will be gone now.
Removing a Class
To remove a class:
The Float Fields
When an instance is created for a class with a slot of Value Type Float, the entry field corresponding to the slot is a Float entry field, and takes numbers as values. These numbers may include a decimal point. Values of type Float are stored on your system as floating-point values, and are only as accurate as your system allows.
Entering Floating-Point Numbers
When entering a Float value for an instance, you can use decimal point or exponential representation. You can enter positive and negative values. For example:
Representation | Description |
---|---|
1234.56 |
Standard decimal notation. |
1.23456E3 or 1.2345e3 |
Exponential notation; the example is shorthand for 1.23456 · 103. Represents 1234.56 |
-1234.56 |
Negative number. |
1.23456E-3 or 1.2345e-3 |
Exponential notation with a negative exponent, shorthand for 1.23456 · 10-3. Represents 0.00123456. |
For convenience in typing, when using exponential notation, you can enter either e or E.
Single Cardinality
The entry field corresponding to a slot of value type Float with Cardinality Single can contain a single floating-point number. It appears as an entry bar:
To set or edit the value, simply click in the entry field and make your edits.
To clear the slot, delete the value in the entry bar.
Invalid entry in a Float field
If you enter text or other invalid information (e.g., values less than the minimum or greater than the maximum) in a Float entry field, the entered information will be displayed in red and will not saved by the system. The previous value (if any) will be used, instead.
Multiple Cardinality
An instance with a Float/Multiple slot shows a display list with three buttons. This field contains a list of floating-point values. If the at most value is set in the Cardinality field for the slot, there is a limit on the number of values you can enter.
To edit a pre-existing value for a Float/Multiple slot:
Select the value you want to edit.
Click the View Value () button. An Edit Float Value dialog box will be displayed.
Edit the number directly in the dialog box.
Click OK.
To add a value to a Float/Multiple slot:
Click the Create Value () button. A Create Float Value dialog box will be displayed.
Enter the number you want in the entry bar. The number may include a decimal point.
Click OK.
To remove a value from a Float/Multiple slot:
Select the value(s) you want to remove. You can select multiple values by holding down the Ctrl (Cmd) key.
Click the Remove Value () button. The selected values will be removed.
The Instance Fields
When an instance is created for a class with a slot of Value Type Instance, the entry field corresponding to the slot is an Instance entry field. It contains values which are direct or indirect instances of the classes specified as allowed classes for the slot. (Direct instances are instances of the class; indirect instances are instances of a class subordinate to the class, e.g., a subclass.)
Single Cardinality
An instance with an Instance/Single slot shows a display field and four buttons that let you edit, create, add, and remove instances. The value of this slot is a single instance:
Multiple Cardinality
An instance with an Instance/Multiple slot shows a display list. The value of this slot is a list of instances:
Note the following for fields of multiple cardinality:
To select multiple instances to view or remove, use Ctrl (Cmd); use Shift to select a range.
Adding an instance does not replace a previous one.
If the at most value is set in the Cardinality field for the slot, there is a limit on the number of instances you can enter.
Editing an Instance
To edit an existing instance:
Click the View Instance () button to open the Instance Editor for the instance that is displayed or selected. If no instance is currently displayed, the View Instance button will be grayed out.
Enter the updated information directly in the Instance Editor.
Note that any edits you make to this instance will appear in all locations where this instance occurs. You should be sure that you want the change to be global before editing an existing instance. In some cases, it may be more appropriate to create a new instance, instead.
Creating an Instance
To create a new instance:
If there is more than one allowed class, or if the allowed class has subclasses, a dialog box will appear, asking you to select a Concrete class, displayed with a solid icon (). Select a class and click OK.
A direct instance of the selected class will be created and a blank Instance Editor will be displayed. Fill in the editor for the new instance, as desired.
Adding an Instance
To add an existing instance to the value of the field:
Click the Add Instance () button. A Select Instance dialog box will be displayed.
In the Allowed Classes pane, select the class where the instance you want is located.
If the class has subclasses, use the menu at the top of the Instances pane to choose the instances you want to see:
Direct Instances limits the display to direct instances of the class
All Instances displays the instances of the class and all of its descendants (subclasses, subsubclasses, etc.)
Select a single instance.
Click OK. The instance you selected will be displayed. If another instance was displayed previously, it will now be gone.
This selects a pre-existing instance as the value of the field. This instance can also be viewed in the Instance Browser and may also appear as a value for other instances. Note that any edits you make to this instance will appear in all locations where this instance occurs. You should be sure that you want the change to be global before editing an existing instance. In some cases, it may be more appropriate to create a new instance instead.
Removing an Instance
To remove an instance:
This removes the instance as a value of the current field, but does not remove it from the project. The instance can still be viewed via the Instance Browser for the correct class, and still appears in any other field where it has been selected. To delete an instance from the knowledge base, use the Delete Instance () button in the Instance Browser.
The Integer Fields
When an instance is created for a class with a slot of Value Type Integer, the entry field corresponding to the slot is an Integer entry field, taking whole numbers as values.
Single Cardinality
The entry field corresponding to a slot of value type Integer with Cardinality Single can contain a single integer number. It appears as an entry bar:
To edit a value, click in the entry field and make your edits.
To create a value, enter a whole number in the entry field.
To clear a value, delete the value in the entry field.
Error Detection
The information in a Integer field must be a whole number. If you enter text or other invalid information, such as values less than the minimum or greater than the maximum, the entered value will be displayed in red and will not be saved by the system. The previous value (if any) will be used instead. The following example shows such an invalid entry ("four") in an Integer field:
Multiple Cardinality
The entry field corresponding to a slot of type Integer with Cardinality Multiple shows a display list with three buttons. This field takes a list of integer values. If the at most value is set in the Cardinality field for the slot, there is a limit on the number of values you can enter.
To edit a pre-existing value:
Select the value you want to edit.
Click the View Value () button. An Edit Integer Value dialog box will be displayed.
Edit the number directly in the dialog box.
Click OK.
To add a value:
Click the Create Value () button. A Create Integer Value dialog box will be displayed.
Enter a whole number in the entry bar. You can enter positive or negative values.
Click OK.
To remove a value:
Select the value(s) you want to remove. You can select multiple values by holding down the Ctrl (Cmd) key.
Click the Remove Value () button. The selected values will be removed.
The String Fields
When an instance is created for a class with a slot of String Value Type, the entry field corresponding to the slot is a String entry field. It takes ASCII characters as values, including upper and lowercase letters, numbers, and the basic symbols on the keyboard, such as !, _, and %. String values can also include spaces.
Single Cardinality
The entry field corresponding to a slot of value type String with Cardinality Single can contain a single ASCII string. It appears as an entry bar:
To edit a value, click in the entry field and make your edits.
To create a value, enter a string in the entry field.
To clear a value, delete the value in the entry field.
Multiple Cardinality
The entry field corresponding to a slot of type String with Cardinality Multiple shows a display list with three buttons. This field takes a list of string values. If the at most value is set in the Cardinality field for the slot, there is a limit on the number of values you can enter.
To edit a pre-existing value:
Select the value you want to edit.
Click the View Value () button. An Edit String Value dialog box will be displayed.
Edit the string directly in the entry field in the dialog box.
Click OK.
To create a value:
Click the Create Value () button. A Create String Value dialog box will be displayed.
Enter a string in the entry field. You can enter ASCII characters, including upper and lowercase letters, numbers, and the basic symbols on the keyboard, such as !, _, and %. String values can also include spaces.
Click OK.
To remove a value:
Select the value(s) you want to remove.
Click the Remove Value () button. The selected values will be removed.
The Symbol Fields
When an instance is created for a class with a slot of Value Type Symbol, the entry field corresponding to the slot is a Symbol entry field. It takes values from the list of symbols created for the slot.
Single Cardinality
The entry field corresponding to a slot of value type Symbol with Cardinality Single can contain a single value. It appears as a drop-down list:
To create the value of the slot, click on the list and double-click to select your choice.
To change the value of the slot, make a different choice from the list.
To remove the value of the slot, select the blank value at the top of the list.
Multiple Cardinality
The entry field corresponding to a slot of value type Symbol with Cardinality Multiple shows a display list with three buttons. This field takes a list of symbol values. If the at most value is set in the Cardinality field for the slot, there is a limit on the number of values you can enter.
To edit a pre-existing value:
Select the value you want to edit.
Click the View Value () button. An Edit Symbol dialog box will be displayed.
Select the value from the menu.
Click OK.
To add a value:
Click the Create Value () button. A Create Symbol dialog box will be displayed.
Select the value from the menu.
Click OK.
To remove a value:
Select the value(s) you want to remove. You can select multiple values by holding down the Ctrl key.
Click the Remove Value () button. The selected values will be removed.
Creating an Instance
Creating instances is part of the iterative process of developing a Protege-Frames project. Before you create instances, you need to have created and organized the classes and slots that model your knowledge base structure.
Creating instances can give you valuable information about the project structure and its applicability. As you add instances to your project, you may expose missing or redundant areas which tell you that you need to redesign some of the class/slot structure. However, as you move classes and create and delete slots, you may lose information in your instances. In addition, it is difficult to split a single instance into two or more instances. Therefore, you should not add an extensive base of instances until you believe the structure of your project is fairly stable.
This topic describes creating an instance from the Instance Browser, which creates the instance directly in the selected class. The following additional topics describe other ways to create an instance:
See the Instance fields for how to create an instance using the Create Instance () button in an instance field.
See Creating Multiple Instances for how to create several instances at once, using the wizard on the Tools menu.
See Copying an Instance for how to copy an instance, using the Copy Instance () button.
To create a new instance from the Instance Browser:
Display the Instances tab.
In the Class Browser, highlight the class where you want the instance to appear.
Click the Create Instance () button at the right of the Instance Browser. The new instance will appear in the Instance Browser. It will have a default name, such as project_instance_1.
The Instance Editor at the right will display entry fields corresponding to the slots of the class where the instance was created. To create values for the fields, enter the desired information. For more information on how to edit field values, see the Standard fields.
Creating Multiple Instances
Protege-Frames supplies a wizard that lets you quickly create multiple direct instances of a selected class.
Select Tools | Wizards and select Create multiple instances from the submenu. The wizard will display the class hierarchy of your project:
Select the class for which you want to create instances and click Next. The wizard will show the instance entry screen:
Set your options:
To have all instances you create begin the same way, enter an optional prefix.
To have all instances you create end the same way, enter an optional suffix.
Enter your instance names:
Type the name of a instance, then press Enter/Return to begin entering a second instance.
You can edit or delete the name of any instance you have already entered by moving the cursor to that name. You can also cut and paste text within and between instance names.
If you enter an invalid character (e.g., /) in an instance name, the name will be highlighted in red. You can edit the instance name from the keyboard, or you can click Tidy to have Protege automatically substitute an underscore (_) for each invalid character.
Click Finish or type Ctrl-Enter (Cmd-Enter). The wizard will display a list of instances that have been added. This is informational only: you cannot cancel at this point.
Click Finish to exit the wizard.
Fill out the properties for each instance in the corresponding Instance Editor.
If you prefer, you can create instances with the field entries already filled by copying an instance. See Copying an Instance.
Displaying the Instance Editor
You view or edit an existing instance using the Instance Editor.
Note: If the class is a system class or has been included from another project, it cannot be edited. Included classes are shown with a pale class icon to the left.
Using the Instances Tab
To view or edit an existing instance from the Instances tab:
In the Class Browser at the Instances tab, select the class which contains the instance you want to edit. If the class is not currently displayed, you may need to navigate to it via the class hierarchy. To ensure that the class is the same one that was selected at the Classes tab, you can synchronize class trees. When a class is selected, all instances for the selected class are displayed in the Instance Browser.
Select the instance you want to edit in the Instance Browser.
Enter the updated information directly in the Instance Editor to the right.
Displaying a Free-standing Window
You can open the Instance Editor to view or edit an instance anywhere the View Instance () button appears, including the following locations:
the Search Results pane at the Queries tab
To view or edit a class using the Instance Editor:
Select the instance you want to edit. At the Instances tab, first select the class that contains the instance, as described above.
Click the View Instance () icon at the upper right of the pane to open the Instance Editor as a free-standing window.
To view or edit the information for several instances at once, open a new Instance Editor for each instance. Opening a new Editor does not close the previous editor. This allows you to compare the attributes for two or more instances. Edits can be made directly in any open Editor. For managing multiple windows, see Cascading Open Forms and Closing All Windows.
Any changes you enter into the Instance Editor take effect immediately. To make the changes permanent, save the knowledge base by selecting Save from the Project menu. To revert to the last saved version, close Protege without saving changes. If you have made extensive changes to your knowledge base during the current session, you may wish to save before editing instances.
You can also edit an instance from a field. See Instance fields for more information.
Setting the Display Slot
Showing Subclass Instances
The Instance menu, at the top of the Instance Browser allows you to choose the level of instances - direct instances or subclass instances - you want to see for a selected class. These choices are also available when you are choosing instances in a dialog box.
About Subclass Instances
There are two types of instances subordinate to a class:
A direct instance is an instance that has been created directly under the class.
A subclass instance is any instance that is subordinate to the class. Because of inheritance, an instance of a class is also an instance of all of that class's superclasses. Therefore, an instance can be an instance of many classes of which it is not a direct instance.
In the newspaper example, the Manager class has three direct instances: Jane, Joe, and Mary. The Manager class also has a subclass, Director, which has a direct instance Tim. Tim is a subclass instance of Manager.
Showing Subclass Instances
By default, the Instance window shows only the direct instances for a class.
You can change this, using the Instance menu. To show all instances for a class, including subclass instances:
Select Show Subclass Instances from the Instance menu at the top of the Instance Browser, to the right of the instance buttons. The display will change to show all instances subordinate to the class. The class for which the instance was created is shown in parentheses after the instance name.
Notes:
It is possible to attach an instance to more than one class (see Adding a Class Type to an Instance), so that the instance appears directly under two or more classes. In this case, the class name displayed after the instance will be the class where the instance was first created.
By definition, abstract classes cannot have direct instances, but they can have subclass instances. This selection allows you to see all the subclass instances for an abstract class.
Showing Direct Instances Only
If subclass instances are shown, you can choose to show only direct instances.
Click on the the Instance menu at the top of the Instance Browser, to the right of the instance buttons. You will see that Show Subclass Instances is checked.
Select Show Subclass Instances from the menu to deselect this setting and show only direct instances.
Editing an Instance
To edit an instance once it has been created, enter the desired information in each entry field. The entry method and type of information will depend on the field type. See the Standard fields for more information.
Invalid Entries
If the type of information you enter is invalid (ie, not appropriate for the slot), the entry will be shown in red. For example, entering words in an Integer slot is not allowed:
Values that violate other slot conditions, such as values less than the minimum or greater than the maximum, will also be shown in red.
Required Values
If a value is required for the slot (cardinality at least 1) and there is currently no value, the field is outlined in red.
Default Values
If a slot specifies a default value, that value will automatically be entered in the corresponding field when an instance is created. The default value can be edited.
Template Values
If a slot specifies a template value, that value will automatically be entered in the corresponding field when an instance is created. The template value cannot be edited.
Copying an Instance
You can copy an existing instance, using the Copy Instance () button. Copying an instance is useful when you want to create multiple instances that share some field values. You can create the first instance, fill out the shared values, then copy the instance and fill out or change the remaining values.
Unless you select Deep Copy, copying an instance duplicates the instance with identical field values. Only the internal name stored by Protege is changed. If you are working with deep copies, you may want to temporarily clear the display slot, so that it displays the internal name.
Making Copies
At the Instances tab, select the instance that you want to copy.
In the Copy Frames dialog box, enter the number of copies that you want to make.
To have Protege-Frames perform a "deep copy", select the deep copy option. This is described more fully below. Otherwise, the instance is duplicated with identical field values; only the instance name is changed.
What is a Deep Copy?
You can select to "deep copy" an instance. A deep copy is a recursive copy that creates a copy of:
the selected instance
any instance that appears as a value for an Instance entry field in any copied instance
Note the following:
The copy is recursive. As long as a new instance appears as a value for a copied instance, a copy of it is created.
It is possible for an instance to appear more than once in the chain. If this happens, only one copy is created.
Other referenced instances do not get copied.
For example, if you deep copy the instance M137 for the class Personals_Ad, then all of the following are copied:
the instance M137 (class = Personals_Ad)
all the instances which appear as instance values for M137, specifically:
the instance 08/19/97 (class = Newspaper), which appears as the value for the Published In field of M137
all the uncopied instances which appear as values for 08/19/97, specifically:
Tuesday (class = Prototype_Newspaper), which appears as the value for the Prototype field
all the instances which appear as values for Tuesday:
Weekday Ads (class = Billing_Chart) in the Prototype Billing Chart field
Lifestyle, Local News, Magazine, Science, Sports, and World News (class = Section) in the Sections field
None of these instances have any instance fields, so the copy stops here.
M137 appears again as an instance of 08/19/97. However, as it has already been copied, no additional copy is created.
M137 appears as a value for San Jose Mercury News (class = Library). This is not copied.
Deleting an Instance
To delete an instance from the knowledge base:
Display the Instances tab.
In the Class Browser, select the class which contains the instance you want to delete. If the class is not currently displayed, you may need to navigate to it via the class hierarchy. The instances for the selected class are displayed in the Instance Browser.
In the Instance Browser, select the instance that you want to delete. To highlight multiple instances, use the Ctrl (Cmd) key; to highlight a range of instances, use the Shift key.
Click the Delete Instance () instance button. You will be prompted for confirmation.
Once an instance has been deleted, it cannot be recovered. You may wish to save or archive your project before deleting instances.
You can also remove a value from a field of type Instance. This does not remove the instance from the knowledge base. See Instance fields in the Standard fields for more information.
Finding an Instance
To find an instance in the Instance Browser:
Display the Instances tab.
Select the class that contains the instance in the Class Browser.
In the Instance Search Bar at the bottom of the Instance Browser, type the beginning of the display slot text for the instance. (The display slot is the slot used to list the instances in the Instance Browser.) Comparison is case-insensitive.
If there is only one match, the selection in the Instance Browser will move to the instance which contains the entered text. If there is more than one match, a dialog will be displayed asking you to choose the instance you want. Select an instance and click OK.
If you are unable to find the instance you are looking for, it may be in a different class. You can use the lookup bar at the bottom of the Class Browser to look for classes.
Changing the Class of an Instance
You can change the class of an instance, using drag-and-drop in the Instances tab. To change the class of an instance:
Select the instance you wish to move:
Display the Instances tab
Select the class that contains the instance in the Class Browser.
Select the instance you want to move in the Instance Browser.
Hold down the mouse button and drag the instance from the Instance Browser to the Class Browser, until it is on top of the desired class.
Release the mouse. The instance will now have the selected class as its direct type. Note that the slots of the dragged instance will automatically change to reflect the inheritance from the new class.
When you drag an instance to a new class, the fields in the instance will change to match the slots in the class. If you drag an instance, you may lose some of the information in your instance. This loss is permanent. You cannot restore the information by dragging the instance back to the original class. Therefore, you should be sure that you want to make these changes before you drag an instance to a new class. You may also wish to archive the project before you move instances.
In addition, any changes you make will be evident wherever that instance is referenced - for example, if that instance appears as the value of a field, the change will also occur in the field. You can use the View References to Instance () button to see where this instance is referenced, before changing its class.
Working with Instance Types
The Types pane, in the Instance Browser, allows you to add and remove types for an instance; that is, the classes for which the selected instance is a direct instance. Assigning multiple types to an instance allows you to build an instance which combines field characteristics from two or more classes.
Adding a Type
To add a class type to an instance:
At the Instances tab, select the class and instance you want. The classes where this instance is direct will be shown in the Types pane, at the bottom of the Instance Browser.
In the Select Classes dialog box, select the additional class(es) where this instance will be a direct instance and click OK.
The class(es) are added to the direct superclasses of the instance. The Instance Editor will change to display multiple forms, one for each class type. Any shared fields will contain identical values. Editing a field value in one form edits the same field in all the forms where it appears.
Deleting a Type
For a multi-type instance, you can delete types. To do this:
At the Instances tab, select the class and instance you want. The classes where this instance is direct will be shown in the Types pane at the bottom of the Instance Browser.
Click the Delete Class () button at the top of the Types pane.
Configuring the Instance Editor
You can choose how to display multi-type instances in the Instance Editor. Forms can be displayed one below the other on a single screen, or they can be displayed in a tabbed format. To configure the display for multi-type instances:
Select Project | Configure from the menu.
To display forms in separate tabs, make sure that Use Tabbed Forms for Multi-type Instances is selected. To display forms one below another in a single window (the default), make sure this option is deselected.
If the current instance is multi-type, you may need to click on another instance and then back on this instance to see the change.
The Instance Icons
The icons in the Instances Browser give information about the instances.
Instance Icons
These icons give information about a slot. When a class inherits a class from a superclass, icons in the Template Slots pane give information related to the inheritance and overrides; these icons are not shown anywhere else.
A solid icon means that the instance is part of this project. | |
A pale icon indicates an instance that has been included from another project. These instances cannot be edited. |