If your project requires a stand-alone ontology – lets call it myonto.owl – that contains terms from other ontologies, an approach that works well to separate your main in-house ontology development from the updates and selected use of terms from those other ontologies, involves treating myonto.owl as the end product of merging your in-house ontology file with output of other term sources. To illustrate this, we use a web service called OntoFox to prepare a separate file of imported terms, to be included as an import file (but not actually merged with) a myonto-edit.owl file; a final merging produces myonto.owl. This workflow could use a more complicated and powerful tool called the “ontology development kit“, but here we instead offer a manual and minimally equivalent version. This requires setting up robot, a linux command line tool for manipulating ontology files in many useful ways.
A convenient way to set up your ontology development and publication is using a GitHub repository, synchronized any time you like (with GitHub desktop) with the following folder structure on your computer. This is great for making sure you have a backup “off site”, and as well ensures that ontology search engines have a particular “official” versioned file to use in their database.
|/src/ontology/myonto-edit.owl||The file you edit terms that belong in myonto directly.|
Here terms have identifiers using your MYONTO prefix, e.g. MYONTO:1234,
or the longer URL version of
|/src/ontology/imports/general_ontofox.txt||The OntoFox configuration file for specifying all |
the other imported terms from OBOFoundry etc.
|/src/ontology/imports/general_ontofox.owl||This will be generated.|
|/src/ontology/myonto.owl||This will be generated.|
|/myonto.owl||This will be generated.|
Essentially your myonto-edit.owl file will only make reference to the purl of an imported term. The separate general_ontofox.owl file will contain all the imported term’s details – the hierarchy, the rdfs:label, the IAO:0000115 definition etc. so they don’t have to be repeated in the main myonto-edit.owl file. Your ontology may enhance imported terms with annotations and axioms but be careful to ensure these additions exist in myonto-edit.owl, and not the general_ontofox.owl file or they will be overwritten when OntoFox is used to update the import file.
Import with OntoFox
The Ontofox ontology import file service is a convenient tool to fetch selected FoodOn or other ontology terms from their “fresh” source ontologies into a separate OWL ontology file, including annotation (label, description) and other axioms you are interested in. The Ontofox specification file – in our case general_ontofox.txt is reused in the future to import updated versions of those terms. Here is an example specification file (these parameters can also be entered into the Ontofox web form itself) drawing from FoodOn directly, but other ontologies can be included too – as indicated by the beginning of another import spec with “SOME_OTHER_ONTOLOGY” at bottom.
[URI of the OWL(RDF/XML) output file] http://purl.obolibrary.org/obo/generic/foodon_import.owl [Source ontology] FOODON [Low level source term URIs] http://purl.obolibrary.org/obo/FOODON_03411564 #food source includeAllChildren [Top level source term URIs and target direct superclass URIs] [Source term retrieval setting] includeNoIntermediates [Source annotation URIs] http://www.w3.org/2000/01/rdf-schema#label http://purl.obolibrary.org/obo/IAO_0000115 #iao:definition http://www.geneontology.org/formats/oboInOwl#hasSynonym [Source annotation URIs to be excluded] [Source ontology] SOME_OTHER_ONTOLOGY ...
This will create an import file containing the entire tree of “food source” (FOODON_03411564) terms from FoodOn.
Run this command to update the general_ontofox.owl ontology file at any time from the ontofox configuration using:
curl -s -F file=@imports/general_ontofox.txt -o imports/general_ontofox.owl http://ontofox.hegroup.org/service.php
You can then see the impact of an OntoFox refresh when viewing general_ontofox.owl directly in Protege.
Ensure general_ontofox.owl is added and visible in Protege’s Active ontology tab, Ontology imports section when viewing myonto-edit.owl . Then you will also see the general_ontofox.owl changes within the context of myonto-edit.owl
This is a good time to check the logical consistency of your ontology with a more stringent reasoner, and make axiom or class-subclass adjustments to remedy any problems:
robot reason --input myonto-edit.owl --reasoner hermit
or with a more basic one that is faster:
robot reason --input myonto-edit.owl --reasoner ELK
Merge with Robot
Run a robot merge command to merge myonto-edit.owl with its Ontology imports section files to create /src/ontology/myonto.owl
robot merge --input myonto-edit.owl --xml-entities --output myonto.owl
The –xml-entities is optional – it just does some work to substitute ontology prefixes MYONTO:xyz in place of their full http://purl.obolibrary.org/obo/myonto_xyz urls (assuming this is an ontology which is being given OBOFoundry term purls).
Copy to root folder
If you are happy with the resulting file, you can copy it up to the root folder as /myonto.owl and know that most ontology search engines will detect the change within a day or a week.
Other possibilities are to allow the main myonto.owl file to still have external import files that sit off of the root folder in an /imports/ folder, etc. Ontology search engines can handle this setup too.