Instances are the actual data in your knowledge base. In general, it is a good idea to make sure you have structured your project as well as you can before entering extensive numbers of instances. If you have to make changes to your class or slot structure after instances have been entered, you may lose some information. In addition, if you add slots, you will have to go back and fill in the slot values for all instances that were created previously.
In this section, you will create two instances of the
Editor class:
- Click on the Instances Tab. This tab has three panes. The first, at the far left, displays the class hierarchy. The middle pane, which is currently blank, will show the list of
instances you create for a particular class. The third pane shows the Instance Editor, which displays the form for the currently highlighted instance where you can enter slot values.
- Expand the subclasses of Employee.
- Click on Editor. The Create Instance
button in the Instance Browser becomes active, indicating you can now create an instance.
- Click on the Create Instance
button. An instance is created, and the Instance Editor form appears. You can see it has a number of fields, one for each slot you created. You use these fields to enter the values for the slots. Notice that the display for the Editor class in the Class Hierarchy pane changed when you created the instance. The (1) in parentheses after Editor indicates that this class now has one instance.
- Enter Chief Honcho in the Name field.
- Enter 150000 in the Salary field. (Notice that the characters in this field will appear in red if anything other than a valid float value is entered. In Protege, if you attempt to enter slot values that do not satisfy the restrictions of the slot, the value will appear in red).
The Instances Tab now looks as follows. Note that the instance still has a generic name in the Instance Browser, such as "tutorial_instance_0". You will learn how to change this in the next section.
To create another instance:
- Click the Create Instance
button in the Instance Browser.
- Type Mr. Science in the Name field.
- Type 60000 in the Salary field.
Now that you have created more than one instance, you can define a relationship between them, e.g., you could say that Chief Honcho is "responsible for" Mr. Science. Before doing so, in order to make working with instances easier, you want to set a display slot for the
Editor class. Protege will display the value of the display slot every time it displays instances of the class. Setting the display slot is covered in the next section.