- CS-E4410
- 2. Producing RDF data and RDFS ontologies
- 2.4 RDF Schema
RDF Schema¶
- The RDF Schema (RDFS) used with Linked Data, is used to define
- classes and class hierarchy,
- properties and their hierarchy, including domains and ranges for the properties. The classes in the class hierarchy can then be instantiated to create members of the class. Using RDF Schema semantics, it is possible to infer new information from the given definitions.
In this exercise we learn to define RDFS classes and properties, create class instances and enrich the data by inferencing new information.
Defining a class hierarchy¶
Your task is to create a simple ontology of different types of works. Assume that the works can be divided hierarchically to the following subtypes:
Work
--Book
----Novel
----Poem
--Composition
----Pop music composition
----Classical composition
--Movie
Create a corresponding RDFS class hierarchy in the Aalto University namespace.
You can create the hierarchy with any RDF serialization you want, but the return file has to be in the Turtle format. You can transform the ontology into the Turtle serialization for submission using the RDF Serializer service.
- The automatic tests assume
- an empty prefix is used for the created resources.
- the names of the resources are as described in the hierarchy tree above.
- camelCase is used for compound words
e.g. ‘’creation time’’ should be ‘’:creationTime’’ and ‘’Film noir’’ should be ‘’:FilmNoir’’ in the Turtle file.
Reminder: empty prefixes are defined as
@prefix : <http://myprefixdomain.somesuffix/optionalpath/> .
You may want to validate your ontology by visualizing it in the RDF Grapher service before submitting.
A+ presents the exercise submission form here.
Defining labels¶
Define human-readable labels for the RDFS classes you created in two languages: Finnish and English.
It is useful to use your solution for the previous exercise as base for these exercises, as we will use the same RDFS classes to gradually progress the ontology.
Information about language tagging in turtle can be found here: https://www.w3.org/TR/turtle/#turtle-literals
A+ presents the exercise submission form here.
Defining properties¶
The Dublin Core’s DCMI Metadata Terms defines web documents with, for example, the property dc:creator, which expresses the creator of the document.
Define a property creator into your own namespace, which is a subproperty of the property dc:creator. This allows you to define restrictions for the property without changing the definition of dc:creator. Define Work as the domain and http://xmlns.com/foaf/0.1/Person as the range of the property.
Define the following subproperties of your own creator property, and their domain and range restrictions:
- writer property to identify the writer of a book
- composer property to identify the composer of a musical composition
- director property to identify the director of a movie.
Define a property expressing the creation time of a work (class Work), which has an XML Schema date as its range. The XML Schema namespace is http://www.w3.org/2001/XMLSchema#.
Finally, define a page count property for a book (class Book), which is expressed as an integer.
You may want to validate your definitions by visualizing them in the RDF Grapher service.
The automatic tests assume that an empty prefix is used for the properties and properties consisting of compound words are in camelCase e.g. ‘’creation time’’ should be ‘’:creationTime’’ in the Turtle file.
Reminder: empty prefixes are defined with
@prefix : <http://myprefixdomain.somesuffix/optionalpath/> .
.
and dc prefix is http://purl.org/dc/elements/1.1/
A+ presents the exercise submission form here.
Populating ontology with instances¶
Create an instance of every
class of the leaf nodes of the class hierarchy tree you have created,
for example your favorite novel and movie. Provide a value for every property
you defined in the previous exercise. Make sure that you use your properties
according to the restrictions you defined for them. Define a label for each
instance using rdfs:label. Datatypes for objects are defined in turtle
by appending an object with
^^datatype
e.g. :e :roundedValue "2.71828"^^xsd:float
A+ presents the exercise submission form here.
Enriching an ontology by inference (1 pts)¶
Give your definitions and the created instances from the previous exercise to OWL RL Reasoner service of the LDF.fi portal.
Note: The OWL RL Reasoner might throw an input error (HTTP 400) from
non-ASCII characters.
If this happens, try removing them or replacing them with ASCII equivalents e.g.
ä → ae
.