rOTTR: Adapting Reasonable Ontology Templates to RDF
top
examples:
/
Table of Contents
Adapting Reasonable Ontology Templates to RDF (rOTTR)
- Version
- 0.1.0
- Published
- 6 March 2019
- Previous version
- First release
- Authors
- Leif Harald Karlsen
Martin G. Skjæveland - Issues
- https://gitlab.com/ottr/language/rOTTR/issues
1 Introduction
This specification extends and adapts the mOTTR specifications [1] to the RDF model. This includes specifying how types and terms are represented in RDF, some peculiarities that are caused by RDF's blank nodes, and the specification of relevant base templates.
This specification does not provide a serialisation format of OTTR for RDF, but does set requirements for such serialisations.
1.1 Documents
This specificaiton consists of the following documents:
- ./index.html
- This document.
- ./types.owl.ttl
- OWL ontology of all basic and complex types (no pun types).
- ./puntypes.owl.ttl
- OWL ontology of pun type extension to basic and complex types.
- ./types.shacl.ttl
- SHACL shape of all permissible types.
1.2 Document conventions
In this document, we assume the following prefix declarations:
Prefix | Namespace |
---|---|
rottr |
http://spec.ottr.xyz/rottr/0/ |
ottt |
http://spec.ottr.xyz/rottr/0/types# |
o-rdf |
http://tpl.ottr.xyz/rdf/0.1/ |
xsd |
http://www.w3.org/2001/XMLSchema# |
rdf |
http://www.w3.org/1999/02/22-rdf-syntax-ns# |
rdfs |
http://www.w3.org/2000/01/rdf-schema# |
owl |
http://www.w3.org/2002/07/owl# |
1.2.1 Notation
This is the first main occurrence of a defined term.
This is a mention of an already defined term. Many terms are already defined in mOTTR [1].
2 Types
A type is either a basic type, a list type (List<> and NEList<> (non-empty list)) or a LUB-type. These are presented below.
2.1 Basic types
Table 1 lists all permissible basic types and specifies the
subtype relationship using the inverse relation supertype; Figure
1 illustrates the hierarchy. All basic types except
ottt:IRI
and ottt:Bot
are common types or classes taken from the
RDF, RDFS, OWL and XSD standards. ottt:IRI
is the class of all
rdfs:Resource
's which are not rdfs:Literal
's. ottt:Bot
represents the type Bot, while Top is represented by the IRI
rdfs:Resource
.
Type | Label | Supertype | Description |
---|---|---|---|
rdfs:Resource |
'All things described by RDF are called resources, and are instances of the class rdfs:Resource' | ||
ottt:Bot |
|||
ottt:IRI |
rdfs:Resource |
'An IRI (Internationalized Resource Identifier) within an RDF graph is a Unicode string that conforms to the syntax defined in RFC 3987.' | |
owl:Class |
ottt:IRI |
'Classes can be understood as sets of individuals.' | |
owl:NamedIndividual |
ottt:IRI |
'Individuals in the OWL 2 syntax represent actual objects from the domain.' | |
rdfs:Datatype |
ottt:IRI |
'Datatypes are entities that refer to sets of data values. Thus, datatypes are analogous to classes, the main difference being that the former contain data values such as strings and numbers, rather than individuals.' | |
owl:ObjectProperty |
ottt:IRI |
'Object properties connect pairs of individuals.' | |
owl:DatatypeProperty |
ottt:IRI |
'Data properties connect individuals with literals. In some knowledge representation systems, functional data properties are called attributes.' | |
owl:AnnotationProperty |
ottt:IRI |
'Annotation properties can be used to provide an annotation for an ontology, axiom, or an IRI.' | |
rdfs:Literal |
rdfs:Resource |
'The class rdfs:Literal is the class of literal values such as strings and integers' | |
xsd:string |
rdfs:Literal |
'Character strings (but not all Unicode character strings)' | |
xsd:normalizedString |
xsd:string |
'Whitespace-normalized strings' | |
xsd:token |
xsd:normalizedString |
'Tokenized strings' | |
xsd:language |
xsd:token |
'Language tags per [BCP47]' | |
xsd:Name |
xsd:token |
'XML Names' | |
xsd:NCName |
xsd:Name |
'XML NCNames' | |
xsd:NMTOKEN |
xsd:Name |
'XML NMTOKENs' | |
owl:real |
rdfs:Literal |
'The set of all real numbers' | |
owl:rational |
owl:real |
'The set of all rational numbers' | |
xsd:decimal |
owl:rational |
'Arbitrary-precision decimal numbers' | |
xsd:integer |
xsd:decimal |
'Arbitrary-size integer numbers' | |
xsd:long |
xsd:integer |
'-9223372036854775808…+9223372036854775807 (64 bit)' | |
xsd:int |
xsd:long |
'-2147483648…+2147483647 (32 bit)' | |
xsd:short |
xsd:int |
'-32768…+32767 (16 bit)' | |
xsd:byte |
xsd:short |
'-128…+127 (8 bit)' | |
xsd:nonNegativeInteger |
xsd:integer |
'Integer numbers >=0' | |
xsd:positiveInteger |
xsd:nonNegativeInteger |
'Integer numbers >0' | |
xsd:unsignedLong |
xsd:positiveInteger |
'0…18446744073709551615 (64 bit)' | |
xsd:unsignedInt |
xsd:unsignedLong |
'0…4294967295 (32 bit)' | |
xsd:unsignedShort |
xsd:unsignedInt |
'0…65535 (16 bit)' | |
xsd:unsignedByte |
xsd:unsignedShort |
'0…255 (8 bit)' | |
xsd:nonPositiveInteger |
xsd:integer |
'Integer numbers =<0' | |
xsd:negativeInteger |
xsd:nonPositiveInteger |
'Integer numbers <0' | |
xsd:double |
rdfs:Literal |
'64-bit floating point numbers incl. +-Inf, +-0, NaN' | |
xsd:float |
rdfs:Literal |
'32-bit floating point numbers incl. +-Inf, +-0, NaN' | |
xsd:date |
rdfs:Literal |
'Dates (yyyy-mm-dd) with or without timezone' | |
xsd:dateTime |
rdfs:Literal |
'Date and time with or without timezone' | |
xsd:dateTimeStamp |
xsd:dateTime |
'Date and time with required timezone' | |
xsd:time |
rdfs:Literal |
'Times (hh:mm:ss.sss…) with or without timezone' | |
xsd:gYear |
rdfs:Literal |
'Gregorian calendar year' | |
xsd:gMonth |
rdfs:Literal |
'Gregorian calendar month' | |
xsd:gDay |
rdfs:Literal |
'Gregorian calendar day of the month' | |
xsd:gYearMonth |
rdfs:Literal |
'Gregorian calendar year and month' | |
xsd:gMonthDay |
rdfs:Literal |
'Gregorian calendar month and day' | |
xsd:duration |
rdfs:Literal |
'Duration of time' | |
xsd:yearMonthDuration |
xsd:duration |
'Duration of time (months and years only)' | |
xsd:dayTimeDuration |
xsd:duration |
'Duration of time (days, hours, minutes, seconds only)' | |
xsd:hexBinary |
rdfs:Literal |
'Hex-encoded binary data' | |
xsd:base64Binary |
rdfs:Literal |
'Base64-encoded binary data' | |
xsd:boolean |
rdfs:Literal |
'true, false' | |
xsd:anyURI |
rdfs:Literal |
'Absolute or relative URIs and IRIs' | |
rdf:HTML |
rdfs:Literal |
'HTML content' | |
rdf:XMLLiteral |
rdfs:Literal |
'XML content' |
2.2 List and Least upper bound types
The list types List<> and NEList<> are denoted respectively by
the IRI rdf:List
and the IRI ottt:NEList
.
The LUB<> type is represented by the IRI ottt:LUB
.
These types are listed in Table 2.
Each OTTR serialisation language must introduce a means of representing complex types, such as NEList<LUB<String>>.
Type | Label | Supertype | Description |
---|---|---|---|
rdf:List |
'List<>' | 'rdf:List represents the mOTTR list type List<>. The type contains all list terms.' |
|
ottt:NEList |
'NEList<>' | 'ottt:NEList represents the mOTTR list type NEList<>. The type contains all non-empty list terms.' |
|
ottt:LUB |
'LUB<>' | 'ottt:LUB represents the mOTTR list type LUB<> (least upper bound).' |
2.3 Pun types
To support OWL 2 punning [2], which allows a term to have multiple types under some restrictions (see [2]), we provide an extension to the above type hierarchy that captures all the possible combinations of "pun types" from the OWL standard. These types and their supertypes are listed in Table 3.
Type | Supertype | ||
---|---|---|---|
ottt:Punned-Class-NamedIndividual |
owl:Class |
owl:NamedIndividual |
|
ottt:Punned-Class-ObjectProperty |
owl:Class |
owl:ObjectProperty |
|
ottt:Punned-Class-DatatypeProperty |
owl:Class |
owl:DatatypeProperty |
|
ottt:Punned-Class-AnnotationProperty |
owl:Class |
owl:AnnotationProperty |
|
ottt:Punned-Datatype-NamedIndividual |
rdfs:Datatype |
owl:NamedIndividual |
|
ottt:Punned-Datatype-ObjectProperty |
rdfs:Datatype |
owl:ObjectProperty |
|
ottt:Punned-Datatype-DatatypeProperty |
rdfs:Datatype |
owl:DatatypeProperty |
|
ottt:Punned-Datatype-AnnotationProperty |
rdfs:Datatype |
owl:AnnotationProperty |
|
ottt:Punned-NamedIndividual-ObjectProperty |
owl:NamedIndividual |
owl:ObjectProperty |
|
ottt:Punned-NamedIndividual-DatatypeProperty |
owl:NamedIndividual |
owl:DatatypeProperty |
|
ottt:Punned-NamedIndividual-AnnotationProperty |
owl:NamedIndividual |
owl:AnnotationProperty |
|
ottt:Punned-Class-NamedIndividual-ObjectProperty |
owl:Class |
owl:NamedIndividual |
owl:ObjectProperty |
ottt:Punned-Class-NamedIndividual-DatatypeProperty |
owl:Class |
owl:NamedIndividual |
owl:DatatypeProperty |
ottt:Punned-Class-NamedIndividual-AnnotationProperty |
owl:Class |
owl:NamedIndividual |
owl:AnnotationProperty |
ottt:Punned-Datatype-NamedIndividual-ObjectProperty |
rdfs:Datatype |
owl:NamedIndividual |
owl:ObjectProperty |
ottt:Punned-Datatype-NamedIndividual-DatatypeProperty |
rdfs:Datatype |
owl:NamedIndividual |
owl:DatatypeProperty |
ottt:Punned-Datatype-NamedIndividual-AnnotationProperty |
rdfs:Datatype |
owl:NamedIndividual |
owl:AnnotationProperty |
3 Terms
The set of constants and the set of variables are both equal to the set of valid RDF terms [3], i.e., IRIs, literals with optional language tag or type, and blank nodes. Thus, a variable is only distinguishable from a constant term within a template definition, where variables are the terms occurring in a parameter declaration in the template's signature.
The set of constants also include RDF-lists, where an RDF-list is
either the empty list, denoted by rdf:nil
, or a resource which has
exactly one rdf:first
-related term denoting
the first element of the list, and exactly one rdf:rest
-related element which is
either a list or rdf:nil
, denoting the rest of the list. We require that lists are finite.
A parameter variable cannot be a list, and variables in parameters with type List<T> or NEList<T> must be denoted by a blank node.
The name in a template signature is an IRI.
Constant terms have type accordingly:
- a list has a type as described in the mOTTR specification [1];
- a non-list blank node has type LUB<
rdfs:Resource
>; - an IRI has type LUB<
ottt:IRI
>; - a literal has type equal to its contained datatype (e.g. ~"3"^xsd:int~ has type
xsd:int
) orxsd:string
if no datatype is present.
An OTTR serialisation language must introduce a special constant
none that represents a missing value (or no value); its type is
ottt:Bot
.
4 Modifiers
In addition to the optional parameter modifier defined in the mOTTR specification [1], this specification introduces the modifier nonBlank. For a template dataset to be valid, we additionally require that for any instance I of a template T and every parameter p of T which is marked as nonBlank, I's argument to p must either be a constant which is not a blank node, or a variable whose parameter also has a nonBlank-modifier.
5 Expansion
When expanding a template T having blank nodes in its pattern, fresh blank nodes must be generated for each template instance of T as follows.
Let S be the induced substitution of a template T and an instance I of T, as defined in the mOTTR specification [1]. Let B be a substitution replacing all blank nodes in T which are not also parameter variables of T with a fresh blank node.
The result of the direct expansion of I is the set of instances resulting from applying the substitutions S and B to the pattern of T.
6 Base template
This specification specifies a single base template
o-rdf:Triple
which represents an RDF
triple. The template has three parameters:
- ?subject, type:
ottt:IRI
- ?predicate, type:
ottt:IRI
, modifier: nonBlank - ?object, type:
rdfs:Resource
7 References
- mOTTR
- https://spec.ottr.xyz/mOTTR/0.1/
- OWL 2 Web Ontology Language New Features and Rationale (Second Edition)
- https://www.w3.org/TR/owl2-new-features
- RDF Graphs
- https://www.w3.org/TR/rdf11-concepts/#section-rdf-graph