Overview of OWL 1 and OWL 2 features

This page is a chapter from our teaching guide
"Introduction to Ontology Modeling" (click to go to the full version in PDF format).

Previously, we very superficially examined the basic concepts of RDF/RDFS/OWL related to the description of classes, properties, relationships and individual objects. It's time to learn in more detail what technical modeling tools the OWL standard offers, but to do this we must first consider one feature of RDF that we have not mentioned - the ability to create groupings of objects that are not classes.

So, RDF allows you to declare containers of three types:

1. rdf:Bag, which combines model elements or literals without specifying the order in which they appear in the group.

2. rdf:Seq, which does the same thing, indicating the order of the elements.

3. rdf:Alt, representing a group of model elements or literals that are in a certain sense alternatives - for example, for a certain value of some property. For example, this method can be used to indicate a list of Internet pages where you can get some information. When using such a container, the application can prompt the user to select any of the options it contains.

All these methods are used, as a rule, to indicate the values ​​of some properties. For example, if a group contains multiple students, the value of the "has a student" property for the group could be one of the listed containers that group specific students.

All of the grouping methods listed do not claim that the groups created contain only the members listed—in other words, that the groups are “open.” RDF collections are used to create “closed” groups that contain a clearly defined number of elements. To indicate that a particular container is a collection, use the rdf:parseType="Collection" attribute. We will not dwell on the specific syntax that can be found in the standard and numerous examples for it - for us, the mention of collections is important because they will be required when talking about the capabilities of OWL itself.

First of all, note that OWL defines two predefined classes - owl:Thing and owl:Nothing. The first of them unites all individual objects of the model, and its subclasses are all its classes. The second has no instances, and is a subclass of any ontology class.

Let's start the review by looking at ways to declare classes. We said that a class is a named (or anonymous) group that groups together individual objects or other classes. So far we have only used one way of declaring them; meanwhile, OWL 1 offers as many as six of them.

1. Declaring a class by identifier is an already familiar way of explicitly declaring a named class.

2. Transfer. In this case, the class is specified by an explicit enumeration of the individual objects included in it. In RDF/XML syntax, such a definition might look like this:

<owl:Class rdf:ID="#TerrestrialPlanet">
  <owl:oneOf rdf:parseType="Collection">
    <owl:Thing rdf:about="#Earth"/>
    <owl:Thing rdf:about="#Mars"/>
    <owl:Thing rdf:about="#Venus"/>
    <owl:Thing rdf:about="#Mercury"/>
  </owl:oneOf>
</owl:Class>

With such a declaration (as well as with all subsequent ones), the class can also be anonymous, i.e. does not have to have an identifier.

3. Restriction on properties. Declares an anonymous class that consists of all individual objects that satisfy a certain condition. Conditions can be of two types. The first of them is formulated as “all individual objects for which the value of a certain property is an object of a certain type.” For example, this way you can select a class of objects that refer by some specific property to objects of the “Process” class, in order to highlight all entities associated with processes in the model. In RDF/XML the condition might look like this:

<owl:Restriction>
  <owl:onProperty rdf:resource="#usedInProcess" />
  <owl:allValuesFrom rdf:resource="#Process" />
</owl:Restriction>

The owl:allValuesFrom condition states that all values ​​of the usedInProcess property of matching objects must point to objects of class Process. The nuance here is that OWL uses the concept of “open world”, according to which it is believed that the ontology we have does not describe all the information - there is something we may not know. This directly affects the application of inference rules. For example, the fact that all the values ​​of the usedInProcess property of a particular object belong to the class Process does not in itself make it a member of the class for which the constraint is described: it is assumed that there may be other values ​​of the usedInProcess property that our model simply does not know about. In order for the output to be obtained, the statement must be "closed". To do this, you need to describe the limit on the number of values ​​that the usedInProcess property can take. If it is known that it takes at most one value, that value is set, and points to an object of the Process class, then the output will take place.

The someValuesFrom condition is described in a similar way, which states that at least one of the values ​​of the specified property must fall within the specified range. For example, this way we can describe the fact that the members of the “Employee” class, which is a subclass of the “Persons” class, are all objects that have the “works at” property value equal to any object of the “Organization” class:

<owl:Class rdf:about="#Employee">
    <owl:equivalentClass>
        <owl:Restriction>
            <owl:onProperty rdf:resource="#worksIn"/>
            <owl:someValuesFrom rdf:resource="#Organization"/>
        </owl:Restriction>
    </owl:equivalentClass>
    <rdfs:subClassOf rdf:resource="#Person"/>
