PrF UG inst all

From Protege Wiki

Jump to: navigation, search

Contents

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:

  1. 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.

  2. 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.

  3. 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 (instances_instance.view) button in the Instance Browser or anywhere else it appears.

The Class Browser at the Instances tabThe Instance BrowserThe Instance Editor
Instances tab, "Editor" and "Chief Honcho" selected



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.

Class Browser, "Editor" selected

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:

  1. The Instance buttons allow you to edit, view references to, create, copy, and delete instances.

  2. The Instance menu allows you to control the text that is displayed in the Instance window.

  3. The Instances window displays an alphabetical list of the instances for the selected class.

  4. 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 (instances_instance.search) button.

  5. The Types pane allows you to assign a single instance to multiple classes.

The Instance buttonsThe Instance menuThe Instances windowThe Types pane
Instance Browser, "Chief Honcho" selected



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.

Instances window, "Chief Honcho" selected

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:

instances_instance

The instance can be edited. You can enter your edits directly to the right, or click the View Instance (instances_instance.view) button to open the Instance Editor.

instances_instance.pale

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:

instances_instance.view

View Instance: Opens the Instance Editor for the highlighted instance. See Displaying an Instance.

instances_instance.view_references

View References to Instance: Shows all the objects that reference the highlighted instance. See Viewing References.

instances_instance.create

Create Instance: Creates a new instance for the class highlighted in the Class Browser at the Instances tab. See Creating an Instance Directly.

instances_instance.copy

Copy Instance: Copies the selected instance. See Copying an Instance.

instances_instance.delete

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., classes_class.abstract, classes_class.metaclass.abstract).

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.

instances_instance.add

Add Instance: Displays a dialog box that allows you to select one or more existing instances.

instances_instance.remove

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.

Instance menu

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.

Types pane

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

classes_class.add

Add Class: Displays a dialog box that allows you to select one or more additional class types.

classes_class.remove

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 (instances_instance.view) 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.

Instance Editor

Note Icons

The note icons (instances_instance_note.hide, instances_instance_note.create, instances_instance_note.delete) 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

Boolean

a checkbox field that is true or false

slots_boolean_unchecked

Class

a display field and buttons that allow you to specify a class as the field value

instances_field_type_class_location

Float

an entry field that verifies that the entered value is a valid decimal number

instances_filled_entry_float

Instance

a display field and buttons that allow you to create or specify an instance as the field value

instances_filled_entry_instance

Integer

an entry field that verifies that the entered value is a valid whole number

instances_filled_entry_integer

String

an entry field that verifies that the entered value is a valid string

instances_filled_entry_field_string

Symbol

a drop-down list that displays the Symbol's preset list of values

instances_filled_entry_symbol



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:

Multiple Cardinality display list

For these fields, the field buttons do the following:

all_object.view

View Value: Opens an entry box for any highlighted value(s) and allows you to make changes.

all_object.add

Create Value or Add Value: Opens an entry box for a new value and allows you to edit it.

all_object.remove

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 (all_object.view) or creating/adding (all_object.add) a value displays a dialog box where you can type. Enter a valid value in the dialog box and click OK. Removing (all_object.remove) 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 (classes_class.view, instances_instance.view), creating (instances_instance.create - Instance only), adding (classes_class.add, instances_instance.add), and removing (classes_class.remove, instances_instance.remove) 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:

Boolean (unchecked)
Boolean (checked)


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:

Single Cardinality entry field

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:

Multiple Cardinality display list

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:

  1. Click the Add Class (classes_class.add) button. A Select Classes dialog box will be displayed.

    Select Classes dialog, "Wine region" selected
  2. Select a single class as the value of the slot.

  3. Click OK.

  4. 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:

  1. Click the Remove Class (classes_class.remove) button. The display bar will be cleared.



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:

Single Cardinality entry field
  • 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.

Float field with invalid entry

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.

Multiple Cardinality display list

To edit a pre-existing value for a Float/Multiple slot:

  1. Select the value you want to edit.

  2. Click the View Value (all_object.view) button. An Edit Float Value dialog box will be displayed.

  3. Edit the number directly in the dialog box.

  4. Click OK.

To add a value to a Float/Multiple slot:

  1. Click the Create Value (all_object.add) button. A Create Float Value dialog box will be displayed.

  2. Enter the number you want in the entry bar. The number may include a decimal point.

  3. Click OK.

To remove a value from a Float/Multiple slot:

  1. Select the value(s) you want to remove. You can select multiple values by holding down the Ctrl (Cmd) key.

  2. Click the Remove Value (all_object.remove) 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:

Single Cardinality display field

Multiple Cardinality

An instance with an Instance/Multiple slot shows a display list. The value of this slot is a list of instances:

Multiple Cardinality display list

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:

  1. Click the View Instance (instances_instance.view) 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.

  2. 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:

  1. Click the Create Instance (instances_instance.create) button.

  2. 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 (classes_class). Select a class and click OK.

    Select Concrete Cls dialog, "Content" selected
  3. 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:

  1. Click the Add Instance (instances_instance.add) button. A Select Instance dialog box will be displayed.

    Select Instance dialog, "Section" selected
  2. In the Allowed Classes pane, select the class where the instance you want is located.

  3. 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.)

  4. Select a single instance.

  5. 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:

  1. Click the Remove Instance (instances_instance.remove) button. The instance will be removed.

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 (instances_instance.delete) 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:

