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.
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.
Makefile for COB is a good example of a simple workflow.
Most release workflows include the following steps:
The Ontology Development Kit uses ROBOT for the
Makefile included in the template, and serves as a thorough example of using ROBOT with make.
Many ontologies are moving towards development using modules created by ROBOT templates. The workflow is as follows:
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
modules rule will generate all modules specified by the
MODULES variable (in this example, the modules are
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
<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"/>