</owl:Class>

Another variant of the condition, owl:hasValue, states that the value of the property must correspond to a specific individual object. For example, this is how you can classify all subsidiaries of a certain holding company:

<owl:Restriction>
  <owl:onProperty rdf:resource="#hasOwnerOrganization" />
  <owl:hasValue rdf:resource="#AAAHolding" />
</owl:Restriction>

The second type of restriction is imposed on the number of values ​​that a property can take. For example, a football team consists of 11 players; Therefore, you can declare a class consisting of objects whose property “has a player” takes 11 values ​​- this would be the class of football teams. You can describe conditions for the minimum, maximum and exact number of values ​​using the terms owl:minCardinality, owl:maxCardinality and owl:cardinality:

<owl:Restriction>
  <owl:onProperty rdf:resource="#hasParent" />
  <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">2</owl:maxCardinality>
</owl:Restriction>

A very important point is connected with this: the description of restrictions in the ontology does not actually impose any restrictions on what values ​​certain attributes can take. Instead, constraints assert that all objects for which they are satisfied belong to a particular class. For example, in the case of the above constraint, nothing will prevent us from assigning three parents to one object. However, if we create an object “Friend”, whose parent we declare the object “Bobik”, then we will be surprised to find in the results of logical inference that “Friend” is a person - after all, it has no more than two parents, and we imposed the restriction specifically on the “Human” class.

4. Intersection of two or more classes. By “intersection” we mean objects that are included in all of the listed classes at the same time (logical “AND”). For example, the intersection of the “Museum” and “Palace” classes will be palaces operated as museums - the Hermitage, the Louvre, etc. The Tretyakov Gallery and the Grand Kremlin Palace will not fall into this intersection. In RDF/XML, an intersection is declared like this:

<owl:Class>
  <owl:intersectionOf rdf:parseType="Collection">
    <owl:Class rdf:about="#Palace"/>
    <owl:Class rdf:about="#Museum"/>
  </owl:intersectionOf>
</owl:Class>

5. Combining two or more classes. The merging operation corresponds to the logical “OR”: its result will be all individual objects included in at least one of the merging classes. So, you can declare the pet class as a union of the cat and dog classes:

<owl:Class>
  <owl:unionOf rdf:parseType="Collection">
    <owl:Class rdf:about="#Cat"/>
    <owl:Class rdf:about="#Dog"/>
  </owl:intersectionOf>
</owl:Class>

6. Addition of class description. This operation corresponds to the logical NOT: its result is all individual objects that do not belong to the specified class. For example, we can declare the class "Objects" to be everything that is not "Subjects":

<owl:Class>
  <owl:complementOf>
    <owl:Class rdf:about="#Subject"/>
  </owl:complementOf>
</owl:Class>

The composition of members of classes declared in the ways described in paragraphs. 4-6, can only be determined by an inference machine.

Once classes are described, logical statements can be made about them—class axioms. There are three types of such axioms:

1. Is a subclass (rdfs:subClassOf) – we are already familiar with this type of statement about a class. In combination with a class declaration by imposing restrictions on properties, it allows you to set specific restrictions on the properties of members of certain classes:

<owl:Class rdf:about="#Company">
  <rdfs:subClassOf>
    <owl:Restriction>
      <owl:onProperty rdf:resource="#hasDirector" />
      <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality>
    </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>

This example asserts that the class "Company" is a subclass of an anonymous class whose members have exactly one property value "has a Director". Therefore, every company must have exactly one director. Let us recall that each class can be a subclass of any number of classes at the same time - this allows, among other things, to impose several similar restrictions at once.

2. Class equivalence, owl:equivalentClass. This expression allows us to state that two classes with different identifiers have exactly the same values.

3. Disjointness of classes, owl:disjointWith. Such a statement states that two classes do not have common members - for example, the classes “Dogs” and “Cats” are disjoint.

Let's move on to the story about the properties. As we remember, properties in OWL come in two main types: literal properties (owl:DatatypeProperty) and relationship properties (owl:ObjectProperty). Both are subclasses of properties in general: rdf:Property. In addition to them, there are additional, service types of properties, such as owl:AnnotationProperty.

Properties can form hierarchies just like classes, using the rdfs:subPropertyOf axiom. For example, an ad

<owl:ObjectProperty rdf:ID="isMother">
  <rdfs:subPropertyOf rdf:resource="#isParent"/>
</owl:ObjectProperty>

means that the property “is a mother” is a specialization of the property “is a parent.” Therefore, according to the rules of logical inference, if A is the mother of B, then A is also the parent of B, but not vice versa.