Single Cardinality entry field
  • 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:

entry field with invalid value

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.

Multiple Cardinality display list

To edit a pre-existing value:

  1. Select the value you want to edit.

  2. Click the View Value (all_object.view) button. An Edit Integer Value dialog box will be displayed.

  3. Edit the number directly in the dialog box.

  4. Click OK.

To add a value:

  1. Click the Create Value (all_object.add) button. A Create Integer Value dialog box will be displayed.

  2. Enter a whole number in the entry bar. You can enter positive or negative values.

  3. Click OK.

To remove a value:

  1. Select the value(s) you want to remove. You can select multiple values by holding down the Ctrl (Cmd) key.

  2. Click the Remove Value (all_object.remove) 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:

Single Cardinality entry field
  • 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.

Multiple Cardinality display list

To edit a pre-existing value:

  1. Select the value you want to edit.

  2. Click the View Value (all_object.view) button. An Edit String Value dialog box will be displayed.

  3. Edit the string directly in the entry field in the dialog box.

  4. Click OK.

To create a value:

  1. Click the Create Value (all_object.add) button. A Create String Value dialog box will be displayed.

  2. 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.

  3. Click OK.

To remove a value:

  1. Select the value(s) you want to remove.

  2. Click the Remove Value (all_object.remove) 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:

Single Cardinality 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.

Multiple Cardinality display list

To edit a pre-existing value:

  1. Select the value you want to edit.

  2. Click the View Value (all_object.view) button. An Edit Symbol dialog box will be displayed.

  3. Select the value from the menu.

  4. Click OK.

To add a value:

  1. Click the Create Value (all_object.add) button. A Create Symbol dialog box will be displayed.

  2. Select the value from the menu.

  3. Click OK.

To remove a value:

  1. Select the value(s) you want to remove. You can select multiple values by holding down the Ctrl key.

  2. Click the Remove Value (all_object.remove) 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 (instances_instance.create) 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 (instances_instance.copy) button.

To create a new instance from the Instance Browser:

  1. Display the Instances tab.

  2. In the Class Browser, highlight the class where you want the instance to appear.

    Class Browser, "Editor" selected
  3. Click the Create Instance (instances_instance.create) 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.

    Instance Browser, "newspaper_Instance_0" selected
  4. 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.

  1. Select Tools | Wizards and select Create multiple instances from the submenu. The wizard will display the class hierarchy of your project:

    Create multiple instances dialog, "Personals_Ad" selected
  2. Select the class for which you want to create instances and click Next. The wizard will show the instance entry screen:

    Create multiple instances dialog with instance entry screen
  3. 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.

  4. 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.

  5. 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.

    Create multiple instances dialog, result
  6. Click Finish to exit the wizard.

    Instance Editor, "Cool_Guy" selected
  7. 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:

  1. 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.

  2. Select the instance you want to edit in the Instance Browser.

  3. 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 (instances_instance.view) button appears, including the following locations:

To view or edit a class using the Instance Editor:

  1. Select the instance you want to edit. At the Instances tab, first select the class that contains the instance, as described above.

  2. Click the View Instance (instances_instance.view) 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.

Instance window, "Jane" selected

You can change this, using the Instance menu. To show all instances for a class, including subclass instances:

  1. 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.

    Instance window, showing subclass instances

Notes:

  1. 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.

  2. 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.

  1. 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.

    Show Subclass Instances checkbox (checked)
  2. 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:

text field with invalid entry

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.

required text field

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 (instances_instance.copy) 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

  1. At the Instances tab, select the instance that you want to copy.

  2. Click the Copy Instance (instances_instance.copy) button.

  3. In the Copy Frames dialog box, enter the number of copies that you want to make.

    Copy Frames dialog
  4. 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:

  1. Display the Instances tab.

  2. 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.

  3. 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.

  4. Click the Delete Instance (instances_instance.delete) 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:

  1. Display the Instances tab.

  2. Select the class that contains the instance in the Class Browser.

  3. 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.

    search text entry field
  4. Press Enter/Return or click the Find Instance (instances_instance.search) button.

  5. 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.

Select from search results dialog, "Silly" selected

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:

  1. Select the instance you wish to move:

  2. 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.

  3. 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 (instances_instance.view_references) 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:

  1. 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.

    Types pane
  2. Click the Add Class (classes_class.add) button at the top of the Types pane.

  3. In the Select Classes dialog box, select the additional class(es) where this instance will be a direct instance and click OK.

    Select Classes dialog, "Columnist" selected
  4. 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.

    Instance Editor

Deleting a Type

For a multi-type instance, you can delete types. To do this:

  1. 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.

  2. Click the Delete Class (classes_class.remove) 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:

  1. Select Project | Configure from the menu.

  2. 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.

    Configuration dialog, Options tab
  3. 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.

    Instance Editor, "Reporter" tab



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.

instances_instance

A solid icon means that the instance is part of this project.

instances_instance.pale

A pale icon indicates an instance that has been included from another project. These instances cannot be edited.


Personal tools