This course has already ended.

The latest instance of the course can be found at: Semantic Web: 2024 MOOC

SKOS and OWL

Creating a SKOS vocabulary

In this exercise we get acquainted with the ontology editor TopBraid Composer and use it to create a small SKOS (http://www.w3.org/TR/skos-reference/) vocabulary. First you should download the Free Edition of the editor from http://www.topquadrant.com/downloads/topbraid-composer-install/.

Extract the TopBraid Composer archive to your computer and run the editor with either:

  • TopBraid Composer.exe (Windows)
  • TopBraid Composer (Linux and OS X)

We will use TopBraid to Create a SKOS vocabulary of concepts. The concepts should be instances of the class skos:Concept.

Start by creating a new project (File → New → Project…) and a new RDF/OWL file (File → New → RDF File). Define a file name and check SKOS in the “Initial imports” section to get SKOS classes and properties available.

Also check “Set a default namespace in the new file” to be able to write URIs of your own resources as local names. Click Finish and set “Default Namespace” in the “Ontology Overview” view to the Aalto University namespace https://aalto.fi/, where your vocabulary’s URIs will be placed.

biological family hierarchy grouped by consumption classification:

biologicalFamily
--<omnivore>
----ursidae
------brownBear
----suidae
------domesticPig
--<carnivore>
----ursidae
------polarBear
----felidae
------tiger
------domesticCat
----canidae
------wolf
------domesticDog
--<herbivore>
----ursidae
------giantPanda
----suidae
------giantForestHog

Your task is to define a concept hierarchy of the above biological family hierarchy using the property skos:broader. The created concepts should all have name (skos:prefLabel).

Concepts marked with < > in the hierarchy description are grouping concepts. Create these as instances of the class skos:Collection, they are not a part of skos:broader hierarchy, instead skos:member is used to assign animals to grouping concepts.

Define resource names exactly as they are described in the hierarchy tree. Be careful with typos as the automatic tests are still extremely strict with them.

By default the TopBraid Composer shows concept hierarchies by the property rdfs:subClassOf. You can view a SKOS hierarchy by clicking skos:broader property in Properties view (the right-most tab in the default window setup).

The skos:broader can be found under skos:semanticRelation and skos:broaderTransitive. Right-click the skos:broader and select “Show in Associations view”. This will open a skos:broader hierarchy view.

A handy way to build a hierarchy is to start creating the vocabulary from the hierarchy view. In the hierarchy view, click option “Create new top-level node…” and create the hierarchy’s topmost concept (biologicalFamily).

Show/hide example image

An example view of the TopBraid app when creating a new top-level node (on linux with dark theme):

../_images/ex3.1_topbraider_create_top_level_node_example.png

Subconcepts can be defined by right-clicking and selecting “Create new child…”. An existing concept can be added as a subconcept by selecting “Add child…”. Continue this until the whole hierarchy is ready.

You can add a grouping concept by right-clicking skos:Collection from the Classes view (under owl:Thing), and selecting “Create instance…”. You can attach concepts to a grouping concept with the skos:member property by clicking the triangle next to the property name and choosing “Add existing…” in the Resource form (in the middle of screen) of a created Collection instance. Please note that the grouping concepts are not visible in the skos:broader hierarchy view.

Create a skos:ConceptScheme instance to represent your vocabulary by clicking the skos:ConceptScheme (under owl:Thing) in the Classes view, and choosing “Create instance…”. Give your vocabulary a name and define a topmost concept (biologicalFamily) with skos:hasTopConcept property.

A+ presents the exercise submission form here.

Creating an OWL ontology

  1. Creating an ontology with a text editor.

Create an ontology using the OWL functional syntax (http://www.w3.org/TR/owl2-syntax/), in which a Person class has subclasses Man and Woman. Then define a property hasChild that can be used to describe who is whose child. Create the below family tree using hasChild relations, in which the arcs point from parent to his/her child. The names Saara, Maija, Seija, and Soile refer to females while Matti, Mikko, Simo, Mika, Sauli and Martti refer to males.

../_images/ex3.2_family.png

You can use the W3C family example ontology as a reference, which has been created using the functional syntax.

More instructions for creating OWL ontologies, and examples of using the functional syntax can be found from the OWL 2 Primer document.

Some of the relations are added with assertions e.g. ObjectPropertyAssertion( :hasChild :Mother :Child )

Use empty prefix for the created resources e.g. Prefix(:=<https://aalto.fi/owl/families/>)

Convert your Functional OWL to turtle for submission with OWL Syntax Converter service.

A+ presents the exercise submission form here.

  1. Simple inference of instances.

Continuing from part a, define a class Mother, whose instances are women with at least one child. You may infer the instances of the Mother class with the OWL RL Reasoner service for manual checking.

You can transform the functional syntax OWL ontology to the Turtle format required by the Reasoner service with the OWL Syntax Converter service.

In the OWL RL Reasoner service, it is useful to tick the the checkbox “Send form as HTTP POST (needed for large RDF data)” as your ontology in Turtle format may be too large to be transferred via a GET parameter.

A+ presents the exercise submission form here.

  1. Creating a chain rule.

Define a hasGrandchild relation by using the hasChild relation. Then define a class Grandparent, whose instances can be inferred with the OWL RL reasoner service using the hasGrandchild relation. In the above image, an rdf:type arc to class Grandparent should be inferred from Martti and Soile.

A+ presents the exercise submission form here.

  1. Properties of properties.

Define for the hasChild-attribute an inverse property hasParent, and a transitive superproperty hasAncestor.

Define a symmetric property hasSpouse, which is also an inverse functional property. Define Martti as the spouse of Soile.

Define your hasChild property as an equivalent property with the property bio:child defined in the BIO vocabulary http://purl.org/vocab/bio/0.1/, which is a vocabulary for representing biographical knowledge.

To check that your OWL is correct, you can infer the parents, ancestors, bio:child relations and the spouse of Martti using the OWL RL Reasoner service.

A+ presents the exercise submission form here.

  1. Inference with datatypes.

Inference is also possible with datatypes. Define a class Teenager as a person, whose age is 13-19 years. Give the following ages to persons:

Matti: 15
Mikko: 18
Saara: 21
Simo: 2

To infer using the OWL RL reasoner service for manual checking, that Matti and Mikko belong to the Teenager class, but Saara and Simo don’t, you have to use the “Extra OWL Processing” option, which requires you to disable “OWL 2 RL + RDFS Processing” and enable “OWL 2 RL Processing”.

A+ presents the exercise submission form here.

Shortly describe what benefits and challenges do you think each of the syntaxes has. You don’t have to return the produced conversions.

Posting submission...