Interestingly, in OWL DL literal properties and relationship properties are separated, but in OWL Full literal properties are a subtype of relationship properties.

The axioms rdfs:domain and rdfs:range, already familiar to us, are used to indicate the classes to which objects a given property applies, and the ranges of property values. It is important to note that specifying several domain and range for a property is interpreted as if there is a logical “AND” operation between them, that is (in the case of domain) only objects that simultaneously belong to all of the listed classes can have the property - this feature of the standard is also not very intuitive. If you want to express the fact that a property can be possessed by a union of subclasses, you must use owl:unionOf:

<owl:ObjectProperty rdf:ID="hasBankAccount">
  <rdfs:domain>
    <owl:Class>    
      <owl:unionOf rdf:parseType="Collection">
        <owl:Class rdf:about="#Person"/>
        <owl:Class rdf:about="#Organization"/>
      </owl:unionOf>
    </owl:Class>    
  </rdfs:domain>
</owl:ObjectProperty>

In this case, it is argued that the owner of a bank account can be both individuals and organizations.

The axiom owl:FunctionalProperty is a “global constraint”: it states that each bearer of this property can have one and only one value of it. Owl:FunctionalProperty is a subclass of rdf:Property. In order to declare a property functional, you need to assign it to this type, along with the main type it has - ObjectProperty or DatatypeProperty:

<owl:ObjectProperty rdf:ID="husband">
  <rdf:type rdf:resource="&owl;FunctionalProperty" />
  <rdfs:domain rdf:resource="#Woman" />
  <rdfs:range rdf:resource="#Man" />
</owl:ObjectProperty>

This example states that each woman can only have one husband.

There may also be inverse functional properties, owl:InverseFunctionalProperty - in this case, only one relationship of this type can point to each object. For example, the expression

<owl:InverseFunctionalProperty rdf:ID="biologicalMotherOf">
  <rdfs:domain rdf:resource="#Woman"/>
  <rdfs:range rdf:resource="#Human"/>
</owl:InverseFunctionalProperty>

states that each person has only one biological mother, with the property “is a biological mother” pointing from a woman to a person.

Properties can be in certain relationships with each other. The expression owl:equivalentProperties states that two properties with different identifiers have the same meaning. The expression owl:inverseOf indicates that one property is the inverse of another:

<owl:ObjectProperty rdf:ID="hasChild">
  <owl:inverseOf rdf:resource="#hasParent"/>
</owl:ObjectProperty>

Obviously, if A is the parent of B, then B is the child of A. Such statements form one of the rules taken into account by inference machines.

Finally, properties themselves can have certain logical characteristics. A property can be transitive, owl:TransitiveProperty - this means that if A is associated with a certain property with B, and B with C, then A is associated with the same property with C. Such a declaration is useful for automatic calculation on descriptions of nested structures. For example, when describing the composition of a product, we will use the “is part” property to decompose it to the level we need. For example, a power plant turbine can be recursively decomposed into assemblies, components, etc., but it is clear that the very last bolt is part of the turbine as a whole, and not just its specific assembly. This is why the definition of a transitive property comes in handy:

<owl:ObjectProperty rdf:ID="isPartOf">
  <rdf:type rdf:resource="&owl;TransitiveProperty"/>
  <rdfs:domain rdf:resource="#Asset"/>
  <rdfs:range rdf:resource="#Asset"/>
</owl:ObjectProperty>

However, owl:TransitiveProperty is a subtype of owl:ObjectProperty, so it is not necessary to explicitly declare ObjectProperty in this case.

The property can be symmetrical: this means that if A has some connection with B, then B has the same connection with A. For example, for the relation “is a spouse” the entry would be:

<owl:SymmetricProperty rdf:ID="hasSpouse">
  <rdfs:domain rdf:resource="#Human"/>
  <rdfs:range rdf:resource="#Human"/>
</owl:SymmetricProperty>

Let's consider the features of OWL related to the description of individual objects. First of all, we note that individual objects, like classes, can be anonymous, that is, not have unique identifiers. This is not very convenient when working with them through SPARQL queries, since such entities are represented by empty nodes; however, the standard allows this way of working.

Another important point is that the same object can have several different identifiers in the model. By default, the inference engine is assumed to have no information to consider any two objects in the model to be equivalent or different. To explicitly indicate such facts, the expressions owl:sameAs, owl:differentFrom, and owl:AllDifferent are used. As the name suggests, owl:sameAs states the equivalence of objects:

