Simple ontological models: individual objects and properties

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

As we remember, the main elements of semantic models are classes, individual objects, and properties. Let's look at creating individual objects (otherwise known as instances), defining properties, and assigning values ​​to properties of specific instances.

In Protégé, entities of all types are created in a similar way, only different editor tabs are used for this:

  • Classes – classes,
  • Individuals – instances,
  • Data properties – literal properties,
  • Object properties – pointer properties to objects.

The Entities tab allows you to see all these elements at once.

In RDF/XML, the resulting entities will differ in type, respectively:

  • http://www.w3.org/2002/07/owl#Class
  • http://www.w3.org/2002/07/owl#NamedIndividual
  • http://www.w3.org/2002/07/owl#DatatypeProperty
  • http://www.w3.org/2002/07/owl#ObjectProperty

For example, a triplet declaring an individual object might look like this:

http://example.ru/sample#SecondClassObjecthttp://www.w3.org/1999/02/22-rdf-syntax-ns#typehttp://www.w3.org/2002/07/owl#NamedIndividual

Of course, when creating an individual object, they usually indicate which classes it belongs to (we remember that an object can belong to several classes at the same time). In the Protégé editor, to do this, select the created object on the Individuals tab, and click the “+” button next to the word Types (lower right window). The class selection dialog box will open. The result of this operation looks like this:

Individual object - class member in the Protégé editor
Individual object - class member in the Protégé editor

By the way, note that for "Second Class" Protégé shows in its interface the value of its label property, not the unique part of the URI.

In RDF/XML, the fact that an object is included in a class will be reflected as follows:

    <owl:NamedIndividual rdf:about="http://example.ru/sample#SecondClassObject">
        <rdf:type rdf:resource="http://example.ru/sample#SecondClass"/>
    </owl:NamedIndividual>

Triplets in this case will look like this:

http://example.ru/sample#SecondClassObjecthttp://www.w3.org/1999/02/22-rdf-syntax-ns#typehttp://www.w3.org/2002/07/owl#NamedIndividual
http://example.ru/sample#SecondClassObjecthttp://www.w3.org/1999/02/22-rdf-syntax-ns#typehttp://example.ru/sample#SecondClass

Notice that the property definition in the second column is the same in both triplets! That is, the fact that an element of the SecondClassObject model belongs to the NamedIndividual class predefined by the standard, and is a member of the SecondClass class defined in this ontology, is expressed using the same property predefined by the standard. It follows, by the way, that the RDF/XML code can be rewritten like this:

    <SecondClass rdf:about="http://example.ru/sample#SecondClassObject">
        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
    </SecondClass>

The result of importing this code into the triple store will be exactly the same as in the previous case.

Let's move on to the story of how properties and their values ​​are specified in the model. Defining a property whose value is a literal goes like this. In the Protégé editor, you need to go to the Data Properties tab, create a new property - by the way, note that properties can have their own hierarchy. After this, using the lower right window, you need to set two fundamentally important property attributes: Domain and Range. Domain is a set of classes to whose instances this property applies. Range is the type of values ​​that a property can accept. Accordingly, the value for Domain is selected from the list of classes existing in our model, and Range is selected from the data types defined by the standard (XSD data types are used). A property can have several Domains and Ranges. In the editor window, the result of creating a property looks like this:

Literal property in the Protégé editor
Literal property in the Protégé editor

In a similar way, pointer properties to objects are created. To do this, use the Object Properties tab. Range in this case is also selected from the number of classes defined in the ontology.

For properties of both types, you can also set restrictions on the number of values ​​that a given property can have for a particular object (for example, a person can have several names, but only one date of birth). For this, the concept of Cardinality is used. To create a restriction, you need to click on the “+” button next to the word Ranges, and go to the Object (or Data) Restriction creator tab in the dialog box that appears. Here you need to select the property on which the restriction is applied, then the class(es) or type(s) of accepted values; At the bottom of the window, select the type of restriction - minimum or maximum number of values, and enter the number. For example, setting min cardinality = 1 will mean that the property must have at least one value per object. By default, any property can have any number of values ​​per object.

