pOTTR: Incrementally building a template library
Table of Contents
Incrementally building a template library
A top-down modelling approach for building template libraries.
- Authors
- Daniel Lupp
- Issues
- https://gitlab.com/ottr/language/pOTTR/issues
1 Introduction
In this chapter will incrementally build a set of templates that model the domain of mobile phone with the goal of representing the design of the phone, i.e., which parts different models of phone consist of, and the specific parts a specific phone (individual) consists of.
The reader should know the basics of OTTR.
1.1 Prefixes
The following prefixes are used throughout the document, and may be used in the text input areas of the interactive examples without declaration.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix dbp: <http://dbpedia.org/ontology/> . @prefix ex: <http://example.com/ns#> . @prefix ottr: <http://ns.ottr.xyz/0.4/> . @prefix ax: <http://tpl.ottr.xyz/owl/axiom/0.1/> . @prefix rstr: <http://tpl.ottr.xyz/owl/restriction/0.1/> .
2 Defining core patterns
2.1 Exercise: Creating a signature
Based on the following instances, write a suitable signature for
the template ex:Phone
. Ignore for now that it is a base
template, in the following exercises we will define it in more
detail.
2.2 Exercise: Extending the signature to a template
Use the templates below as well as existing OWL templates to
create the ex:Phone
template. Use ex:ConsistsOf
as a black box
(this template will be defined in the next exercise).
3 Refining incrementally
3.1 Exercise: Add ConsistsOf
Use the ex:HasComponents
and ex:OnlyComponents
templates below
to define the ex:ConsistsOf
template. We will define
ex:HasComponents
and ex:OnlyComponents
in the next exercise.
3.2 Exercise: Add HasComponents and OnlyComponents
Use ex:HasComponent
below as well as existing OWL and RDFS
templates to define ex:HasComponents
and
ex:OnlyComponents
. (Hint: look at rstr:ObjectUnionOf and
ax:SubObjectAllValuesFrom).
4 Instantiation
4.1 Exercise: Add PhoneInstance
Now we are going to create a template for populating phone
classes: ex:PhoneInstance
. Define the template
ex:PhoneInstance
below.
4.2 Exercise: Instantiation
Create one or more new phone classes and populate them with specific phones.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix dbp: <http://dbpedia.org/ontology/> . @prefix ex: <http://example.com/ns#> . @prefix ottr: <http://ns.ottr.xyz/0.4/> . @prefix ax: <http://tpl.ottr.xyz/owl/axiom/0.1/> . @prefix rstr: <http://tpl.ottr.xyz/owl/restriction/0.1/> . ex:Phone(ex:Nokia3310, (ex:Screen, ex:HardCase, ex:CPU), "indestructible"^^xsd:string). ex:Phone(ex:SamsungS9, (ex:CurvedScreen, ex:FastCPU), none). ex:Phone(ex:iPhone8, (ex:RetinaScreen, ex:OtherFastCPU, ex:FPReader), "iphone"^^xsd:string).
5 Appendix
5.1 WebLutra
The web application that drives the interactive examples in this primer, called WebLutra, uses Lutra, the reference application for OTTR. Both applications are open source and available at http://gitlab.com/ottr/lutra/lutra. If you experience errors or have suggestions for improvements, please take a look at existing issues or file a new issue: http://gitlab.com/ottr/lutra/lutra/issues