Ontology Generation and Visualization with Protégé

Image for post
Image for post

With a philosophically implied meaning of “subject of existence”, the word “ontology” seems to generate a profusion of controversy in discussions about AI. It is also often confused with epistemology, which is about knowledge and knowing. However as a formal definition,T. R. Gruber illustrates ontology as a formal and explicit specification of a shared conceptualization. That is, an ontology is a description (like a formal specification of a program) of the concepts and relationships that can exist for an agent or a community of agents.

In this article, it is expected the reader to have a basic understanding on ontologies and ontology specification. The following sections illustrate the use of Protégé editor to generate and visualize an ontology with basic ontology definition concepts being covered. We will be looking in to creating a simple university ontology and later visualize it within Protégé editor through the use of VOWL Plugin.

Following diagram indicates the final ontological hierarchy that will be built at the end of this article.

Image for post
Image for post
Figure 1 : Final Ontology view

What is Protégé and how to set it up

Follow the below steps to get Protégé up and running.

  1. Download Protégé from here and extract it.
  2. Go inside the extracted folder and click protege.exe to run Protégé.

Creation of Ontology

Image for post
Image for post
Figure 2: Entities tab view

In this example, we will be looking into creating an ontology based on very basic concepts/scenarios in a university.

1. Teachers teach modules

2. Students study modules.

With those two concepts in hand, following classes, data properties, object properties and individuals could be identified.

Classes

Classes in ontologies are abstract groups, sets or collections of objects.

Image for post
Image for post
Figure 3 : Classes

Object Properties

In object properties we are concerned with describing how classes can relate to each other based on their instances.

Image for post
Image for post
Figures 4 : Object Properties

Data Properties

Data properties are just like object properties except their domains are typed literals.

Image for post
Image for post
Figure 5 : Data Properties

Individuals

Individuals (instances) are the basic, “ground level” components of an ontology.

Image for post
Image for post
Figure 6: Individuals

For the simplicity purpose, certain data properties are omitted by intention.

Next step involves creating the identified classes, data properties, object properties in the ontology.

Creating Classes

  1. Click on the classes tab and open the class hierarchy.
  2. Note that all classes identified above are sub classes of “Thing” class by default.
  3. Click on “Add subclass” icon and in the pop up menu, give the name of the class.
Image for post
Image for post
Figure 7 : Create class pop up

Remember to follow the class taxonomy identified in Figure 3 in creating the classes here. For an example, Class “Teacher” should be a sub class of “Person” class where “Person” class is again a subclass of “Thing” class. After creating class taxonomy, you should have the following class hierarchy defined.

Image for post
Image for post
Figure 8 : Class hierarchy

Creating Object Properties

To create the identified object properties in the Figure 4, select the Object Properties tab and click on “Add sub property” icon. Note that all properties will be sub properties of the “topObjectProperty” by default.

Image for post
Image for post
Figure 9 : Add new object property

However it should be noted that we can add domain and range to these object properties.

Syntactically, domain is a built-in property that links a property to a class description. An domain axiom asserts that the subjects of such property statements must belong to the class extension of the indicated class description.

Range is a built-in property that links a property to to either a class description or a data range. An range axiom asserts that the values of this property must belong to the class extension of the class description or to data values in the specified data range.

Hence for the object property “studies” we can add “Student” as the domain and “Module” as the range.

Image for post
Image for post
Figure 10 : Add domain and range for object property “studies”

To add domain or range, simply click on the + button near the required item and select the items you want to add.

Image for post
Image for post
Figure 11 : Select domain or range for “studies” object property

In the same way, for the object property “teaches” we can add “Teacher” as the domain and “Module” as the range.

Image for post
Image for post
Figure 12 : Add domain and range for object property “teaches”

Creating Data Properties

The next step is to create the identified data properties in Figure 5. To do this, simply click on the “Data Properties” tab and click “Add sub property” icon. Note that all properties will be sub properties of the “topDataProperty” by default.

Image for post
Image for post
Figure 13 : Add new data property

After adding all the data properties identified, you should get the following overview.

Image for post
Image for post
Figure 14 : Data property final overview

In the same way, we did with object properties, we can define domain and range for each data property as well. However, in the range selection, rather having a class description,need to add a data types. For an example,

“first_name” data property has the range of “xsd:string”.

To add this data types click on the + button near “Range”and select “Built in data types” and select the relevant data type from the given list.

Image for post
Image for post
Figure 15 : Select the range for first_name

Add the following ranges to the other identified data properties as well.

first_name → xsd:stringlast_name  → xsd:stringindex_no   → xsd:intstaff_id   → xsd:int

Adding Individuals

The final task in creating the ontology is adding individuals. To do this, click on the “individuals” tab and click on the “Add individual” icon.

Image for post
Image for post
Figure 16 : Add new individual

First, let’s create a “Module” individual. Follow the below steps to set the individual properly.

  1. Create the “Module” individual “CS2341”.
  2. Add the Type for the “CS2341” as “Module”.
Image for post
Image for post
Figure 17 : Define “CS2341” module individual

Do the same for other two modules “CS4032” and “MA4124”.

Secondly, let’s add individual “Student_1”. Follow the below steps to set the individual properly.

  1. Create the individual “Student_1”.
  2. Add the Type for the “Student_1” as “Student”.
  3. Add the object properties for “Student_1”.
Image for post
Image for post
Figure 18 : Adding object properties to “Student_1”

4. Add the data properties to the “Student_1”. Refer below image for more details.

Image for post
Image for post
Figure 19 : Add first_name data property to Student_1

First select the “first_name” data property and then select type as “xsd:string”. Finally add the the value in the space provided (in the above example value = Vindula). Do the same for other data properties as well.

After finishing the above iterative process you should get the “Student_1” individual as below.

Image for post
Image for post
Figure 20 : Final “Student_1” setting

In the same way create the other individuals identified in Figure 6.

If you have completed the above steps correctly, Congratulations!! you just created the university ontology. Now the next step is visualization of the created ontology. Alternatively you could download the created ontology as an OWL file by File → Save As → OWL/XML Syntax.

Visualization of the Ontology

That’s it. Simply click the “VOWL” tab in the Protégé and you could see the ontology created in graphical manner as below.

Image for post
Image for post
Figure 21 : Final Ontology view

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store