Spring Boot microservice that wraps ROBOT (an OBO ontology tool) for WebProtégé integration. Provides Java abstractions for programmatic ontology processing with support for command chaining.
| Command | Status | Description |
|---|---|---|
| Annotate | ✅ Implemented | Add metadata to ontologies (title, description, license, version IRI) |
| Extract | ✅ Implemented | Create focused modules using SLME, MIREOT, or Subset methods |
| Collapse | ✅ Implemented | Streamline class hierarchies by removing intermediate classes |
| Convert | ✅ Implemented | Transform ontologies between formats (JSON, OBO, OWL, Turtle, etc.) |
| Expand | ✅ Implemented | Convert shortcut annotation properties (macros) into OWL axioms |
| Remove | ✅ Implemented | Eliminate selected axioms from ontologies |
| Filter | ✅ Implemented | Select and retain specific axioms from ontologies (inverse of remove) |
| Relax | ✅ Implemented | Convert equivalence axioms into weaker SubClassOf axioms |
| Repair | ✅ Implemented | Fix common ontology issues (deprecated references, axiom annotations) |
| Export | ✅ Implemented | Generate tabular representations of ontology entities |
| Diff | 🚧 Not Yet Implemented | Compare ontology versions |
| Materialize | 🚧 Not Yet Implemented | Materialize class expressions |
| Measure | 🚧 Not Yet Implemented | Compute ontology metrics |
| Merge | 🚧 Not Yet Implemented | Combine multiple ontologies |
| Reduce | 🚧 Not Yet Implemented | Remove redundant axioms |
| Unmerge | 🚧 Not Yet Implemented | Reverse a merge operation |
- Java 21 or higher
- Maven 3.8+
git clone https://github.com/protegeproject/webprotege-robot-service.git
cd webprotege-robot-service
mvn clean install@Service
public class OntologyProcessingService {
@Autowired
private RobotCommandExecutor executor;
public void processOntology() throws Exception {
// Prepare ROBOT commands
var annotateCmd = ...
var extractCmd = ...
// Execute chain: annotate then extract
var result = executor.executeChain(
Path.of("input.owl"),
List.of(annotateCmd, extractCmd),
Path.of("output.owl")
);
}
}var command = new RobotAnnotateCommand(
IRI.create("http://example.org/ontology"),
IRI.create("http://example.org/ontology/v1.0"),
List.of(
new PlainAnnotation("rdfs:label", "Example Ontology"),
new LanguageAnnotation("dc:title", "Exemple", "fr"),
new LinkAnnotation("dc:source", "http://example.org/source")
),
AnnotateFlags.INTERPOLATE
);var strategy = new SlmeExtractStrategy(
SlmeExtractMethod.BOT, // BOT, TOP, or STAR
List.of("GO:0008150", "GO:0003674")
);
var command = new RobotExtractCommand(
strategy,
ExtractIntermediates.minimal,
HandlingImports.include,
ExtractFlags.COPY_ONTOLOGY_ANNOTATIONS
);var strategy = new MireotExtractStrategy(
List.of("GO:0008150"), // upper terms
List.of("GO:0009987"), // lower terms
List.of() // branch-from terms
);
var command = new RobotExtractCommand(
strategy,
null,
null,
ExtractFlags.COPY_ONTOLOGY_ANNOTATIONS
);// Collapse with custom threshold
var command = new RobotCollapseCommand(
5, // minimum subclass count to preserve intermediate classes
List.of()
);
// Collapse with precious terms (protected from removal)
var command = new RobotCollapseCommand(
3,
List.of("GO:0008150", "GO:0003674") // terms to protect
);// Simple format conversion to JSON
var command = new RobotConvertCommand(new JsonConvertStrategy());
// Convert to OWL (RDF/XML)
var command = new RobotConvertCommand(new OwlConvertStrategy());
// OBO with validation disabled, cleaning options, and custom prefixes
var strategy = new OboConvertStrategy(
false, // disable document structure validation
List.of(CleanOboOption.drop_extra_labels, CleanOboOption.merge_comments),
Map.of("FOO", IRI.create("http://example.org/foo#"),
"BAR", IRI.create("http://example.org/bar#"))
);
var command = new RobotConvertCommand(strategy);// Expand all macros with source annotations
var command = new RobotExpandCommand(
List.of(), // expand all terms
List.of(), // don't exclude any
ExpandFlags.ANNOTATE_EXPANSION_AXIOMS // annotate expansion axioms with dct:source
);
// Exclude specific terms from expansion
var command = new RobotExpandCommand(
List.of(), // expand all
List.of("GO:0005575", "GO:0008150") // except these terms
// no flags - don't annotate
);// Remove class hierarchy
var command = new RobotRemoveCommand(
null, // baseIri
List.of("UBERON:0000062"), // terms to remove
List.of(), // excludeTerms
List.of(), // includeTerms
List.of("self", "descendants"), // selectors
null, // axioms
List.of(), // dropAxiomAnnotations
CommandFlags.SIGNATURE // flags
);
// Remove deprecated classes using pattern selector
var command = new RobotRemoveCommand(
null, // baseIri
null, // terms
List.of(), // excludeTerms
List.of(), // includeTerms
List.of("owl:deprecated='true'^^xsd:boolean"), // selectors (pattern selector)
null, // axioms
List.of() // dropAxiomAnnotations
);// Filter class hierarchy with annotations
var command = new RobotFilterCommand(
null, // baseIri
List.of("GO:0008150"), // terms to keep
null, // excludeTerms
null, // includeTerms
List.of("self", "descendants", "annotations"), // selectors
null, // axioms
null // dropAxiomAnnotations
);
// Filter logical axioms with signature flag
var command = new RobotFilterCommand(
null, // baseIri
List.of("GO:0008150", "GO:0003674"), // terms to keep
List.of("GO:0005575"), // excludeTerms (prevent from output)
null, // includeTerms
List.of("self", "descendants"), // selectors
List.of("logical"), // axioms (keep only logical axioms)
null, // dropAxiomAnnotations
CommandFlags.SIGNATURE // flags (match named entities only)
);// Relax SubClassOf axioms with conjunctive expressions
var command = new RobotRelaxCommand(RelaxFlags.INCLUDE_SUBCLASS_OF);
// Complete OBO workflow
var command = new RobotRelaxCommand(
RelaxFlags.INCLUDE_NAMED_CLASSES,
RelaxFlags.INCLUDE_SUBCLASS_OF,
RelaxFlags.ENFORCE_OBO_FORMAT
);// Fix deprecated class references
var command = new RobotRepairCommand(
List.of(), // no annotation properties to migrate
RepairFlags.INVALID_REFERENCES // fix deprecated class references
);
// Comprehensive repair: fix references, migrate properties, merge axioms
var command = new RobotRepairCommand(
List.of("oboInOwl:hasDbXref", "rdfs:seeAlso", "rdfs:isDefinedBy"),
RepairFlags.INVALID_REFERENCES,
RepairFlags.MERGE_AXIOM_ANNOTATIONS
);// HTML export with entity filtering
var command = new RobotExportCommand(
"ID|LABEL|SubClass Of",
ExportFormat.html,
List.of("LABEL"),
"|", // multi-value delimiter
List.of("classes"), // only export classes
EntitySelect.NAMED, // only named entities
EntityFormat.LABEL // render as labels
);
// JSON export for programmatic use
var command = new RobotExportCommand(
"IRI|LABEL|SubClass Of",
ExportFormat.json,
List.of(),
null,
List.of("classes"),
EntitySelect.NAMED,
EntityFormat.IRI // use full IRIs
);mvn clean installmvn testThe project uses Spotless with Google Java Style (2-space indentation):
mvn spotless:apply # Auto-format code
mvn spotless:check # Check formattingmvn spotbugs:check # Run SpotBugs analysisThis project is licensed under the BSD 2-Clause License - see the LICENSE file for details.