ROBOT

- - - - - - - - - -
view on github
getting started
common errors
chaining commands
global options
makefile
- - - - - - - - - -
annotate
convert
diff
extract
filter
materialize
merge
mirror
query
reason
reduce
relax
remove
repair
report
template
unmerge
validate
verify
- - - - - - - - - -
ROBOT is licensed under the
BSD 3-Clause License.
Theme by orderedlist

Template

ROBOT can convert tables to OWL format using templates. See template.csv for an example. The approach extends the QTT method described in Overcoming the ontology enrichment bottleneck with Quick Term Templates.

ROBOT can read comma-separated values (.csv) or tab-separated values (.tsv or .tab):

robot template --template template.csv \
  --prefix "ex: http://example.com/" \
  --ontology-iri "https://github.com/ontodev/robot/examples/template.owl" \
  --output results/template.owl

Each template file must be set up in the following format:

  1. Headers: ROBOT expects the first row to contain column names for every column used in the data. These are used to make error messages more helpful.
  2. Templates: ROBOT expects the second row to contain template strings for each column that will be used in the OWL conversion. See below for details on template strings.
  3. Data: ROBOT expects each of the remaining rows to correspond to an OWLClass or OWLIndividual. (In the future we may add support for other sorts of OWL entities). Rows with a blank “ID” column will be skipped.

The template command accepts an optional input ontology, either using the --input option or from the previous command in a chain. If an input ontology is given, its RDFS labels will be used when parsing the template. The --template or -t option specified the CSV or TSV template file. Multiple templates are allowed, and the order of templates is significant. You can also specify the normal --prefix options, the --output-iri and --version-iri, and the usual --output options. See below for the three different merge options, and details on how they control the output of the command.

Template Strings

Sometimes you want to include zero or more values in a single spreadsheet cell, for example when you want to allow for multiple annotations or have seperate logical axioms. If a template string also contains SPLIT=|, then ROBOT will use the | character to split the contents of a cell in that column and add an annotation for each result (if there are any). Instead of | you can specify a string of characters of your choice - other than pure whitespace - to split on (e.g. SPLIT=, ).

Merging

The template command has three options for merging, which are especially useful when chaining commands. First some terminology:

The three options can differ in which ontology is saved for the --output option and which is sent to the next command in the chain:

option --output output
no merge result result
merge before merged merged
merge after result merged

These three options are particularly useful when chaining commands. For instance, the merge-after option lets you save the result ontology separately, then send the merged ontology to the next command. See merge for more information on merge options, including --collapse-import-closure and --include-annotations.

If the command inclues --ancestors, the result ontology will include the ancestors (from the input ontology) of the result ontology terms. Only the labels of the ancestors will be included.

Examples

Create an output ontology that includes the input ontology and the terms defined in the template:

robot template --merge-before --input edit.owl \
  --template template.csv --output results/template.owl

Create two outputs - the templated terms (uberon_template.owl) and the input ontology merged with the output ontology with an annotation (uberon_v2.owl):

robot template --merge-after \
  --input edit.owl \
  --template uberon_template.csv \
  --output results/uberon_template.owl \
  annotate --annotation rdfs:comment "UBERON with new terms" \
  --output results/uberon_v2.owl

Create an output ontology that consists of the template terms plus their dependencies (uberon_template_2.owl):

robot template --ancestors --input edit.owl \
  --template uberon_template.csv \
  --ontology-iri "https://github.com/ontodev/robot/examples/uberon_template_2.owl" \
  --output results/uberon_template_2.owl

Create an output ontology that includes the input ontology and the terms defined in the template, but keep the import statements* (test_template.owl):

robot template --merge-before \
  --input test.owl \
  --collapse-import-closure false \
  --template uberon_template.csv \
  --output results/test_template.owl

* NOTE: the imports would be merged into the output if --collapse-import-closure true is included instead.


Error Messages

Missing Template Error

You must specify at least one template with --template to proceed.

Merge Error

--merge-before and --merge-after cannot be used simultaneously.

Annotation Property Error

The annotation property provided could not be resolved. Check your template to ensure the provided annotation property is in a correct IRI or CURIE format. For legibility, using CURIEs is recommended, but you must ensure that the prefix is defined.

A rdfs:label
A http://www.w3.org/2000/01/rdf-schema#label

Datatype Error

The datatype provided in an AT template string could not be resolved. Check your template to ensure the provided datatype is in a correct IRI or CURIE format. For legibility, using CURIEs is recommended, but you must ensure that the prefix is defined.

AT rdfs:label^^xsd:string
AT rdfs:label^^http://www.w3.org/2001/XMLSchema#string

File Type Error

The --template option accepts the following file types: CSV, TSV, or TAB.

ID Error

Each template must have an ID column. Keep in mind that if the template has an ID column, but it is not filled in for a row, that row will be skipped.

IRI Error

The IRI provided as the value (in a row) to an AI template string could not be resolved as an IRI. Check your template to ensure the provided value is in a correct IRI or CURIE format. If using CURIEs, remember to ensure the prefix is defined.

Language Format Error

The template string for an AL annotation must always include @.

AL rdfs:label@en

Template File Error

The template cannot be found in the current directory. Make sure the file exists and your path is correct.

Typed Format Error

The template string for an AT annotation must always include ^^.

AT rdfs:label^^xsd:string

Axiom Annotation Error

An axiom annotation is an annotation on an axiom, either a class axiom or another annotation. Because of this, any time >A is used, an annotation must be in the previous column. Any time >C is used, a class expression must be in the previous column.

A rdfs:label,>A rdfs:comment
C %,>C rdfs:comment

Column Mismatch Error

There number of header columns (first row) must be equal to the number of template string columns (second row).

Missing Type Error

If no CLASS_TYPE column is included, ROBOT will default to using subclass. If a CLASS_TYPE column is included, though, each row must include a specified class type. If the CLASS_TYPE is left empty, this error message will be returned.

Null ID Error

An IRI cannot be created from the provided ID. This is most likely because the ID is not formatted properly, as an IRI or a CURIE.

Parse Error

The content of a class expression cell (C) was not able to be parsed by OWLAPI. Check the formatting of the cell and the template string to ensure you are using valid CURIEs and/or IRIs.

Unknown Template Error

Valid template strings are limited to the described above. If a different template string is provided, this error message will be returned.

Unknown Type Error

The CLASS_TYPE values are limited to subclass or equivalent. Anything else placed in that column will result in this error message.