<rdf:Description rdf:about="#LevNikolaevichTolstoy">
  <owl:sameAs rdf:resource="#Lev Tolstoy"/>
</rdf:Description>

The owl:differentFrom expression similarly declares the uniqueness of objects. Finally, owl:AllDifferent is a special OWL class whose inclusion of objects declares the fact that they are all unique to avoid multiple pairwise dissimilarities. An example might look like this:

<owl:AllDifferent>
  <owl:distinctMembers rdf:parseType="Collection">
    <Person rdf:about="#KarlMarx"/>
    <Person rdf:about="#FriedrichEngels"/>
  </owl:distinctMembers>
</owl:AllDifferent>

Everything we described in this chapter applies to the OWL 1 standard. The OWL 2 standard, adopted in 2012, significantly expands its capabilities. First, it defines three "profiles", each of which imposes certain restrictions on the capabilities of the language, with the goal of achieving acceptable performance in certain practical situations. Let's list the OWL 2 profiles:

1. OWL 2 EL is optimized for processing ontologies with a large number of classes and properties.

2. OWL 2 QL is more suitable for ontologies with a large number of individual objects.

3. OWL 2 RL is used in cases where it is necessary to achieve acceptable performance without significant loss of language expressiveness.

Let's list some of the most interesting functionality of OWL 2.

  • The ability to describe chains of properties, which allows, for example, to describe the relationship between three objects at once, which was so lacking in OWL 1. For this, the ObjectPropertyChain expression is used together with SubObjectPropertyOf. For example, if an ObjectPropertyChain links the properties “is in” and “is part of,” and this chain is a SubObjectPropertyOf for the property “is in,” then a turbine that is part of a unit located in shop #1 will be considered to also be in shop #1. Another classic example of the use of property chains is the “is uncle” relation, which is established when there are two relations between three subjects: A has a parent B, B has a brother C.
  • The ability to declare certain sets of properties as key (HasKey) - is used to state that each instance of a class is exhaustively identified by a set of values ​​of its key properties.
  • Explicit description of non-reflexive, non-symmetrical, separated properties (IrreflexiveObjectProperty, AsymmetricObjectProperty, DisjointObjectProperties).
  • Negative statements (for example, using the expression NegativeObjectPropertyAssertion you can write the axiom “Russia is not located in Africa”).

Having talked about the capabilities of OWL, we must mention its limitations.

One of the most important of them is the inability to perform calculations based on fuzzy logic. Indeed, we can directly write in the model the fact “It often rains in St. Petersburg,” but this will not allow us to automatically obtain the conclusion that it is raining in some cases and not in others. However, at the level of software working with the model, no one bothers to associate the predicate “often” with a specific function that will produce a certain distribution, on the basis of which the simulation system will alternately produce different weather options in St. Petersburg. In addition, you can specify a more formal description in the model itself, expressing information that the probability of rain during certain periods has a certain value. We demonstrate an example of such use of the model in Chapter 7.

Similar reasoning applies to modal logic, which allows not only to describe the actual state of systems, but also to express judgments about what could, should, and could be.

Similarly, the inability to express subjective point of view is sometimes cited as a weakness of OWL: “Ivan believes that penguins live in the Arctic.” Ivan, of course, is wrong, but it would seem that there are no tools to express this in OWL. However, no one bothers to create a class of objects “Opinion” in the model, which will connect the subject with those facts that he considers true.

Finally, describing exceptions may be a problem. The fact “birds fly” seems true at first glance, but chickens and penguins do not fly. This only means that the statement is formulated incorrectly and needs to be clarified. It is not birds that fly, but only certain types of them - this needs to be reflected in the model.

A really intractable problem for OWL is the representation of class statements. If “Dog” is a class, then it will be difficult to directly express the information that all dogs can bark. To do this, you will need to create a “Skill” class, one of the objects of which will connect the Dog class and the ability to bark. The software that uses the model will be able to interpret this information, but it will not be possible to use it to draw logical conclusions using a reasoner. Another solution to the problem is to create a rule that says that if X is a dog, then X can bark. This will work, but large sets of rules are difficult to manage, especially if the ontology is being refactored.

In general, the expressive capabilities of OWL, like any other modeling tool, are not exhaustive. However, given the current state of affairs in the field of creating and using models, it should be recognized that the full disclosure and implementation of even these possibilities in practice will give a level of quality of practical results that would be impossible to dream of without it. Then, when the shortcomings and limitations of OWL become a real obstacle to further improving the quality of results, it will be reasonable to raise the question of choosing or developing technologies at the next level.