The online help in Protege 3.1.1 has not been updated to match the program. In particular, the terminology and screen appearance do not match. This page is a stopgap solution, containing revised text for the tutorial. Each section of this page begins with a link to the corresponding page in the tutorial. (4SJ)
http://protege.stanford.edu/doc/tutorial/get_started/create_proj.html (4NI)
Creating the Sample Project (4NJ)
First, you must create a new project in Protégé format. (4NK)
To create the sample project when you start Protégé: (4NL)
- Start Protégé. If you have a Protégé project already open, simply exit and restart the program. (For information on creating a project from within Protégé, see Creating a Project.) When you start Protégé, the Welcome to Protégé dialog box prompts you to create a new project, open a recent project, or get help. (4NM)
- Click "Create New Project..." (4NN)
A "Create New Project" dialog will open, allowing you to choose a Project Type. Unless you have a need for a special format for your files, just click "Finish" to accept the default: "Protege Files (.pont and pins)". (4NO)
- The Protégé window opens and the standard tabs become visible. A new project always opens at the Classes view. The internal Protégé classes THING and SYSTEM-CLASS are all that is visible. No instances will be created. (4NP)
You are now ready to save and name your Protégé project. (4NS)
http://protege.stanford.edu/doc/tutorial/get_started/save_proj.html (4NT)
Saving the Sample Project (4NU)
Although the tutorial is not very long, you may find that you want to exit the project before you have finished. If you save and name it now, you will be ready to exit whenever is convenient. (4NV)
To save the project: (4NW)
- Click the Save Project button (third from the left at the top of the Protégé window. You can also choose Save Project from the File menu. A dialog box is displayed. (4NX)
- To choose the location where you want the project to be saved, click the top button at the right of the Project line. In the Project Files dialog, navigate to (and/or create) a directory. (4NY)
- Enter a File Name (e.g., "tutorial"). (4NZ)
- Click on Select to proceed. (4O0)
- You will be returned to the Protege Files dialog box. Click OK to save the files and exit the dialog. (4O1)
Note: You can also choose a location by typing the full path name in the Project line of the Protege Files dialog. The names of the other files will be filled in automatically. (4O2)
http://protege.stanford.edu/doc/tutorial/get_started/create_class.html (4O3)
Creating and Naming Classes (4O4)
Once you have created the project, the first thing you need to do to start constructing your ontology is to add some classes and subclasses. In this section, you will: (4O5)
- Create a class, Author (4SL)
- Create subclasses of the Author class (4SM)
- Create the Person class and some subclasses (4SN)
- Add a new superclass to an existing class (4O6)
Creating the Author Class (4O7)
First, we will create a new class called Author. An Author is any possible source of an article, such as a news service or columnist. To create the Author class: (4O8)
- First, if you have clicked on any buttons, or explored the Protégé window, make sure the Classes tab is selected. (4O9)
- Locate the Class Hierarchy area in the CLASS BROWSER pane at the left of the Protégé window. This area displays the hierarchy of classes, with the current class highlighted. Make sure that class :THING is highlighted. (4OA)
Almost all the classes you create will be created subordinate to :THING. SYSTEM_CLASS is used by Protégé for defining the structure of various Protégé forms. (4OB)
- Click on the Create Class button (third from the left, at the top of the Class Hierarchy area). (4OC)
A class is created with a generic name based on the name of the project, such as tutorial_Class_0. You can see the name in the Class Hierarchy area. The class is highlighted to show that it is selected. (4OD)
- Type Author. A recommended Protégé convention is to make the first character of each word in a class name uppercase and the rest lowercase, and to separate words with an underscore. (4OE)
- Click again on the highlighted class (or hit Return) to complete and display your change. (4OF)
If you have trouble renaming the class, look at the CLASS EDITOR pane at the right of the Protégé window. The generic name of the class you just created should be displayed in the Name field and highlighted. If the correct generic name is displayed, but not highlighted, simply double-click in the Name field to edit the name. If the incorrect name is displayed, then the wrong class is selected in the Class Hierarchy area. Click on the class you want to rename. (4OG)
Creating Subclasses of Author (4OH)
Now we want to create some subclasses of Author: (4OI)
- Make sure Author is selected in the Class Hierarchy area. (4OJ)
- Click the Create button. (4OK)
- Rename the new class to Columnist. (4OL)
Notice that when you create the first subclass of a class, a ">" or "v" icon appears to its left. You can use this icon to display or hide the subclasses of a class. (4OM)
To create another subclass of Author: (4ON)
- Select Author in the Class Hierarchy area. If you do not remember to select Author, you will create a subclass of Columnist. (4OO)
- Click the Create button. (4OP)
- Rename the class to Editor. (4OQ)
Creating the Person Class (4OR)
Now we want to create another class, called Person. A Person is any individual, whether or not they are an Author. (4OS)
- Select :THING in the Class Hierarchy area. This ensures that the new class will be at the right level in the class hierarchy. (4OT)
- Click the Create button. (4OU)
- Rename the class to Person. (4OV)
Creating a Subclass of Person (4OW)
Now create a subclass of Person, Employee: (4OX)
- Select Person in the Class Hierarchy area. (4OY)
- Click the Create button. (4OZ)
- Rename the new class to Employee. (4P0)
Creating a Subclass of a Subclass (4P1)
We are now ready to create some subclasses of Employee. First, let us create an employee type who is not an Author: (4P2)
- Select Employee in the Class Hierarchy area. (4P3)
- Click the Create button. (4P4)
- Rename the class to Salesperson. (4P5)
Adding an Additional Superclass to an Existing Class (4P6)
We also want a Columnist to be an Employee. Since we have already created the Columnist class, we do not create it again. Instead, make the existing Columnist class a subclass of Employee: (4P7)
- Select Columnist in the Class Hierarchy area. The current superclass of Columnist, Author, is displayed in the Superclasses area, just below the Class Hierarchy area. (4P8)
- Click the Add Superclass button in the Superclasses area. (4P9)
A Select Classes dialog box displays the class hierarchy that you have developed so far. (4PA)
- Click the ">" icon next to Person to display the subclasses of Person. (4PB)
- Highlight Employee. (4PC)
- Click OK. (4PD)
Columnist now appears in two places in the Class Hierarchy area: once under Author and again under Employee. These superclasses are listed in the Superclasses area. (4PE)
You can also add a superclass using drag and drop: (4PF)
- Select Editor in the Class Hierarchy area. (4PG)
- Hold down the mouse button and drag the Editor class over Employee. Employee is outlined. (4PH)
- Hold down the Ctrl key and release the mouse button to drop the subclass. (4PI)
If Editor appears under Person, you did not hold down the Ctrl key long enough while dropping. Delete the superclass by clicking on the Remove Superclass button (at the top of the Superclasses area) while Person is highlighted, then try again. (4PJ)
You have now created several classes and given two classes multiple superclasses. You are now ready to assign some attributes to the classes you have created, by creating slots. This is covered in the next section. (4PK)
http://protege.stanford.edu/doc/tutorial/get_started/create_slot.html (4PL)
Creating and Naming Slots (4PM)
You now have several classes in your project. You can assign attributes to these classes by creating slots. In this section you will: (4PN)
- Create a basic slot for the Author class. (4SO)
- Create a basic slot for the Person class. (4SP)
- Create a Float slot for the Person class. (4SQ)
- View how a class with multiple superclasses inherits from both of them. (4PO)
To create a slot for the class Author: (4PP)
- Select Author in the Class Hierarchy area of the CLASS BROWSER pane. (4PQ)
- Click the Create Slot button at the far right of the Template Slots area of the CLASS EDITOR pane. (4PR)
- A slot specification dialog will be displayed. (4PS)
- To name the slot, highlight the generic name in the Name field. Type the name for the slot, byname. A recommended convention is to make slot names lowercase, separating each pair of adjacent words by an underscore. Making slot names lowercase, while making classes start with an uppercase letter, helps you to distinguish them in your ontology. (4PT)
Q: Then why isn't this one named "by_name"? (4PU)
- This slot will be a string slot, that is, a slot that takes values that are any string of alphanumeric characters, possibly including spaces. For this simple slot, we will not change any of the other fields in the Slot Form dialog. Simply close the form and return to the main window. Notice that your slot now appears in the Template Slots area when Author is highlighted. (4PV)
The blue slot icon indicates that the slot is "direct"; that is, it was created directly on the selected class. You can edit a direct slot by double-clicking on it to open the Slot Form dialog. (4PW)
We will now create two slots for the Person class. To create a string slot for Person: (4PX)
- Click on Person in the Class Hierarchy area. (4PY)
- Click the Create Slot button at the far right of the Template Slots area. (4PZ)
- Change the slot name to "name" in the Slot Form dialog. (4Q0)
- Exit the Slot Form dialog. (4Q1)
To create the next slot, which will be of Type Float: (4Q2)
- Make sure Person is still selected in the Class Hierarchy area. (4Q3)
- Click the Create Slot button at the far right of the Template Slots area. (4Q4)
- Change the slot name to salary in the Slot Form dialog. (4Q5)
- Select Float from the Value Type menu. (4Q6)
A Float is a floating point number (e.g., 3.14). Values that are entered for this slot must be valid floating point numbers. (4Q7)
- Exit the Slot Form dialog. You now see two direct slots for Person. (4Q9)
Slots and Inheritance (4QA)
The slots you create for a class are inherited by all their classes. To see this, click on Salesperson. You will see the slots you created for Person. Notice that the slot icons are now parenthesized, to indicate that these slots are inherited. (4QB)
Now, click on Columnist. You see that Columnist inherits slots from both Person (via Employee) and Author. This multiple inheritance is an essential part of Protégé. (4QC)
You have now created some simple slots. This is all you need to enter some instances and begin creating your knowledge base. (4QD)
http://protege.stanford.edu/doc/tutorial/get_started/enter_instance.html (4QE)
Entering Instances (4QF)
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 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 not have that information for your new instances. (4QG)
In this section, you will enter two instances for the Editor class. (4QH)
To enter an instance for Editor: (4QI)
- Click on the Instances tab. (4QJ)
- Click on Editor in the Class Hierarchy area. The Create Instance button in the INSTANCE BROWSER pane will become active, indicating that you can now create an instance. (4QK)
- Click on the Create Instance button in the INSTANCE BROWSER pane to create an instance. (4QL)
- Enter Chief Honcho in the Name field. (4QM)
- Enter 150000 in the Salary field. Notice that this field will not accept commas as part of the entry. (4QN)
- Chief Honcho does not do any writing herself, so do not enter a byname. (4QO)
Q: How do I "finish" entering the instance (aside from clicking on another class? (4QP)
To create another instance: (4QR)
- Click the Create Instance button in the INSTANCE BROWSER pane again. (4QS)
- Type Mr. Science in the Name field. (4QT)
- Type 60000 in the Salary field. {nid 4QU} }}} (4SR)
You have now learned to create instances. However, the default form can be difficult to deal with. Most obviously, the names you see in the INSTANCE BROWSER pane are extremely unilluminating. In addition, no Editors have bynames, so the Byname field is not useful in this particular form. The next section shows how to edit forms. (4QV)
http://protege.stanford.edu/doc/tutorial/get_started/custom_form.html (4QW)
Customizing a Form (4QX)
Forms determine how your instance information is presented and entered. By changing a form, you can: (4QY)
- change the browser key, used to list your instances (4SS)
- reposition fields (4ST)
- hide a field (4QZ)
Changing the Browser Key (4R0)
The browser key is the slot that is used to identify the different instances when they are displayed in a list. If you do not select a slot to use as a browser key, Protégé uses a default key, <inherit>, such as newspaper_0017. It is usually helpful to set a browser key for all classes that will contain instances. In fact, you may choose to set the browser key before you even start entering instances. (4R1)
To set the browser key for the Editor slot: (4R2)
- Click on the Forms Tab. (4R3)
- Click on Editor in the FORM BROWSER pane to the left. The default form will appear in the FORM EDITOR pane to the right. (4R4)
- Select name from the Display Slot menu. (4R5)
- If you wish, view the Instances Tab to see that the names of the instances you entered now appear in the INSTANCE BROWSER pane. From now on, you will be able to view instances of Editor by their name fields. (4R6)
Now return to the Forms Tab to continue customizing the Editor form. (4R7)
Hiding a Field (4R8)
To hide the Byname field: (4R9)
- Click on the Byname field to select it. The Selected Widget Type menu will become active, allowing you to customize the widget. (4RA)
- Select <none> from the Selected Widget Type menu. (4RB)
- The field will be removed from the form. (4RC)
Q: How do I get it back? (4RD)
Repositioning Fields (4RE)
If you no longer like the layout of the form, you can reposition a field by dragging it to a new position: (4RF)
- Select the Name field by clicking on it. It is outlined in green to show that it is selected. (4RG)
- Drag the field to the top of the Form Edit Pane. (4RH)
You can also resize a selected form by dragging the edges, just like any window. (4RI)
When you have a lot of fields, and you have deleted or resized several of them, it can be time-consuming to move all the fields by hand. Protégé provides a short-cut to rearrange all the visible fields on a form into a standard order, accommodating their current size. You can then use this as a basis to further customize the form. (4RJ)
To have Protégé arrange the fields for you: (4RK)
- Click the Relayout Form with Current Widgets button, at the top of the Forms area in the FORM BROWSER pane. (4RL)
- The form will adjust to close the gap caused by deleting one field and moving another. (4RM)
Congratulations. You have now created a simple project with Protégé. You can now explore the program on your own, using it to represent your own ontology. For more information about the capabilities of Protégé, see the Protege Documentation Home Page. (4RN)
http://protege.stanford.edu/doc/tutorial/get_started/create_query.html (4RO)
Creating and Saving a Query (4RP)
The Queries tab allows you to query your project and locate all instances that match criteria you specify. To create a query, you must select one or more classes, and one or more slots within that class. You can also save queries in the Query Library for future recall. (4RQ)
In this section, you will: (4RR)
- Create a query. (4SU)
- Run the query and view the results. (4SV)
- Save the query. (4SW)
- Retrieve the query and rerun it. (4RS)
Creating a Query (4RT)
Suppose you are interested in locating every Employee whose salary is greater than $40,000 dollars a year. To create the query: (4RU)
- Click on the Queries tab. (4RV)
- Click the Select Cls button above the Class entry bar. (4RW)
- In the Select Classes dialog box, expand the Person entry, then select Employee and click OK. (4RX)
Employee is now displayed in the Class entry bar. (4RY)
- With Employee showing in the Class entry bar, click the Select Slot button above the Slot entry bar. (4RZ)
- Select Salary from the Select Slot dialog box and click OK. (4S0)
- The menu to the right of the Slot entry bar will now be active. The entry bar at the far right of the window reminds you that the slot you have selected is a float. Select "is greater than" from the menu. Next, enter 40000 in the Float entry bar. (4S1)
Running the Query (4S2)
Now that you have set up your query, you can run it and view the results. (4S3)
- To run the query, first click the Find button near the bottom right of the window. (4S4)
- The results are shown in the Search Results window at the far right. If you cannot see the results, you may need to enlarge your window or move the slider bar. (4S5)
You can double-click on any instance (in the Search Results pane) to view details. (4S6)
Saving the Query (4S7)
You can save any query before or after you run it. To save the query in the Query Library: (4S8)
- Click the Add to Query Library button at the lower right of the screen. (4S9)
- Type sample_query in the Input Query Name dialog box. (4SA)
- Click OK. (4SB)
Retrieving the Query (4SC)
To retrieve a saved query, you can select it from the Query Library. To do this: (4SD)
- First, click the Clear button to empty the screen, so that you can see the query operation. (4SE)
- Select the query in the Query Library area at the bottom of the screen. If you cannot see the Query Library, you may need to enlarge your window or move the slider bar. (4SF)
- Click the Retrieve Query button to retrieve the query. (4SG)
- The saved query will now be displayed at the top of the Query pane. You can alter it or combine it with another saved query, if you wish. (4SH)
- Click the Find button. (4SI)