ROBOT Tutorial

James Overton and Becky Jackson

ROBOT

Outline

  • About ROBOT
  • ROBOT command overview
  • Basic tasks
  • Ontology development
  • Ontology releases

What is ROBOT?

a command-line tool and library

for automating OWL ontology development tasks

http://robot.obolibrary.org

ROBOT and OBO

ROBOT is an OBO Tool”

OBO = Open Biological and Biomedical Ontologies

But ROBOT is not limited to OBO !!!

Why Use ROBOT?

  • script and automate repetitive tasks
  • shared best practices, documentation
  • usually easier than custom OWLAPI or Jena code

How to get ROBOT?

  • requires Java 11, cross-platform
  • download a single robot.jar file
  • optionally download a robot script

http://robot.obolibrary.org

Cite ROBOT

R.C. Jackson, J.P. Balhoff, E. Douglass, N.L. Harris, C.J. Mungall, and J.A. Overton.

ROBOT: A tool for automating ontology workflows.

BMC Bioinformatics, vol. 20, July 2019.

OBO Development Tools Stack

DROID (new) web interface for GNU Make + GitHub
GitHub public repositories, workflows
ODK GNU Make templates, Docker container
GNU Make, git build tool, version control
DOS-DP RDF/OWL generation
ROBOT RDF/OWL manipulation
OWLAPI, Apache Jena RDF/OWL libraries

ROBOT Project

ROBOT Design

  • robot-command
    • CLI interface for 27 Commands
    • handles IO
    • chains of Commands
    • Commands call robot-core Operations
  • robot-core
    • library of 21 Operations
    • use from any JVM language
    • use from Python with py4j

ROBOT Command Overview

OWLAPI Convenience

robot convert change format: RDF/XML, TTL, OBO, OMN, …
robot extract extract module: SLME TOP/BOT/STAR, MIREOT
robot merge merge ontologies, imports
robot unmerge undo merge (“subtract” axioms)
robot mirror make local copies of import chain
robot measure report ontology metrics
robot python control ROBOT from Python

OWL Reasoner Convenience

robot reason reason, add axioms: ELK, HermiT, …
robot explain output explanation for an inference
robot materialize materialize inferred expressions
robot relax relax Equivalents to SubClassOf
robot reduce remove redundant SubClassOf axioms
robot validate-profile check the OWL reasoning profile

OWL Editing Convenience

robot annotate add ontology annotations
robot diff show differences between ontologies
robot export convert OWL to tables
robot rename map old IRIs to new IRIs
robot remove remove selected axioms from ontology
robot filter copy selected axioms to a new ontology
robot repair fix common problems (OBO focused)
robot collapse prune class hierarchies
robot template convert tables to OWL

Apache Jena Convenience

robot query SPARQL: ASK, SELECT, CONSTRUCT, UPDATE
robot verify run query, print and exit on results
robot report customizable quality control report (OBO defaults)
robot expand execute SPARQL expansion rules in annotations

Chaining ROBOT Commands

> robot merge --input foo-edit.owl \
  annotate --version-iri "$(URL)/$(TODAY)/foo.owl" \
  query --update tweak.ru \
  reason --reasoner HermiT \
  relax \
  reduce --output foo.owl \
  verify --queries test.rq --output-dir tests/ \
  report --output report.tsv \
  convert --output foo.obo

ROBOT Roadmap

  • coordinate with Protégé project to update to latest OWLAPI 4.x series
  • robot subset extract ontology subsets by annotations

ROBOT Documentation

Basic Usage

help

robot help [command]
robot [command] --input [file] ... --output [file]

How do you see what is stated in your ontology?

export

Export Header

  • Separate fields with pipe (|)
  • Special values
    • IRI / ID
    • LABEL / SYNONYMS
    • SubClass Of / SubClasses
    • Type
  • Properties
    • IAO:0000115 / definition

Get a table of parents

robot export --input edit.owl \
  --header "ID|LABEL|SubClass Of" \
  --export results/export.csv

The ID column will always contain CURIEs and the LABEL column will always contain labels, but other values are rendered by their label when possible.

Get a table of parents using IDs

robot export --input edit.owl \
  --header "ID|SubClass Of" \
  --entity-format ID \
  --export results/export-parents.csv

You can set the rendering for all entity references with

--entity-format: ID, IRI, LABEL, NAME

Get a table of IDs, labels, and definitions

robot export \
  --input edit.owl \
  --header "ID|LABEL|definition" \
  --export results/export-definitions.csv

Annotations will always contain the literal values.

You can reference an annotation property by ID or label.

Get a table of properties

robot export --input edit.owl \
  --header "ID|LABEL|Type" \
  --entity-select "properties" \
  --export results/export-properties.csv

You can select classes, individuals, and/or properties with

--entity-select "classes properties"

query (part 1)

Run a SELECT query

robot query --input edit.owl \
  --query select.rq results/select.tsv

Run an ASK query

robot query --input edit.owl \
  --query ask.rq results/ask.txt

ASK always returns true/false

How do you see what is inferred by your ontology?

reason

Perform logical validation

robot reason --input unsatisfiable.owl

Check that there are no unsatisfiable entities and that the ontology is consistent

Assert inferred statements

robot reason --input non-reasoned.owl \
  --output results/reasoned.owl

Interlude: diff

robot diff \
  --left non-reasoned.owl \
  --right results/reasoned.owl \
  --output results/diff.diff

