Ontologies and Description Logic

In multi-agent systems, agents need to be able to communicate with each other, and for communication having a common vocabulary is important. Ontologies are such a vocabulary that additionally describes relations between different objects in the environment. If two agents decide to use the same ontology than both of them know what the other agent means whenever they use some expression.

More formally, an ontology contains individuals (roughly equivalent to constants in first order logic), classes (equivalent to unary relations), and binary relations between classes or individuals (equivalent to binary predicates). The most common binary relation between two classes is a subclass relation, where we define that a particular class is a subclass of another one. For example, we can have a class for animals, and a class for dogs. Dog would be a subclass of the Animal class. Additionally, we can for example specify that Rex is an individual from the Dog class (i.e. Rex is a dog). Now, whenever the agent obtains any information about animals (e.g. that all animals breathe), it can deduce that this information also applies to Rex.

The subclass relation is the most basic one and can be easily also expressed using inheritance between classes in programming languages. However, ontologies can be much more general. We can for example create an ontology about a university. In the university, we will have two types of people - students and teachers. Additionally, we can have a number of courses. We can now define a relation that expresses that a student attends a class and another one that expresses that a teacher teaches a class.

Every class in an ontology can have its own properties (e.g. people have names) and every property has a defined type which can be either one of basic types (string, integer, …) or a user-defined type.

Apart from direct definitions of classes, we can also define classes using expressions. For example, we could define a class for a large course such that it is a course that is attended by at least 50 students.

Let us have more practical look at the design of ontologies. We will design the university ontology described above from scratch using an ontology editor called Protégé.

Once you start Protégé, switch to the Entities tab and you can start creating entities. Every entity is a subclass of the owl:Thing entity. So, create the hierarchy described above (a class Person, with two sub-classes Student and Teacher and a class Course). Next, in the “object properties” tab, we can define the object properties (these are the relations between classes) - we will need attends and teaches for students attending courses and teachers teaching courses respectively. For each of these relations, we need to specify the domain and the range. We will also define inverse relations isAttended and isTaught. We can also add some data properties - like first_name, last_name, student_id, and teacher_id to relevant classes. And, finally, we can also add some individuals to the classes. This can be done in the “individuals by class” tab. So add some students (at least 4) and some teachers, and set some of them to attend/teach some courses (you will need to add courses for that).

We also mentioned that we can define new classes using expressions on old classes. We can, for example, define a class ActiveStudent as a student that attends at least 2 courses. To this end, we create the class ActiveStudent as a sub-class of Student and specify that the it is equivalent to the expression attends min 2 Course. The syntax for these expressions is quite simple, and a documentation is available on the Protégé website.

Finally, we can start using our ontology. To this end, we can start a reasoner (top menu, under reasoner, choose HermiT and start it) and we can start writing queries in so called description logic (DL) in the DL Query tab. The syntax of the queries is the same as above for defining classes. If you want to make queries like which students attend classes, make sure you select “query for instances” in the right panel.

Description Logic

Queries and conditions in ontologies are commonly specified in so called description logic. Description logic is an extension of propositional logic, but is not as strong as first order logic. More importantly (from practical point of view) it is decidable, i.e. for each formula in description logic we can tell if it is true or not. Very often, there are actually quite effective algorithms for deciding it.

The terminology of description logic is slightly different compared to ontologies – classes are called concepts in DL, and properties (binary predicates) are called roles. Individuals are still called the same, however.

In description logic, it is customary to divide the axioms into two groups, the ABox and the TBox. The ABox contains the axioms about classes and relations between them, while the TBox contains facts about individuals and into which class they belong and how they relate to each other. For example, the definitions of classes from our university ontology (including the ActiveStudent one) would belong to the ABox, while definitions of individuals and the relations between them (which student attends which class) belong to the TBox. Thus, the ABox is in a sense the description of the types of objects and general rules in the environment, while the TBox gives the description of a particular environment. ABox and TBox together are called a knowledge base.

Description logic allows us to write the types of definitions we used in the ontology above (domains and ranges of relations, intersections, unions, complements of classes, etc.). If you are interested in the formal syntax and semantics of description logic, you can check the Wikipedia page.

There is a number of different types that differ in which axioms and operations we can use on the classes and relations between them. These define the strength (and complexity) of the logic.