Robot obo tool
Skills for using ROBOT, the OBO ontology command-line toolkit for reasoning, template-based term creation, quality control, format conversion, and ontology manipulation. Use this when working with OWL/OBO ontologies that need automated processing.From its SKILL.md
npx -y skills add ai4curation/curation-skills --skill robot-obo-toolAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 24 stars24 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
16.8 KB, ~4.2k tokens by cl100k_base, as published. Nobody here has run it
ROBOT Guide
Overview
ROBOT (ROBOT is an OBO Tool) is the standard command-line tool for OBO ontology development. It handles reasoning, quality control, format conversion, module extraction, template-based term generation, and release automation. Almost every OBO Foundry ontology uses ROBOT in its build pipeline.
ROBOT is a Java application distributed as a JAR with a shell wrapper script.
Home page: https://robot.obolibrary.org/
When to Use
Use ROBOT when you need to:
- Reason over an ontology - classify, check consistency, find unsatisfiable classes
- Generate terms from templates - create OWL from TSV/CSV spreadsheets
- Run quality control - check for missing labels, definitions, bad xrefs
- Convert formats - between OWL, OBO, Turtle, OFN, Manchester, JSON
- Extract modules - pull subsets from large ontologies
- Diff ontologies - compare two versions at the OWL level (consider OAK for higher level diffs)
- Query with SPARQL - run SELECT/CONSTRUCT/ASK queries
- Build release pipelines - chain commands for automated releases
Do NOT use ROBOT when:
- You want to search external ontologies interactively - use OAK or OLS MCP instead
- You want to edit individual OBO stanzas by hand - use obo-grep/obo-checkout tools instead
- You need programmatic ontology access from Python - use oaklib instead
Installation & Setup
ROBOT requires Java 8+. Install via:
# Download latest
curl -L https://github.com/ontodev/robot/releases/latest/download/robot.jar -o robot.jar
curl -L https://raw.githubusercontent.com/ontodev/robot/master/bin/robot -o robot
chmod +x robot
For large ontologies, increase Java memory:
export ROBOT_JAVA_ARGS="-Xmx8G"
Verify installation:
robot --version
Command Quick Reference
Every ROBOT command with a one-line description and key example. For full details on any command, read the corresponding file in docs/ within this skill directory.
Core Ontology Operations
| Command | Description | Key Example |
|---|---|---|
merge | Combine multiple ontologies | robot merge --input a.owl --input b.owl --output merged.owl |
reason | Run reasoner, assert inferred axioms | robot reason --reasoner ELK --input edit.owl --output reasoned.owl |
relax | Convert EquivalentClass to SubClassOf | robot reason ... relax --output relaxed.owl |
reduce | Remove redundant SubClassOf axioms | robot reason ... relax reduce --output reduced.owl |
materialize | Assert inferred superclass expressions | robot materialize --reasoner ELK --input edit.owl --output mat.owl |
unmerge | Remove axioms of one ontology from another | robot unmerge --input merged.owl --input remove.owl --output result.owl |
Extracting and Filtering
| Command | Description | Key Example |
|---|---|---|
extract | Extract module from ontology | robot extract --method BOT --input ont.owl --term GO:0005634 --output module.owl |
filter | Keep only matching axioms | robot filter --input ont.owl --term UBERON:0000955 --select "self ancestors" --output filtered.owl |
remove | Remove matching axioms | robot remove --input ont.owl --select "imports" --output no-imports.owl |
Creating and Editing
| Command | Description | Key Example |
|---|---|---|
template | Generate OWL from TSV/CSV templates | robot template --input ont.owl --template terms.tsv --output new-terms.owl |
annotate | Add ontology-level metadata | robot annotate --input ont.owl --ontology-iri "http://purl.obolibrary.org/obo/my.owl" --output annotated.owl |
rename | Rename entity IRIs | robot rename --input ont.owl --mappings mappings.tsv --output renamed.owl |
expand | Expand shortcut macros | robot expand --input ont.owl --output expanded.owl |
repair | Fix deprecated class references | robot repair --input ont.owl --output repaired.owl |
collapse | Collapse import hierarchy | robot collapse --input ont.owl --output collapsed.owl |
Quality Control
| Command | Description | Key Example |
|---|---|---|
report | QC report with built-in checks | robot report --input ont.owl --output report.tsv |
verify | Check SPARQL-based rules | robot verify --input ont.owl --queries rules/*.sparql |
validate-profile | Validate OWL profile compliance | robot validate-profile --input ont.owl --profile EL --output violations.tsv |
Querying and Exporting
| Command | Description | Key Example |
|---|---|---|
query | Run SPARQL queries | robot query --input ont.owl --query q.sparql results.csv |
export | Export entities as table | robot export --input ont.owl --header "ID|LABEL|SubClass Of" --export terms.csv |
diff | Compare two ontologies | robot diff --left v1.owl --right v2.owl --output changes.md |
measure | Ontology metrics | robot measure --input ont.owl --output metrics.tsv |
Debugging
| Command | Description | Key Example |
|---|---|---|
explain | Explain inferred axioms | robot explain --input ont.owl --reasoner ELK --axiom "'eye' SubClassOf 'organ'" --explanation result.md |
Other
| Command | Description | Key Example |
|---|---|---|
convert | Convert between formats | robot convert --input ont.owl --format obo --output ont.obo |
mirror | Download imported ontologies | robot mirror --input ont.owl --directory mirror/ --output catalog.xml |
Deep Dive: Reasoning
Reasoning is the most critical ROBOT operation. It validates logical consistency and infers new axioms from existing definitions.
Reasoner Choice
| Reasoner | Speed | Expressivity | When to Use |
|---|---|---|---|
| ELK | Fast | EL++ (no negation/disjunction) | Default for most OBO ontologies |
| HermiT | Slow | Full OWL DL | When ELK misses inferences or you need full DL |
| Whelk | Fast | EL++ | Alternative to ELK, Scala-based |
| Structural | Very fast | None (syntactic only) | Quick checks, no reasoning |
Most OBO ontologies use ELK. Only use HermiT when you specifically need full OWL DL reasoning.
Key Options
robot reason \
--reasoner ELK \
--equivalent-classes-allowed asserted-only \
--exclude-tautologies structural \
--input edit.owl \
--output reasoned.owl
--equivalent-classes-allowed asserted-only- Fail if reasoning produces unexpected equivalent class pairs (catches modeling errors)--exclude-tautologies structural- Skip trivially true axioms--annotate-inferred-axioms true- Mark inferred axioms withis_inferred trueannotation--exclude-duplicate-axioms true- Skip axioms already in imports--create-new-ontology true- Put inferences in a separate ontology
Debugging Unsatisfiable Classes with explain
When reasoning finds unsatisfiable classes (classes that cannot have any instances), use explain to generate human-readable markdown explanations:
robot merge --input ont.owl \
explain \
--reasoner ELK \
-M unsatisfiability \
--unsatisfiable all \
--explanation unsats.md
This generates a markdown file showing the chain of axioms that leads to each unsatisfiability. This is invaluable for debugging.
You can also explain specific entailments:
robot explain --input ont.owl \
--reasoner ELK \
--axiom "'retina' SubClassOf 'part of' some 'eye'" \
--explanation explanation.md
The --axiom uses Manchester OWL syntax. Use single quotes around class/property names that contain spaces.
Deep Dive: Templates
ROBOT templates let you create OWL ontology content from TSV/CSV spreadsheets. This is the preferred way to manage large sets of terms that follow regular patterns, because domain experts can edit spreadsheets without learning OWL.
Template File Structure
A ROBOT template is a TSV (or CSV) file with:
- Row 1: Human-readable column headers
- Row 2: ROBOT template strings (tell ROBOT how to convert each column to OWL)
- Row 3+: Data rows (one per term)
Template String Reference
Identity and Type
| Template | Description | Example Value |
|---|---|---|
ID | Term IRI (CURIE) | OBI:0000070 |
LABEL | rdfs:label | assay |
TYPE | rdf:type | owl:Class (default) |
Annotations
| Template | Description | Example Value |
|---|---|---|
A <property> | String annotation | A rdfs:comment |
AT <property>^^<datatype> | Typed annotation | AT rdfs:label^^xsd:string |
AL <property>@<lang> | Language-tagged annotation | AL definition@en |
AI <property> | IRI annotation | AI has curation status |
Class Axioms
| Template | Description | Example Value |
|---|---|---|
SC % | SubClassOf (named class) | Parent CURIE in cell |
SC 'relation' some % | SubClassOf (existential restriction) | Filler CURIE in cell |
EC % | EquivalentClass expression | Manchester syntax |
DC % | DisjointClass | Class CURIE |
C % | Class expression (type set by CLASS_TYPE column) | Expression |
CLASS_TYPE | Controls C % behavior: subclass, equivalent, or disjoint | equivalent |
Modifiers
| Modifier | Description | Example |
|---|---|---|
SPLIT=| | Split cell value on delimiter for multiple values | A alternative label SPLIT=| |
Real-World Template Example (OBI-style)
Here is a simplified template for defining assay types, based on patterns from the OBI ontology:
assays.tsv:
ontology ID label definition parent class has part evaluant associated axiom
ID LABEL AL definition@en SC % SC 'has part' some % SPLIT=| SC ('has specified input' some (% and 'has role' some 'evaluant role')) C %
OBI:0000070 assay A planned process with the objective to produce information about a material entity. OBI:0000011
OBI:0000716 ChIP-seq assay An assay using chromatin immunoprecipitation followed by sequencing. OBI:0000070 OBI:0000626
OBI:0000087 fluorescence microscopy assay A light microscopy assay using specimen fluorescence. OBI:0000070 'material entity' and ('has characteristic' some fluorescence)
Key patterns to notice:
SC %for simple parent classSC 'has part' some % SPLIT=|for multiple parts separated by|SC ('has specified input' some (% and 'has role' some 'evaluant role'))for complex restrictions using Manchester syntaxC %combined withCLASS_TYPEfor flexible subclass/equivalent declarations- Empty cells are skipped (no axiom generated)
Template Build Integration
Templates are typically processed in a Makefile:
# Generate OWL module from template
src/ontology/modules/%.owl: src/ontology/templates/%.tsv
$(ROBOT) merge --input src/ontology/edit.owl \
template --template $< \
annotate --ontology-iri "http://purl.obolibrary.org/obo/ont/modules/$(notdir $@)" \
--output $@
The merge --input before template is critical: it provides the base ontology so that CURIEs in the template can be resolved.
Merging Strategies
- No merge (default): Template result is a standalone ontology
--merge-before: Merge template result into the input ontology immediately--merge-after: Keep template result separate, merge for subsequent chained commands
Template Tips
- Use
SPLIT=|when a cell needs multiple values (e.g., multiple synonyms, multiple parents) - Manchester syntax in template cells must use single quotes around names with spaces:
'has part' some 'protein complex' - Use
--force trueduring development to continue past errors - Use
--errors errors.tsvto capture template errors to a file - The
>A,>AT,>AL,>AItemplates add axiom annotations to the preceding logical axiom
Common Pipelines
Release Pipeline
The standard OBO ontology release workflow:
robot merge --input src/ontology/edit.owl \
reason --reasoner ELK \
--equivalent-classes-allowed asserted-only \
--exclude-tautologies structural \
relax \
reduce \
annotate \
--ontology-iri "http://purl.obolibrary.org/obo/ONT.owl" \
--version-iri "http://purl.obolibrary.org/obo/ONT/releases/2024-01-01/ONT.owl" \
--annotation owl:versionInfo "2024-01-01" \
convert --format obo \
--output ONT.obo
Template Pipeline
Generate terms and merge into the ontology:
robot merge --input edit.owl \
template --template new-terms.tsv \
--merge-before \
annotate --ontology-iri "http://example.org/ont.owl" \
--output result.owl
QC Pipeline
Run quality control before release:
robot report --input edit.owl \
--fail-on ERROR \
--output qc-report.tsv
Or with custom rules:
robot verify --input edit.owl \
--queries src/sparql/qc-*.sparql \
--output-dir reports/
Module Extraction
Extract a focused module around specific terms:
robot extract --method BOT \
--input large-ont.owl \
--term-file my-terms.txt \
--output module.owl
Extraction methods:
- BOT (most common): Includes superclasses and related axioms
- TOP: Includes subclasses
- STAR: Minimal module (seed + inter-relations)
- MIREOT: Preserves hierarchy, requires upper/lower terms
- subset: Just seed terms + relations between them
Common Pitfalls
Java Memory
Large ontologies (Uberon, GO, ChEBI) need more memory:
export ROBOT_JAVA_ARGS="-Xmx8G" # 8 GB
export ROBOT_JAVA_ARGS="-Xmx16G" # 16 GB for very large ontologies
Symptom: java.lang.OutOfMemoryError: Java heap space
Reasoner Timeouts
If ELK is too slow, check for:
- Circular definitions
- Complex nested class expressions
- Large numbers of disjointness axioms
If HermiT hangs, try ELK (it handles most OBO use cases).
OBO Format Conversion Issues
robot convert --format obo may fail with --check true (default). Common causes:
- Classes with multiple labels
- Untranslatable OWL axioms (GCIs, complex restrictions)
Fix with --check false or use --clean-obo options:
robot convert --format obo \
--clean-obo drop-extra-labels drop-untranslatable-axioms \
--output ont.obo
Template Quoting
In TSV templates, be careful with:
- Tab characters (use actual tabs, not spaces)
- Manchester syntax quoting: use single quotes for names with spaces
- CURIE resolution: ensure all prefixes are defined (via
--prefixor input ontology)
Unsatisfiable Classes
If reason reports unsatisfiable classes:
- First, generate explanations:
robot explain -M unsatisfiability --unsatisfiable all --explanation unsats.md - Read the markdown - it shows the axiom chain causing each unsatisfiability
- Common causes: incorrect disjointness axioms, wrong domain/range restrictions, conflicting definitions
- Fix the source ontology and re-run reasoning
Import Resolution
If ROBOT cannot find imported ontologies:
robot --catalog catalog-v001.xml merge --input edit.owl ...
The catalog XML maps import IRIs to local files.
Chaining Commands
ROBOT's most powerful feature is command chaining. Instead of writing intermediate files:
# Without chaining (slow, creates temp files)
robot merge --input a.owl --input b.owl --output merged.owl
robot reason --input merged.owl --output reasoned.owl
robot convert --input reasoned.owl --format obo --output result.obo
Chain commands (fast, no intermediate files):
robot merge --input a.owl --input b.owl \
reason --reasoner ELK \
convert --format obo \
--output result.obo
Only the first command needs --input and only the last needs --output. Each command passes its result to the next.
Global Options
These apply to all commands:
# Custom prefixes
robot --prefix "MYONT: http://example.org/myont/" merge ...
# Import catalog
robot --catalog catalog-v001.xml merge ...
# Verbosity
robot -v merge ... # WARN level
robot -vv merge ... # INFO level
robot -vvv merge ... # DEBUG level with stack traces
# Strict mode (fail on unparsed triples)
robot --strict merge ...
Reference
For detailed documentation on every command option, read the files in the docs/ subdirectory of this skill:
docs/reason.md- Full reasoning documentationdocs/template.md- Full template documentationdocs/explain.md- Full explain documentationdocs/extract.md- Module extraction methodsdocs/report.md- QC report configurationdocs/query.md- SPARQL query executiondocs/chaining.md- Command chaining detailsdocs/global.md- Global options (prefixes, catalogs, Java)docs/examples/- Example ontology files, templates, and SPARQL queriesdocs/report_queries/- Built-in QC report query definitions
What ships with it: 362 files
12256.8 KB alongside SKILL.md
docs/
- annotate.md4.2 KB
- chaining.md1.3 KB
- collapse.md1.9 KB
- convert.md5.5 KB
- diff.md2.1 KB
- errors.md10.5 KB
- examples/animals_ext_template.owl1.6 KB
- examples/animals_ext_template.tsv56 B
- examples/animals_template_error.tsv206 B
- examples/animals_template.tsv182 B
- examples/annotated_2.owl96.2 KB
- examples/annotated_module.owl35.4 KB
- examples/annotated.obo27.9 KB
- examples/annotated.obo.gz7.6 KB
- examples/annotated.owl96.4 KB
- examples/annotated_source.owl37.9 KB
- examples/annotations.ttl344 B
- examples/asserted-equiv.owl201 B
- examples/bar.json104 B
- examples/build.gradle1.6 KB
- examples/catalog-diff.txt232 B
- examples/catalog-right.xml250 B
- examples/catalog.xml328 B
- examples/cell_part_ask.sparql291 B
- examples/cell_part_ask.txt4 B
- examples/cell_part.csv132 B
- examples/cell_part.sparql330 B
- examples/changed_source.owl37.8 KB
- examples/classes-properties.csv1.4 KB
- examples/cl_module.ofn29.0 KB
- examples/cl_module-simple.obo6.4 KB
- examples/cl_module-simple-with-added-prefix.obo6.4 KB
- examples/cl_module-strict-mergedcomments.obo7.3 KB
- examples/cl_module-strict.obo7.1 KB
- examples/edi-annotated.owl152.8 KB
- examples/edit2.owl831 B
- examples/edit.owl152.4 KB
- examples/emr_example.obo2.6 KB
- examples/emr_output.obo2.7 KB
- examples/emr_reduced.obo1.9 KB
322 more files not listed here. See all 362 in the repository.