mOTTR: Concepts and Abstract Model for Reasonable Ontology Templates
top
examples:
/
Table of Contents
Concepts and Abstract Model for Reasonable Ontology Templates (mOTTR)
Specification of the concepts and abstract model of Reasonable Ontology Templates (OTTR).
- Version
- 0.1.3
- Previous version
- mOTTR 0.1.2
- Depends on
- Nothing outside this specification.
- Published
Tue Sep 22 19:22:25 2026- Authors
- Leif Harald Karlsen
Martin G. Skjæveland - Issues
- https://gitlab.com/ottr/language/mOTTR/issues
Front matter
Abstract
Defines the concepts and abstract model underlying Reasonable Ontology Templates (OTTR): types, terms, templates, template instances, and their expansion.
Documents
This specification consists of the following files:
- ./index.html
- This document.
Versions and dependencies
The table contains versioning information of this specification. It depends on no other.
| Specification | Version | Previous | Note |
|---|---|---|---|
| mOTTR | 0.1.3 | 0.1.2 | This specification. |
Document conventions
Notation
This is a defined term.
This is a mention of a defined term. Terms may be defined in depending specifications.
The key words MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, NOT RECOMMENDED, MAY and OPTIONAL are to be interpreted as described in BCP 14 [1] [2] when, and only when, they appear in all capitals.
Changelog
- 0.1.3
- Required the value of an argument with a list expander to be of a list type; the list expander operations are defined on lists only, and nothing said what a list expander on another value meant.
- Constants and variables are now disjoint sets rather than possibly overlapping ones, and a parameter variable belongs to the signature declaring it. The variable safe condition is consequently removed and with it the requirement that a semi-valid template library be variable safe.
- Stated that the identity of terms across a template library is fixed by the specification adapting this model to a concrete representation, not here.
- Version information is now stated in one table; the document's own version and the version the release is tagged with are checked against each other.
- 0.1.2
- A parameter may have a name. Minor fixes to terms, types and none, and to the diagrams.
- 0.1.1
- Defined the expansion of list expanders applied to none. Issue #40
1. Introduction
This specification formally defines the concepts and abstract model that underlie the templating language Reasonable Ontology Templates (OTTR).
2. Fundamentals
2.1. Types
We assume that we have a set of types. Types are arranged by subtype relationships, where subtype is a reflexive and transitive relation over the set of types. Supertype is the inverse relationship of subtype.
A type is either a basic type, a list type or a LUB-type.
There is a basic type named Top, which is supertype of every other type, and a basic type named Bot which is subtype of every other type.
Assume P and Q are two basic types, both subtype of some type R, but such that neither P is a subtype of Q nor Q is a subtype of P, and Bot is the only type that is a subtype of both P and Q. Even though P and Q share the common supertype R, no type other than Bot is a subtype of both, i.e. nothing can be described by both P and Q at once.
There are two list types List and NonEmptyList which take another type as argument. We assume that there is one type List<P> and one type NonEmptyList<P> per other type P. NonEmptyList<P> is a subtype of List<Q> for all types P and Q where P is a subtype of Q.
For every basic type P there is also a LUB-type LUB<P>, (least upper bound) such that LUB<P> subtype P.
Compatible is the least relation between types such that
- P is compatible with all supertypes of P.
- LUB<P> is compatible with all subtypes of P.
Assume P is a basic type with a subtype Q. By definition, LUB<P> is then compatible with Q, since Q is a subtype of P. This means that a term whose type is LUB<P> — i.e. a term that is known to have some subtype of P, without it being specified which one — may be used wherever a term of the more specific type Q is expected: LUB<P> is compatible with Q even though it is not itself a subtype of Q.
We define the occurs at depth as follows, for any types P and Q:
- P occurs at depth 0 in P
- if P occurs at depth n in Q, then P occurs at depth n+1 in List<Q> and NonEmptyList<Q>.
We will use this definition in order to relate depths of terms in lists to the type at corresponding depths in complex list types. However, note that for LUB<P>, P must be a basic type and can therefore not be a list type. It is therefore no n such that P occurs at depth n in LUB<P>.
P occurs at depth 2 in NonEmptyList<List<P>>, and LUB<P> occurs at depth 1 in NonEmptyList<LUB<P>>.
2.2. Terms
We assume that there are two sets, constants and variables, which are disjoint. We call the union of these the sets terms.
The set of constants include a special constant called none that denotes a missing value. The set of constants include lists which are ordered collections of terms. The constant nil denotes the empty list.
All constants have a type. The type of nil is List<Bot>, and the type of nonempty lists is NonEmptyList<LUB<Top>>. none has the type Bot and is the only constant with this type.
We define the occurs at depth over terms similarly as for types:
- a term a occurs at depth 0 in a,
- if a term a occurs at depth n in b, then a occurs at depth n+1 in any list where b is a member.
Note: This specification does not say when two occurrences of a term are occurrences of (or represent) the same term. Such rules must be fixed by specifications that adapt mOTTR to a concrete representation of terms. It is in particular relevant for blank node scopes [2].
2.3. Templates
A template signature (or just signature) consists of a template name, which is a constant term, and a list of parameters.
A parameter consists of a parameter variable, which is a variable term, and a type. Additionally, a parameter may have a parameter name, which is a constant term, it may have a default value, which is a constant term, and it may be marked with one or more modifiers. The set of modifiers contains optional.
The arity of a signature is the size of its parameter list.
The type of a variable is the type of its parameter.
All parameter variables and all parameter names in a signature's list of parameters must be different.
A parameter variable belongs to the signature which declares it: two different signatures never have the same variable, and a variable does not occur outside the signature declaring it or, if the signature is a template, its pattern. A specification adapting this model to a concrete representation of terms must respect this, whatever notation it gives variables; in particular, two signatures written with the same notation for a variable declare two different variables.
Additionally, a template signature may be have annotations, which is a set of ground template instances (to be defined below); we call these annotation instances.
A template is a template signature with a pattern, which is a (possibly empty) set of template instances (to be defined below); we call these pattern instances.
A base template is a specific type of template signature that may not have a pattern.
2.4. Template instances
A template instance (or just instance) consists of a template name and a list of arguments.
An argument consists of an argument value (or just value), which is a term, and possibly a list expander.
The set of list expanders contains the tokens cross, zipMin and zipMax.
The arity of an instance is the size of its argument list.
A ground template instance is a template instance where the value of every argument, if present, is a constant.
An argument with a list expander must have a value whose type is compatible with List<P> or NonEmptyList<P>, where P is the type of the corresponding parameter. List expander operations are defined on lists only.
We say that a template instance I is the instance of a template signature T with the same template name as I. For an argument a in instance I of signature T, we say that its corresponding parameter of T is the parameter with the same index in the parameter list as the index of a in the argument list of I.
3. Collections of templates and instances
3.1. Template library and dataset
A template library is a set of template signatures. (Note that templates and base templates are also template signatures.)
A template dataset consists of a template library and a set of ground template instances.
3.1.1. Consistent use of terms
For a term v, we say that v has inferred type P if v is a term in an argument t at depth n and either:
- t is without list expander, with a corresponding parameter with a type having the type P at depth n
- t has a list expander, with a corresponding parameter with a type having P at depth n-1
A term v, different from none, is consistently typed in a set of instances if there exists a type P unequal Bot such that
- P is a subtype of all inferred types of v, and
- the type of v is compatible with P.
The term none is always consistently typed.
A set of instances is consistently typed if every term occurring in it is consistently typed.
A template library is consistently typed if the set of all instances occurring in it is consistently typed.
3.1.2. Correct instantiation of templates
Directly depends is a relation between a set of templates and a set of template signatures such that T directly depends on S if an instance of S occurs in the pattern of T.
A template library is acyclic if the directly depends relation is acyclic.
A set of instances is said to have referential integrity with respect to a template library if every instance has a name corresponding to a template signature in the library, and that the arity of the instance equals the arity of the corresponding template signature.
A template library is said to have referential integrity if no two templates have the same name and the set of all instances occurring in it has referential integrity with respect to it.
A template signature is well founded if it is a base template or if it is a template that only depends on well founded templates. A template library is well founded if it only contains well founded templates.
3.2. Valid template library
A semi-valid template library is a template library that:
- is consistently typed,
- is acyclic, and
- has referential integrity.
A valid template library is a semi-valid template library that is well founded.
3.3. Valid template dataset
A valid template dataset is a template dataset where:
- its template library is valid, and
- its set of instances is consistently typed and has referential integrity with respect to the template library.
A strict template dataset is a valid template dataset with the additional requirement that ground template instances must have value for arguments to corresponding parameters which are marked as optional.
4. Expansion
4.1. Instance Expansion
The direct expansion of a template instance I of T is defined as follows:
if one or more arguments of I has a list expander, new instances of T from I are constructed as follows: The operation corresponding to the list expander (see below) is performed on all lists with a list expander, and for each list e in the result, an instance is created such that its i*th argument is equal to *I's if it does not have a list expander and equals the i*th element of *e otherwise. The operation corresponding to a list expander is as follows:
- if the list expander is cross, the operation is the Cartesian product
- if the list expander is zipMin, the operation is Convolution - stopping after the length of the shortest list
- if the list expander is zipMax, the operation is Convolution - increasing the length of shorter lists to the length of the longest list by appending none-values.
The result of the direct expansion of I is the union of the direct expansion of all the generated instances.
- if one or more arguments of I has value none and its corresponding parameter is not optional and has no default value, then the result of the direct expansion of I is the empty set.
- if T has no pattern, i.e., T is a base template or a signature (and not a template), then the direct expansion of I is I.
otherwise, we build the induced substitution S of T and I by considering each argument a of I and its corresponding parameter p in T:
- if a has value none and p has a default value d, then S := S ∪ { p / d }
- otherwise, S := S ∪ { p / a }
The result of the direct expansion of I is the set of instances resulting from applying the substitution S to the pattern of T.
The expansion of an instance I of a signature T is the result of recursively applying direct expansion on I until each instance is either:
- an instance of a template without a pattern—in which case the expansion naturally terminates, or
- it is underspecified, which occurs in two cases:
- an argument has a variable as value and has a list expander, or
- an argument has a variable as value and the parameter to which the variable belongs is marked optional while the argument's corresponding parameter is not optional or has a default value.
The expansion of a template dataset is the expansion of the set of instances of the dataset, with respect to the signatures in the corresponding template library.
We call an expansion complete, if the result contains only instances of base templates or signatures.
We call an expansion ground, if the result contains only instances of base templates.
4.2. Template Expansion
The annotation expansion of a template signature is the result replacing the annotation instances of the template signature with their expansion.
The pattern expansion of a template is the result replacing the pattern instances of the template with their expansion.
The expansion of a template is the result of performing both annotation expansion and pattern expansion on the template.
5. References
- Making a Case for Formal Relations over Ontology Patterns
- Daniel P. Lupp, Leif Harald Karlsen, and Martin G. Skjæveland: Making a Case for Formal Relations over Ontology Patterns. Workshop for Ontology Design Patterns (WOP). 2018. http://ceur-ws.org/Vol-2195/research_paper_5.pdf
- Adapting Reasonable Ontology Templates to RDF
- https://spec.ottr.xyz/rOTTR/
- RFC 2119: Key words for use in RFCs to Indicate Requirement Levels
- https://www.rfc-editor.org/rfc/rfc2119
- RFC 8174: Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words
- https://www.rfc-editor.org/rfc/rfc8174