ROBOT

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

Makefile

Contents

  1. Overview
  2. Releases
  3. Modular Development

Overview

On Unix platforms (including macOS and Linux) you can use the venerable GNU Make tool to string together multiple robot commands. Make can also handle dependencies between build tasks.

When working with Makefiles, be careful with whitespace! Make expects tabs in some places and spaces in others, and mixing them up will lead to unexpected results. Configure your text editor to indicate when tabs or spaces are being used.

Fetching ROBOT

You can use Make to fetch the latest ROBOT like so:

build:
    mkdir -p build

build/robot.jar: | build
   curl -L -o build/robot.jar "https://github.com/ontodev/robot/releases/latest/download/robot.jar"

ROBOT := java -jar build/robot.jar

The rule to create build/robot.jar depends on the build rule, which creates a build directory. The JAR is downloaded into this directory, and then the ROBOT variable is set to the command to run that JAR.

Releases

The Makefile for COB is a good example of a simple workflow.

Most release workflows include the following steps:

  1. Report on the -edit file
  2. Merge modules and imports
  3. Reason to create the main OWL release
  4. Convert to create an OBO format release
  5. Filter to generate subsets

The Ontology Development Kit uses ROBOT for the Makefile included in the template, and serves as a thorough example of using ROBOT with make.

Modular Development

Many ontologies are moving towards development using modules created by ROBOT templates. The workflow is as follows:

  1. Create a template and generate the module
  2. Extract required imports (optional, only if using external entities)
  3. Import the module into the main ontology (see below)
  4. Merge modules when releasing

The Ontology for Biomedical Investigations uses various modules to, for example, add new assays. While this process can be done manually, it can be streamlined by adding in Make rules for the target modules:

MODULES = new_terms logical_axioms

modules: $(MODULES)

$(MODULES):
   robot template --input ont-edit.owl \
   --template templates/$@.csv \
   annotate \
   --ontology-iri "http://purl.obolibrary.org/obo/ont/modules/$@.owl" \
   --output modules/$@.owl

The modules rule will generate all modules specified by the MODULES variable (in this example, the modules are new_terms and logical_axioms). It expects the templates as CSV files in the templates/ directory. Adding the --input option allows entities to be found by label from the given ontology, otherwise the entities should be specified by CURIE. The new modules are then generated in the modules/ directory, annotated with an ontology IRI. Import statements should be added into the -edit ontology, and their paths specified in catalog-v001.xml:

<uri name="http://purl.obolibrary.org/obo/ont/modules/new_terms.owl" uri="modules/new_terms.owl"/>
<uri name="http://purl.obolibrary.org/obo/ont/modules/logical_axioms.owl" uri="modules/logical_axioms.owl"/>