Getting Started with Protege-Frames
Author :
Eliza Sachs
Current Contact :
Jennifer Vendetti (vendetti at stanford dot edu)
Last Modified :
June 9, 2006
Please Note: :
This tutorial shows how to create projects in Protege-Frames format. If you wish to use the OWL extension to Protege, see the Protege-OWL Tutorial.
Table of Contents
Understanding ontologies
This tutorial gives an introduction to Protege-Frames, an extensible, platform-independent environment for creating and editing ontologies and knowledge bases which allows users to begin designing an ontology quickly and intuitively. You will learn how to create, modify, and save a Protege-Frames project. You will create a project called "tutorial," which contains a few of the classes and slots from the newspaper example that accompanies the Protege-Frames installation. Once you have read the tutorial, you will be ready to explore Protege-Frames on your own.
Not all Protege users will be familiar with ontology design and development. Therefore, in addition to introducing you to the Protege-Frames interface, this tutorial gives a quick overview of some of the basic concepts of ontology design and draws heavily on the concepts described in the
Ontology Development 101 paper. If you are familiar with ontology design, you can skip directly to Creating and Saving a Project.
For further documentation, tutorials, papers, and presentations, see our
documentation page on the Protege Web site.
What is an ontology?
An ontology describes basic concepts in a domain and defines relations among them. Basic building blocks of ontology design include:
- classes or concepts
- properties of each concept describing various features and attributes of the concept (slots (sometimes called roles or properties))
- restrictions on slots (facets (sometimes called role restrictions))
An ontology together with a set of individual instances of classes constitutes a
knowledge base.
Why create an ontology?
An ontology provides a common vocabulary for researchers who need to share information in the domain. Some of the reasons to create an ontology are:
- To share common understanding of the structure of information among people or software agents
- To enable reuse of domain knowledge
- To make domain assumptions explicit
- To separate domain knowledge from operational knowledge
- To analyze domain knowledge
How do I create an ontology?
There is no one correct methodology for developing ontologies, nor is there a single correct result. Developing an ontology is usually an iterative process. You start with a rough first pass at the ontology. You then revise and refine the evolving ontology and fill in the details.
In practical terms, developing an ontology includes:
- defining classes in the ontology
- arranging the classes in a subclass-superclass hierarchy
- defining slots and describing allowed values for these slots
- filling in the values for slots for instances
How do I know it's right?
There are many possible ontologies for any given domain; any particular ontology is just one way of structuring the concepts and relations. There are a few simple principles which can help you make design decisions in many cases:
- There is no one correct way to model a domain - there are always viable alternatives. The best solution almost always depends on the application that you have in mind and the extensions that you anticipate.
- Ontology development is necessarily an iterative process.
- Concepts in the ontology should be close to objects (physical or logical) and relationships in your domain of interest. These are most likely to be nouns (objects) or verbs (relationships) in sentences that describe your domain.
Where do I start?
You might start by determining what you are going to use the ontology for, and how detailed or general the ontology is going to be. Among several viable alternatives,
you will want to determine which one would work better for the projected task, be more intuitive, more extensible, and more maintainable.
Remember that an ontology is a model of a real domain in the world and the concepts in the ontology must reflect this reality.
After you define an initial version of the ontology, you can evaluate and debug it by using it in applications or
problem-solving methods or by discussing it with experts in the
field. As a result, you will almost certainly need to revise the initial ontology. This process of iterative design will likely continue through the entire lifecycle of the ontology.
Developing an Example
Suppose we want to develop a system that helps manage the costs and organization of a newspaper. The "examples/newspaper" subfolder of the Protege installation directory contains a completed Protege-Frames project,
newspaper, which provides one possible ontology for this domain. Some of the questions we want to answer are:
- Who is responsible for each section of the newspaper?
- What is the content of each article in a section, and who is its author?
- Who does each author report to?
- What is the layout and cost of each section?
Once we have an idea of what we want to cover, we can list some of the important terms we need. These can include basic concepts, properties they might have, or relationships between them. To begin with we can just collect the terms without regard to the role they might play in the ontology.
In the newspaper example we have
sections. Each section contains
content such as
articles and
advertisements and has a
editor who is
responsible for the section. Each article has an
author, and that author may or may not be an
employee. For each employee, we want to know his or her
name and
salary, and who he or she
reports to.
As we continue to generate terms, we are implicitly defining the scope of our ontology, by what we finally decide to include and what to exclude. For example, upon initial examination of the term
employee, we might want to add
janitor or
delivery truck driver. However, on reflection, we might realize that we want our ontology to focus on the costs directly associated with the content generation and presentation of the newspaper. Therefore, we would decide not to include
janitor as a term of interest.
When we have a fairly complete list, we can start to categorize the different terms according to their function in the ontology. Concepts that are objects, such as
article or
author, are likely to be best represented by
classes. Properties of the classes, such as
content or
salary, can be represented by
slots, and restrictions on properties or relationships between classes and or slots, are represented by
slot facets.
We will now dive in and show how to use the Protege-Frames interface to create and structure these components of the ontology.
Creating and saving a project
First you must create a new project in Protege-Frames. A more detailed explanation of the Protege-Frames knowledge model is available in the
Overview section of the
Protege Web site.
Creating the sample project
To create the sample project when you start Protege:
- Start Protege. If you have a Protege project already open, simply exit and restart the program. When you start Protege, the Welcome to Protege dialog box prompts you to create a new project, open a recent project, or get help.
Note: To explore the examples included with Protege-Frames, click Open Existing Project... and select the project you wish to view. To create a new project later, select File | New Project....
- Click Create New Project.... 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)".
- The Protege window opens and the standard tabs become visible. A new project always opens at the Classes view. The internal Protege system classes :THING and :SYSTEM-CLASS are all that is visible. No instances will be created.
Naming and saving the sample project
Creating Classes
The Protege-Frames main window consists of tabs that display the knowledge model's various aspects. The most important tab when you start a project is the Classes tab. Usually classes will correspond to objects, or types of objects, in the domain. In the newspaper example, classes include people, such as editors, reporters, and salespeople, components of the newspaper layout, such as sections, and newspaper content, such as advertisements and articles.
Classes in Protege-Frames are shown in an inheritance hierarchy, displayed in the Class Browser in the left part of the Classes tab. The properties of the class currently selected in the tree are displayed in the Class Editor to the right.
In this section, you will learn how to create classes, subclasses, modify the class hierarchy, make classes abstract, and add additional superclasses to existing classes.
Creating the Columnist class
Creating the Author class
An
Author is any possible source of an article, such as a news service or columnist. To create the
Author class:
- Highlight the class :THING. If you do not do this, you will create a class that is a subclass of Columnist.
- Click the Create Class
button and type Author.
- Hit Enter to complete and display your change.
Note: If you accidentally create a subclass of Columnist, you forgot to select :THING before you created the class. You can delete and recreate the Author class by clicking the Delete Class button (fourth from the left, at the top of the Class Hierarchy area) to delete the class, and then clicking on :THING and creating another class. You can also rearrange the class hierarchy by dragging the class you created over :THING and then releasing the mouse button.
Creating subclasses of Author
Now we want to add two more sources of articles (
News_Service and
Editor), which we will create as subclasses of
Author.
- Select Author in the Class Hierarchy pane.
- Click the Create Class
button and rename the new class News_Service. Whenever you create a new class, it is created as a subclass of the currently highlighted class. Also notice that when you create the first subclass of a class, a
or
icon appears to its left. You can use this icon to display or hide the subclasses of a class. So that we can develop the ontology in later sections, we will create another subclass of Author.
- Select Author in the Class Browser.
- Click the Create Class
button and rename the new class Editor.
Modifying the hierarchy
At this point, you will see that
Author and
Columnist are at the same level (
siblings) in the hierarchy, while
News_Service and
Editor are subclasses of
Author. Conceptually, however,
News_Service,
Editor, and
Columnist are all at the same level of generality, while
Author is a more general concept. This goes against a principle of good ontology design:
all the siblings in a hierarchy (except for the ones at the root) should be at the same level of generality. Therefore, we want to modify our hierarchy to make
Columnist a subclass of
Author, which will more accurately reflect the underlying structure. To modify the hierarchy by making
Columnist a subclass of
Author:
- Click on Columnist and drag it over the Author class (Author will be outlined), then release.
-
Columnist is moved and now appears as a subclass of Author.
In this case, the mismatch may have been obvious. However,
when you create your own ontologies, the development process itself can reveal
differences or parallels that were not clear at the beginning. Therefore it is
likely as you go along that you will rearrange the hierarchy, as well as
create and delete classes, to better model the concepts you are trying to
capture.
Making a class Abstract
A class in Protege-Frames can be Concrete, meaning it can have direct instances, or it can be Abstract, which means that while it appears in the class hierarchy, it has no direct instances. When you first create a class, by default it is Concrete. Now that we know a little more about the
Author class, we realize any instance of
Author will actually be an instance of a particular type of author, such as a news service or columnist. Therefore, we will change the
Author class to be Abstract. To change the
Author class to be an Abstract class:
- Select Author in the Class Hierarchy. In the Class Editor to the right of the Class Browser, locate the Role menu, just below the name of the class.
- Click on the Role menu and select Abstract.
- Notice that when you change the class role, the icon in front of Author changes. This new icon
indicates an abstract class in the hierarchy. A solid icon
indicates a concrete class.
Creating the Employee class
Now we will to create another class,
Employee. An
Employee is any employee of the newspaper, whether or not they are an
Author. Note, however, that we are only interested in employees who are somehow involved in generating and managing newspaper content. One of the choices you make in designing an ontology is what to leave out. While you want to make sure that you include all the concepts that are relevant, you don't want to complicate the hierarchy by adding classes that are superfluous. Therefore, while janitors may be technically employees of the newspaper, we would
not be interested in creating a subclass called Janitor.
- Select :THING in the Class Browser. Although some authors are employees, we do not want Employee to be a subclass of Author. In most cases, you should select :THING to create a top-level class in the hierarchy.
- Click the Create Class
button and rename the class Employee.
Adding an additional superclass to an existing class
As mentioned above, we want a
Columnist to be an
Employee. Since we have already created the
Columnist class, we do not create want to create it again. Instead, we make the existing
Columnist class a subclass of
Employee as follows:
- Select Columnist in the Class Browser.
- Find the Superclasses pane at the bottom left of the Protege window, under the Class Browser. Notice that when Columnist is selected, the current superclass of Columnist, Author, is displayed in the Superclasses pane.
- Click the Add Superclass
button at the top right of the Superclasses pane. A Select Classes dialog box displays all the classes you have created so far, organized in the class hierarchy.
- Highlight Employee and click OK. Columnist now has two superclasses: Author and Employee. Both superclasses are shown in the
Superclasses pane.
- Note that an icon
has appeared to the left of Employee. Click this icon to expand the children of Employee. Columnist now appears in two places in the Class Browser: once under Author and again under Employee.
Adding a superclass using drag-and-drop
You can also add a superclass using drag-and-drop:
- Select Editor in the Class Browser.
- Hold down the mouse button and drag the Editor class over Employee. Employee is outlined.
- Before releasing the mouse button, hold down the Ctrl key, then release the mouse button to drop the subclass.
To remove a superclass from a class, highlight the superclass you want to remove in the Superclasses pane and click the
Remove Superclass 
button. You are now ready to assign some attributes to the classes you have created, by creating
slots, which are covered in the next section.
Creating slots
In Protege-Frames, classes can be thought of as concrete concepts from the domain, such as
Editor and
Columnist. Classes are more than simple
objects arranged in a hierarchy. They can also have attributes, such as a name, phone number, or salary, and relations between them, such as the
Author of an
Article.
Class attributes and relations are described using
slots. In the following sections you will learn how to create slots, assign slots to classes, describe relationships between classes using slot, and how slot inheritance works.
Creating a slot at the Slots Tab
There are several ways to create a slot. One way is to create a slot using the Slots Tab and then assign it to one or more classes. To create a slot called
name using the Slots Tab:
- Click on the Slots Tab. Notice that the Slots Tab has a layout similar to the Classes Tab, with the slots listed on the left, and a Slot Editor, showing slot properties, on the right.
- Click the Create Slot
button at the top right of the Slot Hierarchy pane. A new slot is created. Just as when you create a class, the slot is given a generic name, such as "tutorial_Slot_0". This name is automatically highlighted in the Slot Editor when the slot is first created.
- To name the slot, make sure the generic name is highlighted in the Name field of the Slot Editor. Type the name for the slot, name. A recommended convention is to make slot names lowercase, with words separated by an underscore. Making slot names lowercase, while making classe names start with an uppercase letter, helps you distinguish them in your ontology.
- Notice that this slot has the default Value Type String. The value type places restrictions on the type of values a slot can have. A String slot 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 facets in the Slot Editor.
Assigning a slot to a class
All we have done so far is create a slot which defines the general attribute
name. To truly incorporate it in our ontology, we need to assign it to a class, e.g., we want every instance of the
Author class to have a name.
To do this, we will return to the Classes Tab and edit the
Author class. Any attributes you create or assign to a class are displayed in the Class Editor, to the right of the Class Browser. We have already used the Class Editor to change the name of the classes we have created, and also to change the role of the
Author class to Abstract. Now we will use the Class Editor to view and name slots.
To assign the slot
name to a class:
- Click on the Classes Tab.
- Highlight the class Author in the Class Hierarcy pane.
Take a moment to look at the Class Editor to the right. This area has a Name (which we have already changed to Author), the role (Abstract), as well as documentation and constraints. Below these fields is the Template Slots pane, which takes up the entire lower half of the Class Editor pane. This is the area that lists all the slots assigned to a class. Currently it is empty.
- To add the slot to the class, click the Add Slot
button. The slot buttons appear at the far right of the Protege-Frames window, just above the Template Slots pane.
- When you click the Add Slot button, the Select Template Slots dialog box displays all the slots in your project in alphabetical order (with the exception of the Protege system classes, which are listed at the bottom of the slot hierarchy).
- Select name and click OK.
If you look at the Template Slots for Author, you see that name has been added to the list of Template Slots, along with its properties, in this case, its cardinality (an author can have only one name) and the slot type, String.
Creating a slot in the Classes Tab
Slots and inheritance
We do
not have to assign the
name slot to every class where we want it to appear. Any subclass of a class automatically inherits all the slots of the superclass. For example, if you click on the
News_Service class, you can see that:
a) the
name slot has already been assigned to this class through inheritance
b) the slot icon is different than it was for
Author, i.e., the " inherited slot" icon