The result of saving a literal property definition in RDF/XML format looks like this:

    <owl:DatatypeProperty rdf:about="#shortName">
        <rdfs:domain rdf:resource="#OurFirstClass"/>
        <rdfs:range rdf:resource="&xsd;string"/>
    </owl:DatatypeProperty>

For a pointer property to an object:

    <owl:ObjectProperty rdf:about="#ObjectProp">
        <rdfs:domain rdf:resource="#OurFirstClass"/>
        <rdfs:range rdf:resource="#SecondClass"/>
    </owl:ObjectProperty>

Of course, property definitions should be given a label for readability.

Protégé does not store information about restrictions on the number of values ​​in RDF/XML in the most beautiful way:

    <owl:ObjectProperty rdf:about="#ObjectProp">
        <rdfs:domain rdf:resource="#OurFirstClass"/>
        <rdfs:range rdf:resource="#SecondClass"/>
        <rdfs:range>
            <owl:Restriction>
                <owl:onProperty rdf:resource="#ObjectProp"/>
                <owl:onClass rdf:resource="#SecondClass"/>
                <owl:minQualifiedCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minQualifiedCardinality>
            </owl:Restriction>
        </rdfs:range>
    </owl:ObjectProperty>

In triplets, this definition creates an empty node corresponding to the owl:Restriction tag. The following picture emerges:

_:b0
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.w3.org/2002/07/owl#Restriction
_:b0
http://www.w3.org/2002/07/owl#minQualifiedCardinality
"1"^^<http://www.w3.org/2001/XMLSchema#integer>
_:b0
http://www.w3.org/2002/07/owl#onClass
http://example.ru/sample#SecondClass
_:b0
http://www.w3.org/2002/07/owl#onProperty
http://example.ru/sample#ObjectProp

All we have to do is learn how to assign property values ​​to individual objects. In the Protégé editor, this is done in the Property Assertions area on the individual object view page. By clicking the "+" button next to Data property assertion and Object property assertion, we can open dialog boxes in which we need to select a property and enter a value for it. The result of this operation looks like this:

Assigning properties to individual objects
Assigning properties to individual objects

In RDF/XML format it will look like this:

    <owl:NamedIndividual rdf:about="#SecondClassObject">
        <rdf:type rdf:resource="#SecondClass"/>
        <shortName>Object name</shortName>
        <ObjectProp rdf:resource="#SecondClassObject"/>
    </owl:NamedIndividual>

For literal properties, you can (but are not required to) specify a value type. For example, if we explicitly indicate that the value of the shortName property is a string, it will be reflected in the file like this:

        <shortName rdf:datatype="&xsd;string">Object name</shortName>

In triplets, taking into account the type indication, the values ​​of the shortName and objectProp properties will be reflected as follows:

http://example.ru/sample#SecondClassObject
http://example.ru/sample#shortName
"Object name" ^^<http://www.w3.org/2001/XMLSchema#string>
http://example.ru/sample#SecondClassObject
http://example.ru/sample#ObjectProp
http://example.ru/sample#SecondClassObject

Note how the value type information is converted when imported into triplets: the suffix ^^ is added to the value itself.

It is worth noting some features of software that works with semantic models. Thus, when the inference engine is disabled, Protégé does not perform model integrity checks - for example, it does not check whether the property to which we are trying to assign a value is available for the object being edited. In other products, if such checks are still performed, there is no guarantee that they take into account the inheritance of properties from overlying classes to lower ones. Resolution of such issues remains at the discretion of the developers of each specific software product.

Triplet stores with reasoner disabled also do not perform any logical processing of the contents of the model, so the RDF and OWL formalisms have absolutely no meaning for them. Triple store will calmly accept erroneous and absurd definitions of any models. Instead of URIs, you can pass arbitrary strings - this is a formal violation of the standard, however, triple store does not bother you at all. For him, a triplet is a triple structure, any element of which can take on any meaning.

Next chapter: Simple ontological models: the big picture