bOTTR: Batch instantiation of OTTR templates
top
examples:
/
Table of Contents
Batch Instantiation of OTTR templates (bOTTR)
An Extract-Transform-Load (ETL) mapping language for instantiating OTTR templates from existing external sources.
- Version
- 0.1.4
- Previous version
- bOTTR 0.1.3
- Depends on
- mOTTR 0.1.3, rOTTR 0.2.3, stOTTR 0.1.6, wOTTR 0.5.0
- Published
Wed Sep 23 09:23:37 2026- Authors
- Martin G. Skjæveland
- Issues
- https://gitlab.com/ottr/language/bOTTR/issues
Front matter
Abstract
An Extract-Transform-Load (ETL) mapping language for instantiating OTTR templates from data in external sources, such as relational databases, SPARQL endpoints, RDF files and value-separated files (e.g., CSV). Specified as an OWL ontology extending wOTTR.
Documents
This specification consists of the following files:
- ./index.html
- This document.
- ./core-vocabulary.owl.ttl
- Ontology declaring the core vocabulary of bOTTR.
- ./tpl
- The base templates this specification defines, one file each.
o-bottr:resolves under this directory, so it must be published.
Versions and dependencies
The table contains versioning information of this and its depending specifications. The link target in the first column is what this document's references to that specification point at.
| Specification | Version | Previous | Note |
|---|---|---|---|
| bOTTR | 0.1.4 | 0.1.3 | This specification. |
| wOTTR | 0.5.0 | Core vocabulary and grammar this one extends. | |
| rOTTR | 0.2.3 | Terms, blank nodes and base templates for RDF. | |
| mOTTR | 0.1.3 | Concepts and abstract model. | |
| stOTTR | 0.1.6 | Terse syntax used in the examples. |
Every IRI this specification defines is versioned, with one
exception: the ontology IRI, which is deliberately
version-independent; its version is stated using owl:versionIRI.
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 [5] [6] when, and only when, they appear in all capitals.
Boxes
This is an example box. Examples are informative.
Examples are standalone and makes no reference to external resources unless explicitly stated. The examples are meant to illustrate use of the syntax, and not necessarily to display interesting or useful templates.
Prefixes
The prefixes that carry a version are generated from No description for this link; the rest are fixed.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @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 skos: <http://www.w3.org/2004/02/skos/core#> . @prefix vann: <http://purl.org/vocab/vann/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix dcterms: <http://purl.org/dc/terms/> . @prefix cc: <http://creativecommons.org/ns#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix dash: <http://datashapes.org/dash#> . @prefix ex: <http://example.net/ns#> . @prefix ottr: <http://ns.ottr.xyz/0.4/> . @prefix bottr-doc: <http://spec.ottr.xyz/bOTTR/> . @prefix bottr-ver: <http://spec.ottr.xyz/bOTTR/0.1.4/> . @prefix o-bottr: <http://spec.ottr.xyz/bOTTR/0.1.4/tpl/> . @prefix mottr-ver: <http://spec.ottr.xyz/mOTTR/0.1.3/> . @prefix o-mottr: <http://spec.ottr.xyz/mOTTR/0.1.3/tpl/> . @prefix rottr-ver: <http://spec.ottr.xyz/rOTTR/0.2.3/> . @prefix o-rottr: <http://spec.ottr.xyz/rOTTR/0.2.3/tpl/> . @prefix stottr-ver: <http://spec.ottr.xyz/stOTTR/0.1.6/> . @prefix o-stottr: <http://spec.ottr.xyz/stOTTR/0.1.6/tpl/> . @prefix wottr-ver: <http://spec.ottr.xyz/wOTTR/0.5.0/> . @prefix o-wottr: <http://spec.ottr.xyz/wOTTR/0.5.0/tpl/> .
Diagrams
The diagrams in this document are informal, but should be understood in the following way:
- Arrows with open heads indicate subclass relationships—pointing to the superclass
- Dotted arrows indicate type relationships—pointing to the class
- Other arrows indicate domain and possibly range restrictions to
properties—pointing from the domain (arrow source) to the
range (arrow target):
- A regular arrowhead indicates a regular domain and range restriction
- A pink target indicates that the range is a literal of the given type. The name of the relation is given by the target node.
- A green target indicates a non-literal range.
- An empty blue target indicates that the range is unspecified, i.e., it can be either literal or non-literal or both.
- A diamond arrowhead indicates that the range is a list of the target class
Changelog
- 0.1.4
- The ontology now carries a version-independent
owl:ontologyIRIwithowl:versionIRIbeside it, every declared term carriesrdfs:isDefinedBy, and term history is recorded withottr:introducedIn/ottr:changedIn/ottr:deprecatedIn. - Added
ottr:blankNodeScope. Stated the blank node scope [2] of the blank nodes anottr:InstanceMapproduces: theottr:InstanceMapitself, unless two of them declare an equalottr:blankNodeScope. Stated that a blank nodeottr:nullValueis a single blank node of the mapping document, whichottr:blankNodeFreshis the alternative to. - Added
ottr:TranslationTable,ottr:translationTable,ottr:entry,ottr:inValueandottr:outValue.
- The ontology now carries a version-independent
- 0.1.3
- Added
ottr:languageTagSep,ottr:datatypeSep,ottr:blankNodeFresh,ottr:booleanTrue,ottr:booleanFalse. Typo fixes. - 0.1.2
- Added
ottr:fetchSize.
1. Introduction
This specification defines bOTTR, an Extract-Transform-Load (ETL) language for instantiating OTTR templates from data in external sources, such as relational databases, SPARQL endpoints, RDF files and value-separated files (e.g., CSV). bOTTR hence allows data already residing in such sources, across different formats, to be integrated into a single RDF representation via OTTR templates, without first converting the data to RDF or to another OTTR syntax such as stOTTR [4].
The central notion of bOTTR is the ottr:InstanceMap, which
associates a query over a ottr:Source with an OTTR template: each
record in the query's result set becomes one instance of the
template. An ottr:ArgumentMap may be attached to each query column
to specify how its values are translated into typed RDF terms, e.g.,
IRIs, literals with a language tag or datatype, blank nodes, or
lists, compatible with the types defined by mOTTR [3].
The vocabulary of the bOTTR language – the classes and properties used to specify instance maps, sources and argument maps – is specified by an OWL ontology which extends the wOTTR [1] ontology, and is presented in section 2.
2. bOTTR language
In order make the presentation more readable, we will frequently
write, "a Class", e.g., "a ottr:InstanceMap", and take this to mean
a resource of type ottr:InstanceMap. Also, we will write, e.g., "a
ClassX has a property which is a ClassY" and take this to mean
that there must be a triple (x, property , y), where x has
the type ClassX and y has the type ClassY, e.g., "a
ottr:Source has a ottr:query which is an XSD string". The
type information need not be explicitly stated, but can be inferred.
2.1. Overview
The bOTTR vocabulary extends the wOTTR [1] vocabulary, and provides a vocabulary for specifying sources, queries over these sources, and how to map the query results into instances of a specified OTTR template.
The classes ottr:InstanceMap, ottr:Source and its subclasses,
and ottr:ArgumentMap, which specify respectively the mappings,
the source and the translation of source values to template
instance arguments, are described below.
A complete schematic overview of the ontology is given in Figure 2.
2.2. InstanceMap
The central notion of bOTTR is ottr:InstanceMap. An
ottr:InstanceMap specifies a mapping between one ottr:query
over a given ottr:Source and one ottr:Template. The result of
applying the mapping is that each record in the query result set
becomes an ottr:Instance of the specified ottr:Template. The
ottr:argumentMaps specify how source values are translated to
instance arguments.
An ottr:InstanceMap must specify
- a
ottr:template, which must be aottr:Signature[1], - a
ottr:source, which must be aottr:Source, - a
ottr:query, which must be axsd:stringand a valid query over the specifiedottr:Source, and - optionally a list of
ottr:argumentMaps. If set, the size of the argument map list must match the size of the query result records, and - optionally an
ottr:blankNodeScope, which may be any RDF term, see 2.2.1 below.
The result of processing a set of ottr:InstanceMap-s is the set
of instances resulting from each of the ottr:InstanceMap-s.
2.2.1. Blank node scope
An ottr:InstanceMap produces blank nodes whose labels come from the source
query and not from this document: a value translated by
ottr:labelledBlankPrefix, and any blank node read from an
ottr:RDFSource. The blank node scope [2] of these is defined as
the ottr:InstanceMap producing them. (A blank node from
ottr:blankNodeFresh has no label and is fresh in any scope.)
An ottr:InstanceMap MAY specify an ottr:blankNodeScope, whose value is
any RDF term. Two ottr:InstanceMap-s share one blank node scope if and
only if both specify an ottr:blankNodeScope and the two values are equal.
An ottr:InstanceMap which does not specify a ottr:blankNodeScope does not
share its blank node scope.
Note that the ottr:blankNodeScope value names a scope and does nothing else: it is not dereferenced, and
has no meaning beyond being equal or unequal to another such value.
Two ottr:InstanceMap-s therefore never produce the same blank node,
unless they share a ottr:blankNodeScope.
Note that a blank node read from an ottr:RDFSource is one node of that
source's graph however many queries reach it. It is RECOMMENDED that
ottr:InstanceMap-s reading the same ottr:RDFSource declare a shared
ottr:blankNodeScope.
Two mappings over two different files which nevertheless share one key space:
persons.csv has a key column and employment.csv refers to it. Neither file
gives its people an IRI, so the key becomes a labelled blank node — and because
both ottr:InstanceMap-s declare the same ottr:blankNodeScope, the same key
gives the same blank node in both.
[] a ottr:InstanceMap ;
ottr:source [ a ottr:H2Source ] ;
ottr:query "SELECT key, name FROM CSVREAD('@@THIS_DIR@@/persons.csv')" ;
ottr:blankNodeScope _:hrKeys ;
ottr:template ex:Person ;
ottr:argumentMaps ( [ ottr:labelledBlankPrefix "" ] [ ] ) .
[] a ottr:InstanceMap ;
ottr:source [ a ottr:H2Source ] ;
ottr:query "SELECT person, employer FROM CSVREAD('@@THIS_DIR@@/employment.csv')" ;
ottr:blankNodeScope _:hrKeys ;
ottr:template ex:WorksFor ;
ottr:argumentMaps ( [ ottr:labelledBlankPrefix "" ]
[ ottr:labelledBlankPrefix "" ] ) .
Assuming persons.csv and employment.csv:
| key | name | person | employer | |
|---|---|---|---|---|
| p17 | Ann | p17 | o42 |
the two instance maps produce, shown in stOTTR [4] format:
ex:Person (_:p17, "Ann" ) . ex:WorksFor (_:p17, _:o42 ) .
Removing ottr:blankNodeScope from both would give two different blank nodes for
p17, and the two instances would describe two different people.
2.3. Sources
A ottr:Source defines a source and how it can be accessed. The
location of the source is specified with ottr:sourceURL, this can
be either a URL or a file path.
There are two main types of ottr:Sources: ottr:StringSource and
ottr:RDFSource. These source types again have subclasses.
All source values from a ottr:StringSource is
assumed to be a string, and if no ottr:argumentMaps are set, then
these source values are represented as untyped literals when
transforming them to instance arguments. No assumption is made on
the type of the ottr:query, this must be specified by using a
subclass of ottr:StringSource.
For a ottr:RDFSource, all values are assumed to be RDF
resources. If no ottr:argumentMaps are set then the values left
as they are when used as instance arguments. An ottr:RDFSource
accepts only SPARQL queries.
In the following example we assume that ex:rdfSource is a valid RDF
source. Then this ottr:InstanceMap specifies a mapping using a
SPARQL query over the source which creates 10 instances of the
ottr:Triple template.
[] a ottr:InstanceMap ;
ottr:source ex:rdfSource ;
ottr:query """
SELECT ?s ?p ?o
WHERE { ?s ?p ?o }
LIMIT 10
""";
ottr:template ottr:Triple .
2.3.1. RDFFileSource
An ottr:RDFFileSource is an ottr:RDFSource which is specified
by a non-empty set of RDF files, i.e,. files assumed to contain
valid RDF graphs. The files are set using ottr:sourceURL. The
source is the union of the RDF graphs contained in these files.
This is a valid specification of a ottr:RDFFileSource.
[] a ottr:RDFFileSource ; ottr:sourceURL "http://example.com/file1.ttl", "http://example.com/file2.ttl" .
2.3.2. SPARQLEndpointSource
A ottr:SPARQLEndpointSource is an ottr:RDFSource which is
specified by a single SPARQL endpoint address using ottr:sourceURL.
This is a valid specification of a ottr:SPARQLEndpointSource.
[] a ottr:SPARQLEndpointSource ; ottr:sourceURL "http://example.com/sparql/" .
2.3.3. JDBCSource
A ottr:JDBCSource is a ottr:StringSource which represents a
database accessed by a JDBC connection.
A ottr:JDBCSource may specify these properties:
ottr:sourceURL:xsd:string, the url to the database,ottr:jdbcDriver:xsd:string, the JDBC driver class of the database,ottr:username:xsd:string, the username and …ottr:password:xsd:string, password to use for connecting to the database,ottr:fetchSize:xsd:integer, the desired number of rows retrieved from the database on each fetch from the database (if set, the value is put directly into JDBC's Statement::setFetchSize, otherwise no such call is made and the driver's default is used)
This is a valid specification of a ottr:JDBCSource.
[] a ottr:JDBCSource ; ottr:sourceURL "jdbc:mysql://localhost/mydb" ; ottr:jdbcDriver "com.mysql.jdbc.Driver" ; ottr:username "Ann" ; ottr:password "password123" .
2.3.4. H2Source: SQL over CSV files
An ottr:H2Source is a ottr:StringSource which is useful for
querying with SQL over value separated formats such as CSV and
TSV.
An ottr:H2Source is specified without any properties. This results
in a new and empty H2 database created in a temporary location of
the file system. The H2 database system supports loading different
value separated file into the database with CSVREAD, see the
documentation:
http://www.h2database.com/html/functions.html#csvread.
To make the path to the file accessed with CSVREAD (or other
functions in the query) relative to the file containing the bOTTR
mapping, use the token @@THIS_DIR@@. This token will be replaced
by the absolute path of the folder of the mapping file.
This is an instance map that maps an SQL query over the file
address.csv to instances of the ex:Person template. Note that the
ottr:H2Source is specified without any properties.
[] a ottr:InstanceMap ;
ottr:source [ a ottr:H2Source ] ;
ottr:query """
SELECT 'First Name', 'Age', 'Homepage' FROM CSVREAD('@@THIS_DIR@@/address.csv');
""" ;
ottr:template ex:Person .
The file address.csv is located in the same folder as the file
containing the instance map, and assuming that the contents of
address.csv are as follows:
| First Name | Last Name | Age | City | Homepage |
|---|---|---|---|---|
| Ann | Annsen | 30 | Amsterdam | http://example.com/Ann |
| Bob | Bobson | 31 | Berlin | http://example.com/Bob |
| Carl | Carlson | 32 | Cairo | http://example.com/Carl |
then the instance map will produce the following instances, here shown in stOTTR [4] format:
ex:Person ("Ann", "30", "http://example.com/Ann" ) .
ex:Person ("Bob", "31", "http://example.com/Bob" ) .
ex:Person ("Carl", "32", "http://example.com/Carl" ) .
Note that, since the instance map does not specify :argumentMaps,
all values are treated as strings, as ottr:H2Source is a
ottr:StringSource. We will see in a later example how to produce
other types of values.
Note that it is also possible to connect to a H2 database source using
ottr:JDBCSource.
2.4. ArgumentMap
An ottr:ArgumentMap specifies how source values are mapped to OTTR
template instance arguments, i.e., RDF terms. In case no argument maps
are specified, defaults apply from the choice of ottr:Source, see
2.3.
When applying an argument map to source value, we sometimes refer to
the string value of the source value. In case the source is a
ottr:StringSource, then the string value of a source value x is
x. In case the source is an ottr:RDFSource, the string value is of
an RDF resource x is:
- the lexical value of x, if x is a literal
- the IRI of x, if x is an IRI,
- the blank node label of x, if x is a blank node
An ottr:ArgumentMap is defined by the following properties:
ottr:type- Specifies the
ottr:Type[1] of the argument value. If the source is anottr:RDFSourceand the type of the source value is compatible [3] with the specifiedottr:type, then the argument value is equal to the source value (the argument map leaves the value unchanged). If the value is not compatible or the source is aottr:StringSource, then the string value of the source value is cast to the specifiedottr:type. This may result in an error if the cast not possible. ottr:nullValue- Specifies the argument value to be used in case
the source value is unspecified or
NULL. This value may be any RDF resource, and may be specified for all values ofottr:type. A blank node given here is written in the mapping document, so it is one blank node in the blank node scope [2] of that document and not in the scope of anyottr:InstanceMap(see 2.2.1): every source value it replaces, in everyottr:ArgumentMapspecifying it, denotes that same blank node. Useottr:blankNodeFreshwhere each missing value is to produce a blank node of its own. ottr:labelledBlankPrefix- Selects which values to translate to labelled blank nodes. The
default value is
_:. If the string value of the source value starts with and is longer than theottr:labelledBlankPrefix, then the argument value becomes a labelled blank node where the sting value of the source value following theottr:labelledBlankPrefixbecomes the label. Example: if theottr:labelledBlankPrefixis"ABC"and the source value is"ABCDEF", then a labelled blank node_:DEFis created. This property may be specified for all values ofottr:type. The label is interpreted in the blank node scope [2] of theottr:InstanceMap, see 2.2.1: the same label produces the same blank node within that scope and a different one outside it. ottr:languageTag- Specifies the language tag of the argument value. If this value is set, then the source value becomes a language tagged literal where the lexical value is the string value of the source value.
ottr:languageTagSep- Specifies a separator string used to split
the string value of the source value into a lexical value and a
language tag. The separator is matched at the last occurrence
in the string value, so that the part before the separator
becomes the lexical value and the part after becomes the language
tag. For example, if the separator is
"@@"and the source value is"hello@@en", then the argument value becomes"hello"@en. Cannot be combined withottr:languageTag,ottr:type, orottr:datatypeSep. ottr:datatypeSep- Specifies a separator string used to split
the string value of the source value into a lexical value and a
datatype IRI. The separator is matched at the last occurrence
in the string value, so that the part before the separator
becomes the lexical value and the part after becomes the datatype
IRI (which may be a prefixed name). For example, if the separator
is
"^^"and the source value is"42^^xsd:integer", then the argument value becomes"42"^^xsd:integer. Cannot be combined withottr:languageTag,ottr:languageTagSep, orottr:type. ottr:blankNodeFresh- Specifies a list of string values that
should produce a fresh (unlabelled) blank node instead of being
translated to a literal or IRI. This is useful for source values
that represent missing or null identifiers, such as empty strings
or database
NULLrepresentations. Each time a matching value is encountered a new, fresh blank node is produced [2], distinct from every other blank node whatever the blank node scope. This property may be specified for all values ofottr:type. ottr:translationTable- Specifies an
ottr:TranslationTable, a set ofottr:entryresources each pairing oneottr:inValuewith oneottr:outValue, inspired by the D2RQ Mapping Language's translation tables [2]. If the source is aottr:StringSource, the source value matches an entry whoseottr:inValueis the plain (untyped, non-language-tagged) literal of that string value. If the source is anottr:RDFSource, the source value matches an entry whoseottr:inValueis the RDF term read from the source, unchanged. A matching entry'sottr:outValuebecomes the argument value as-is, without being cast toottr:type– unless it is a blank node, in which case the argument value is instead a fresh blank node [2], as withottr:blankNodeFresh. The table is checked afterottr:nullValue,ottr:labelledBlankPrefixandottr:blankNodeFresh, and beforeottr:typeand the other value-parsing properties below. Unlike the D2RQ Mapping Language [2], a source value with no matchingottr:entryis not omitted: it is processed as if noottr:translationTablewere given, subject to the argument map's other properties. ottr:booleanTrue,ottr:booleanFalse- Specify lists of string
values that should be mapped to
xsd:booleantrueandfalserespectively. These properties only apply whenottr:typeisxsd:boolean. This is useful for sources that represent boolean values with strings such as"Y","N","1","0", etc. Example:ottr:booleanTrue ("Y" "1" "TRUE")andottr:booleanFalse ("N" "0" "FALSE"). ottr:listStart,ottr:listEnd,ottr:listSep- Specifies
how to translate source values into lists using the string value
of the source value. The default values are respectively:
(,)and,. A list value may represent a nested list of arbitrary depth.ottr:listStartandottr:listEndmust be a one-character string that specifies respectively the start and end of a list.ottr:listSepis a string that specifies how the list elements are separated. The list element values are trimmed for white space. These list properties may only be used if theottr:typeis a list type [3]. Example: if the source value is"(( a , b ), (c , d))", and theottr:typeis(rdf:List rdf:List xsd:string), then the argument value becomes the RDF list(( "a" "b" )("c" "d")).
This example is similar to a previous example, but note that the source data is slightly changed to illustrate the functionality of argument maps.
[] a ottr:InstanceMap ;
ottr:source [ a ottr:H2Source ] ;
ottr:query """
SELECT 'First Name', 'Age', 'City', 'Homepage' FROM CSVREAD('address.csv');
""" ;
ottr:template ex:Person2 ;
ottr:argumentMaps (
[ ] ## empty Argument map
[ ottr:type xsd:integer ]
[ ottr:languageTag "en" ]
[ ottr:type ottr:IRI; ottr:nullValue ottr:none ]
) .
Assuming that the contents of address.csv are
| First Name | Last Name | Age | City | Homepage |
|---|---|---|---|---|
| Ann | Annsen | 30 | Amsterdam | http://example.com/Ann |
| Bob | Bobson | 31 | Berlin | http://example.com/Bob |
| Carl | Carlson | 32 | Cairo | NULL |
then the instance map will produce the following instances, here shown in stOTTR [4] format:
ex:Person2 ("Ann", 30, "Amsterdam"@en, <http://example.com/Ann> ) .
ex:Person2 ("Bob", 31, "Berlin"@en, <http://example.com/Bob> ) .
ex:Person2 ("Carl", 32, "Cairo"@en, none ) .
This example illustrates ottr:languageTagSep. The source column
label contains values on the form "<text>@@<lang>", and we use the
separator "@@" to split the text from the language tag at runtime.
[] a ottr:InstanceMap ;
ottr:source [ a ottr:H2Source ] ;
ottr:query """
SELECT id, label FROM CSVREAD('entities.csv');
""" ;
ottr:template ex:Entity ;
ottr:argumentMaps (
[ ottr:type ottr:IRI ]
[ ottr:languageTagSep "@@" ]
) .
Assuming entities.csv:
| id | label |
|---|---|
| http://example.com/ex/1 | Hello@@en |
| http://example.com/ex/2 | Bonjour@@fr |
the instance map produces:
ex:Entity (<http://example.com/ex/1>, "Hello"@en ) . ex:Entity (<http://example.com/ex/2>, "Bonjour"@fr ) .
This example illustrates ottr:datatypeSep, ottr:blankNodeFresh,
and ottr:booleanTrue~/~ottr:booleanFalse. The source column value
encodes the lexical form and datatype together, id may be empty (in
which case a fresh blank node is created), and active is a boolean
stored as "Y"~/ ~"N".
[] a ottr:InstanceMap ;
ottr:source [ a ottr:H2Source ] ;
ottr:query """
SELECT id, value, active FROM CSVREAD('data.csv');
""" ;
ottr:template ex:Record ;
ottr:argumentMaps (
[ ottr:blankNodeFresh ( "" "NULL" ) ]
[ ottr:datatypeSep "^^" ]
[ ottr:type xsd:boolean ;
ottr:booleanTrue ( "Y" "1" "TRUE" ) ;
ottr:booleanFalse ( "N" "0" "FALSE" ) ]
) .
Assuming data.csv:
| id | value | active |
|---|---|---|
| http://example.com/ex/1 | 42^xsd:integer | Y |
| hello^xsd:string | N |
the instance map produces:
ex:Record (<http://example.com/ex/1>, 42, true ) . ex:Record (_:b0, "hello", false ) .
This example uses ottr:translationTable to translate single-letter color
codes to RDF resources – the classic use of a translation table in the
D2RQ Mapping Language, which inspired this property [2]. The source
column color holds "R" for red, "G" for green and "B" for blue.
[] a ottr:InstanceMap ;
ottr:source [ a ottr:H2Source ] ;
ottr:query """
SELECT id, color FROM CSVREAD('objects.csv');
""" ;
ottr:template ex:ShinyObject ;
ottr:argumentMaps (
[ ottr:type ottr:IRI ]
[ ottr:type ottr:IRI ;
ottr:translationTable [
ottr:entry
[ ottr:inValue "R" ; ottr:outValue ex:red ] ,
[ ottr:inValue "G" ; ottr:outValue ex:green ] ,
[ ottr:inValue "B" ; ottr:outValue ex:blue ]
]
]
) .
Assuming objects.csv:
| id | color |
|---|---|
| http://example.com/obj/1 | R |
| http://example.com/obj/2 | G |
the instance map produces, shown in stOTTR [4] format:
ex:ShinyObject (<http://example.com/obj/1>, ex:red ) . ex:ShinyObject (<http://example.com/obj/2>, ex:green ) .
Unlike the D2RQ Mapping Language [2], a source value with no
matching ottr:entry, e.g., an uncoded "P", is not omitted: it is
instead cast to the argument map's ottr:type as usual.
3. Vocabulary listings
The classes and properties of the bOTTR vocabulary are presented in the next sections. Each section contains a table. The bOTTR ontology is produced from these tables by converting the tables into OTTR template instances whose expansion, plus some additional ontology metadata, gives the ontology. This process is shown in the appendix.
The tables use the following formatting rules:
- Column headers with a trailing question mark indicate that a value in this column is optional.
- Table cells with a trailing
*are not translated into the ontology. This is done in the following cases:- Cells that contain lists.
- Cells that contain the value
rdfs:Resource.
3.1. Classes
The classes of the vocabulary are listed in Table 1
Each row represents a owl:Class with optional superclass
relationship (using rdfs:subClassOf), textual definition
(skos:definition) and optional note (skos:note).
| Class IRI | Superclass IRI? | Definition | Note? |
|---|---|---|---|
ottr:InstanceMap |
'' | ||
ottr:Source |
'' | ||
ottr:StringSource |
ottr:Source |
'' | |
ottr:RDFSource |
ottr:Source |
'' | |
ottr:JDBCSource |
ottr:StringSource |
'' | |
ottr:SPARQLEndpointSource |
ottr:RDFSource |
'' | |
ottr:RDFFileSource |
ottr:RDFSource |
'' | |
ottr:H2Source |
ottr:StringSource |
'' | |
ottr:ArgumentMap |
'' | ||
ottr:TranslationTable |
'' |
3.2. Properties
The properties of the vocabulary are listed in Table
2. Each row represents a property of the given
property type with optional domain (rdfs:domain) and optional
range (rdfs:range), textual definition (skos:definition) and
optional node (skos:note).
| Property IRI | Property type | Domain IRI? | Range IRI? | Definition | Note? |
|---|---|---|---|---|---|
ottr:template |
owl:ObjectProperty |
ottr:InstanceMap |
ottr:Template * |
'' | |
ottr:argumentMaps |
owl:ObjectProperty |
ottr:InstanceMap |
List of ottr:ArgumentMap * |
'' | |
ottr:source |
owl:ObjectProperty |
ottr:InstanceMap |
ottr:Source |
'' | |
ottr:query |
owl:DatatypeProperty |
ottr:InstanceMap |
xsd:string |
'' | |
ottr:blankNodeScope |
owl:AnnotationProperty |
ottr:InstanceMap |
(rdfs:Resource) * |
'' | |
ottr:sourceURL |
owl:DatatypeProperty |
ottr:Source |
xsd:string |
'' | |
ottr:username |
owl:DatatypeProperty |
ottr:JDBCSource |
xsd:string |
'' | |
ottr:password |
owl:DatatypeProperty |
ottr:JDBCSource |
xsd:string |
'' | |
ottr:jdbcDriver |
owl:DatatypeProperty |
ottr:JDBCSource |
xsd:string |
'' | |
ottr:fetchSize |
owl:DatatypeProperty |
ottr:JDBCSource |
xsd:integer |
'' | |
ottr:type |
owl:ObjectProperty |
ottr:ArgumentMap |
ottr:Type |
'' | |
ottr:nullValue |
owl:AnnotationProperty |
ottr:ArgumentMap |
(rdfs:Resource) |
'' | |
ottr:languageTag |
owl:DatatypeProperty |
ottr:ArgumentMap |
xsd:string |
'' | |
ottr:languageTagSep |
owl:DatatypeProperty |
ottr:ArgumentMap |
xsd:string |
'' | |
ottr:datatypeSep |
owl:DatatypeProperty |
ottr:ArgumentMap |
xsd:string |
'' | |
ottr:labelledBlankPrefix |
owl:DatatypeProperty |
ottr:ArgumentMap |
xsd:string |
'' | |
ottr:blankNodeFresh |
owl:DatatypeProperty |
ottr:ArgumentMap |
List of xsd:string * |
'' | |
ottr:booleanTrue |
owl:DatatypeProperty |
ottr:ArgumentMap |
List of xsd:string * |
'' | |
ottr:booleanFalse |
owl:DatatypeProperty |
ottr:ArgumentMap |
List of xsd:string * |
'' | |
ottr:listSep |
owl:DatatypeProperty |
ottr:ArgumentMap |
xsd:string |
'' | |
ottr:listStart |
owl:DatatypeProperty |
ottr:ArgumentMap |
xsd:string |
'' | |
ottr:listEnd |
owl:DatatypeProperty |
ottr:ArgumentMap |
xsd:string |
'' | |
ottr:translationTable |
owl:ObjectProperty |
ottr:ArgumentMap |
ottr:TranslationTable |
'' | |
ottr:entry |
owl:ObjectProperty |
ottr:TranslationTable |
(rdfs:Resource) |
'' | |
ottr:inValue |
owl:AnnotationProperty |
(rdfs:Resource) |
(rdfs:Resource) |
'' | |
ottr:outValue |
owl:AnnotationProperty |
(rdfs:Resource) |
(rdfs:Resource) |
'' |
3.3. Term history
Each term is annotated with rdfs:isDefinedBy, naming the version IRI
of the ontology that declares it. The table below adds, for the terms
whose history is known, the versions bounding the term's life. A term
with no row here carries no such stamp: this document only records
history from 0.1.2 onwards, which is as far back as the change notes go.
- Introduced
- the term did not exist before this version.
- Changed
- the term existed, but its declaration or meaning differed before this version.
- Deprecated
- the term should not be used from this version on.
A term is valid over the half-open interval from, and including, Introduced to Deprecated.
| Term | Introduced | Changed | Deprecated |
|---|---|---|---|
ottr:fetchSize |
0.1.2 | ||
ottr:languageTagSep |
0.1.3 | ||
ottr:datatypeSep |
0.1.3 | ||
ottr:blankNodeFresh |
0.1.3 | ||
ottr:booleanTrue |
0.1.3 | ||
ottr:booleanFalse |
0.1.3 | ||
ottr:blankNodeScope |
0.1.3 | ||
ottr:TranslationTable |
0.1.4 | ||
ottr:translationTable |
0.1.4 | ||
ottr:entry |
0.1.4 | ||
ottr:inValue |
0.1.4 | ||
ottr:outValue |
0.1.4 |
4. Appendix
4.1. bOTTR Templates
We eat dog food and use OTTR templates to produce the bOTTR OWL ontology from the vocabulary listing tables above. The bOTTR ontology is produced from the templates listed below and those used by wOTTR [1].
4.1.1. Term template
rdfs:isDefinedBy names the version IRI of the ontology that declares
the term, and only the declaring document states it. bOTTR declares its
own terms, so it defines this template rather than reusing wOTTR's –
reusing o-wottr:Term would stamp bOTTR's terms with wOTTR's version.
o-bottr:Term a ottr:Template ;
ottr:parameters (
[ ottr:variable _:IRI; ottr:type ottr:IRI ]
[ ottr:variable _:definition; ottr:type xsd:string; ottr:modifier ottr:optional ]
[ ottr:variable _:note; ottr:type xsd:string; ottr:modifier ottr:optional ]
) ;
ottr:pattern
[ ottr:of ottr:Triple; ottr:values ( _:IRI rdfs:isDefinedBy bottr-ver:core-vocabulary.owl.ttl ) ] ,
[ ottr:of ottr:Triple; ottr:values ( _:IRI skos:definition _:definition ) ] ,
[ ottr:of ottr:Triple; ottr:values ( _:IRI skos:note _:note ) ] .
4.1.2. Version template
Records when a term entered the vocabulary and when it last changed. Both arguments are version IRIs, not strings, so that the release they name can be dereferenced.
o-bottr:Version a ottr:Template ;
ottr:parameters (
[ ottr:variable _:IRI; ottr:type ottr:IRI ]
[ ottr:variable _:introduced; ottr:type ottr:IRI; ottr:modifier ottr:optional ]
[ ottr:variable _:changed; ottr:type ottr:IRI; ottr:modifier ottr:optional ]
[ ottr:variable _:deprecated; ottr:type ottr:IRI; ottr:modifier ottr:optional ]
) ;
ottr:pattern
[ ottr:of ottr:Triple; ottr:values ( _:IRI ottr:introducedIn _:introduced ) ] ,
[ ottr:of ottr:Triple; ottr:values ( _:IRI ottr:changedIn _:changed ) ] ,
[ ottr:of o-bottr:Deprecated; ottr:values ( _:IRI _:deprecated ) ] .
4.1.3. Deprecated template
Keeps the two triples together: a term either has both a deprecation
version and owl:deprecated true, or neither.
o-bottr:Deprecated a ottr:Template ;
ottr:parameters (
[ ottr:variable _:IRI; ottr:type ottr:IRI ]
[ ottr:variable _:version; ottr:type ottr:IRI ]
) ;
ottr:pattern
[ ottr:of ottr:Triple; ottr:values ( _:IRI ottr:deprecatedIn _:version ) ] ,
[ ottr:of ottr:Triple; ottr:values ( _:IRI owl:deprecated true ) ] .
4.1.4. Class template
o-bottr:Class a ottr:Template ;
ottr:parameters (
[ ottr:variable _:IRI; ottr:type owl:Class ]
[ ottr:variable _:super; ottr:type owl:Class; ottr:modifier ottr:optional ]
[ ottr:variable _:definition; ottr:type xsd:string; ottr:modifier ottr:optional ]
[ ottr:variable _:note; ottr:type xsd:string; ottr:modifier ottr:optional ]
) ;
ottr:pattern
[ ottr:of ottr:Triple; ottr:values ( _:IRI rdfs:subClassOf _:super ) ] ,
[ ottr:of o-bottr:Term; ottr:values ( _:IRI _:definition _:note ) ] .
4.1.5. Property template
o-bottr:Property a ottr:Template ;
ottr:parameters (
[ ottr:variable _:IRI; ottr:type ottr:IRI ]
[ ottr:variable _:type; ottr:type ottr:IRI ]
[ ottr:variable _:domain; ottr:type owl:Class; ottr:modifier ottr:optional ]
[ ottr:variable _:range; ottr:type owl:Class; ottr:modifier ottr:optional ]
[ ottr:variable _:definition; ottr:type xsd:string; ottr:modifier ottr:optional ]
[ ottr:variable _:note; ottr:type xsd:string; ottr:modifier ottr:optional ]
) ;
ottr:pattern
[ ottr:of ottr:Triple; ottr:values ( _:IRI rdf:type _:type ) ] ,
[ ottr:of ottr:Triple; ottr:values ( _:IRI rdfs:domain _:domain ) ] ,
[ ottr:of ottr:Triple; ottr:values ( _:IRI rdfs:range _:range ) ] ,
[ ottr:of o-bottr:Term; ottr:values ( _:IRI _:definition _:note ) ] .
5. References
- RDF 1.1 Turtle
- https://www.w3.org/TR/turtle/
- D2RQ Mapping Language, "7. Translating values (d2rq:TranslationTable)"
- https://d2rq.org/d2rq-language#translationtable
- wOTTR 0.5.0: Core vocabulary and grammar this one extends.
- http://spec.ottr.xyz/wOTTR/0.5.0/
- rOTTR 0.2.3: Terms, blank nodes and base templates for RDF.
- http://spec.ottr.xyz/rOTTR/0.2.3/
- mOTTR 0.1.3: Concepts and abstract model.
- http://spec.ottr.xyz/mOTTR/0.1.3/
- stOTTR 0.1.6: Terse syntax used in the examples.
- http://spec.ottr.xyz/stOTTR/0.1.6/
- 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