shows that the slot has been inherited
Note: In the Protege-Frames menu bar, click Help | Icons to see a list of all the icons in the Protege User Interface, along with textual descriptions of what the icons mean.
Classes with more than one superclass inherit the slots from both classes. For example, if you click on the
Editor class, you can see that it has inherited the
name slot from
Author, and the
salary slot from
Employee. This multiple inheritance is an essential part of Protege-Frames.
Creating slot facets
The slots we have created so far are very simple. However, slots themselves can have properties. For instance, a salary is always a number. You can also use slots to create relationships between classes. The properties of a slot, called facets, can be created and edited either from the Classes Tab using the slot specification dialog, or from the Slots Tab in the Slot Editor pane.
Defining slot facets for salary
We can define some facets for the
salary slot we created earlier.
- Select the Employee class in the Class Hierarchy pane.
- Double-click on the salary slot in the Template Slots pane to open the slot form. A dialog box asks you to select the Slot View. When you edit a slot, you
can choose whether your edits will apply to the slot and all classes with that slot -- to the "top-level" slot -- or whether you just want them to apply to this class and all of its children.
- In this case, we want to view and edit the top-level slot. Make sure that the View top-level slot option is selected and click OK. This will change the definition of the slot everywhere it appears in the ontology.
- In the resulting slot form, select Float from the Value Type menu at the left. When you create instances, you will only be able to enter a valid floating point number for this slot.
- Enter 0 (zero) in the Minimum field at the lower left. This specifies that for each instance of Employee, the value that is entered for salary must be non-negative.
- Close the Edit Slot dialog box. You can see that the description of the slot has changed in the Template Slots pane. The type is now set to Float, and the minimum value of 0.0 appears in the Other Facets column.
Note: Making edits at the top-level slot means that you are modifying the fundamental definition of the slot. It is the same as making changes at the Slots Tab. If you select the View slot at class option instead, any changes you make will only apply to this class and its children. For example, if you started a program that allowed people to pay to intern at the newspaper, you could create a new subclass of Employee, Paying_intern, open the salary slot, select View slot at class, and delete the minimum value. This would create a "slot override", which would only affect Paying_intern, while other employees would still be required to make a non-negative salary.
Creating a relationship using slots
Protege-Frames also allows you to create slots that can be used to describe relationships between classes that are not defined by the class hierarchy. This can be done using slots of type Instance or of type Class. For example, an editor may be
responsible for one or more employees. We can create a slot that represents this relationship between the
Editor and
Employee classes as follows:
- Select Editor in the Class Hierarchy pane.
- Click the Create Slot
button to create and attach a new slot to Editor.
- In the resulting slot form, type responsible_for in the Name field.
- Select Instance from the Value Type menu.
A new field, Allowed Classes, is displayed below the Value Type menu.
- Click the Add Class button that appears at the top right of the Allowed Classes area. A Select Classes dialog box displays all the classes in the project. Select Employee and click OK.
- To allow an editor to be responsible for more than one employee, click multiple in the Cardinality area to the right of the Value Type area.
After completing steps 1 through 6, the slot form for
responsible_for looks as follows:
What have we done? We have created a slot that can hold one or more
instances of the
Employee class as its value. Later, when we create an instance of the
Editor class, and we want to specify who that editor is responsible for, we can choose one or more instances of the
Employee class to fill in the value of the
responsible_for slot.
Entering instances
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.
Setting the display slot
For each class in your ontology, you can specify one of its slots to be a
display slot. Protege will display the value of this slot any time it displays instances of the class. If you do not set a display slot, Protege will display the underlying system generated name for your instances such as "tutorial_Instance_0". It is usually very helpful to set a display slot for all classes that will have instances. In fact, you may choose to set the display slots for your classes before you even start creating instances.
To set the display slot for the
Editor class:
- Select the Instances Tab.
- Select Editor in the Class Hierarchy pane.
- Click the Instance Menu icon (arrowhead that points downward) at the top right of the Instance Browser.
- Select Set Display Slot from the menu.
- Select name from the Display Slot menu.
- The display of the list of instances in the Instance Browser changes to reflect the display slot you have chosen. Instances of the Editor class are now listed by the value of the name slot. (Instances are always displayed by alphabetical or numerical order). From now on, you will be able to browse instances of Editor by name in the Instances Tab, and everywhere else in the Protege User Interface where lists of instances are displayed.
Creating a relationship between instances
Customizing a form
For each class in your ontology, Protege generates a default form that you can use to enter instance data. Forms contain a data entry field, or "widget" for each slot that is attached to a class. There are different types of widgets to handle the various slot value types, e.g. Protege assigns a "TextFieldWidget" to slots with String value types, an "IntegerFieldWidget" for slots with Integer value types, an "InstanceListWidget" for slots with Instance value types and cardinality multiple, etc.
If you do not like the default form that Protege generates for your class, you can customize it via the Forms Tab. Among other things, you can resize widgets, drag widgets to different locations on the form, hide widgets, and even select different widget types.
To dynamically see how the changes you make in the Forms Tab in the next sections are reflected in the Instance Editor, go to the Instances Tab, and double-click on
Chief Honcho in the Instance Browser to display a separate, modeless Instance Editor window. Please note that if you created the slots for the
Editor class in a different order than was outlined in this tutorial, your form may not look exactly like the screenshots in the following sections.
Resizing a widget
Moving a widget
You can also move any widget via dragging:
- Select the InstanceListWidget for the responsible_for slot.
- Drag it to the top right of the form, so that the top of the widget aligns with the top of the widget for the name slot.
Customizing widget buttons
Hiding a widget
You can hide a widget so it cannot be seen in the Form and Instance Editors (this does
not remove any information from your ontology). For example, you might want to hide the widget for the
salary slot. To do this:
- Select the FloatFieldWidget labeled Salary in the Form Editor.
- Select "<none>" from the Selected Widget Type combo box.
- The widget for the salary slot is no longer visible on the Form Editor.
Displaying a hidden widget
Using the default layout
If you are unhappy with any form customizations that you have made, Protege-Frames provides a short-cut to rearrange all the visible widgets on a form into a standard order, accommodating their current size.
To have Protege-Frames auto-arrange all the widgets back to the default layout:
- Make sure Editor is selected in the Form Browser.
- Click the Remove Form Customizations button
at the top right of the Form Browser.
- The form adjusts to show the default layout. If you have hidden any widgets, they will be redisplayed. Notice also that the icon in front of Editor has changed back to the default form icon
.
Creating and saving a query
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.
Creating a query
Running a query
Now that you have set up your query, you can run it and view the results.
- To run the query, click the Find button near the bottom right of the Query pane.
- The results are shown in the Search Results pane at the far right. If you cannot see the results, you may need to enlarge your window or move the slider bar.
Note: You can double-click on any instance in the Search Results pane to view the Instance Editor.
Saving a query
Retrieving a query