Formats: plain, pretty, html, markdown

What reasoner should I use?

  • ELK: A fast reasoner for the OWL2 EL subset
  • HermiT: A full OWL2 DL reasoner for complex ontologies

Annotate inferred axioms

--annotate-inferred-axioms true

Create a new ontology with inferred statements only

--create-new-ontology true
--create-new-ontology-with-annotations true

Remove redundant subclass axioms

--remove-redundant-subclass-axioms true

Ontology Development

How do you create ontology content?

template

What does a ROBOT template look like?

ID Label Type Annotation Parent
ID LABEL TYPE A property SC %
ex:123 Example owl:Class An example owl:Thing

Special template strings

  • ID: term CURIE
  • LABEL: term label, asserted as rdfs:label
  • TYPE: term entity type (you can use classes here for instances)

Annotations

  • A + property label or ID
    • A definition
    • A IAO:0000115

Axiom Annotations

Axiom annotations are applied to the column to the left with >

Annotation Axiom Annotation
A definition >A database_cross_reference
My def … url:http://example.com

Logic

  • SC %: direct superclass
  • EC %: equivalent class

Wildcards

  • % can be used as a wildcard to fill in logical expressions:
    • SC 'has part' some %
  • You can use existing classes in the expression:
    • SC 'has part' some ('part 1' and %)

Class Types

  • CLASS_TYPE: specify subclass or equivalent expression type
  • C %: interchangeable expression type
ID Class Type Has Part
ID CLASS_TYPE C ‘has part’ some %
ex:0
ex:1 equivalent ex:0
ex:2 subclass ex:0

Labels

You can reference a class or property by label if:

  • It is defined in your template and your template has a LABEL column OR
  • It is defined in your --input ontology

Including multiple values

Use the SPLIT keyword to allow multiple values in a single cell, separated by the provided character

ID Parent
ID SC % SPLIT=,
ex:4 ex:0,ex:1,ex:2

Create a new module

robot template --input edit.owl \
  --template module.tsv \
  --ontology-iri http://purl.obolibrary.org/obo/robot/mod.owl \
  --output results/mod.owl

The --ontology-iri arg will assign this ontology IRI to our new module. This can be used in the import statement in the core ontology.

Add a new class to an ontology

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

If your ontology includes imports, use --collapse-import-closure false with any merge option to maintain the closure.

CONSTRUCT a module with labels and a new annotation

robot query --input edit.owl \
  --query construct.rq results/construct.ttl

You can specify the output format of the constructed module with --format (e.g., ttl)

Update existing annotations with INSERT/DELETE

robot query --input edit.owl \
  --update update.ru \
  --output results/updated.owl

How do you reuse other ontologies?

extract

Extract with SLME

robot extract \
  --input-iri http://purl.obolibrary.org/obo/obi.owl \
  --term OBI:0000443 \
  --method BOT \
  --output results/obi_bot.owl

SLME modules include the input “seed” (term) and all terms required for to preserve logic between entities in the module SLME methods: BOT (seed + superclasses), TOP (seed + subclasses), STAR (seed + inter-relationships)

Extract with MIREOT

robot extract \
  --input-iri http://purl.obolibrary.org/obo/obi.owl \
  --method MIREOT \
  --lower-terms obi_terms.txt \
  --output results/obi_mireot.owl

MIROET modules only preserve the subclass hierarchy, but do not include additional logical relationships.

Ontology Releases

How do you create a “release” version of your ontology?

merge

Merge separate modules of an ontology

robot merge --input edit.owl \
  --input foo.owl \
  --output results/merged.owl

Merge import statements

robot merge --input with-import.owl \
  --output results/merged_imports.owl

If your ontology has import statements, ROBOT will automatically merge them.

Use --collapse-import-closure false to maintain them when merging separate files

annotate

  • https://robot.obolibrary.org/annotate
  • --input: input ontology
  • --version-iri: add a version IRI to the ontology
  • --annotation [property] [value]: add an annotation to the ontology
  • --output: output ontology

Add ontology metadata

robot annotate --input edit.owl \
  --version-iri \
    https://github.com/ontodev/robot/releases/2019-07-31/edit.owl \
  --annotation oboInOwl:date "07:31:2019 12:00" \
  --output results/annotated.owl

Reason, Relax, Reduce

reason - relax - reduce

How do you ensure your ontology aligns with OBO standards?

report

What gets checked?

  • Ontology metadata: description, license, title
  • Annotations: formatting, duplicates and multiples, missing required
  • Logic: equivalent pairs, missing superclasses

Run a standard report on your ontology

robot report --input edit.owl \
  --output results/report.tsv

Run a standard report without failing

robot report --input edit.owl \
  --fail-on none \
  --output results/report.tsv

You can choose what violation level to fail on: ERROR, WARN, INFO, or none

What other checks can you run on your ontology?

verify

https://robot.obolibrary.org/verify

Create your own rules using SPARQL queries and verify your ontology conforms to them

validate-profile

https://robot.obolibrary.org/validate-profile

Validate your ontology against an OWL 2 profile: EL, RL, QL, DL, Full

measure

https://robot.obolibrary.org/measure

Compute metrics about your ontology (number of classes, number of axioms, OWL2 profile, etc.)

What’s next?

Explore the docs to learn more!

https://robot.obolibrary.org

Join the community!