Skip to content

Commit dd260b2

Browse files
committed
Use the new --clean-obo option.
Use ROBOT's new `--clean-obo` option when producing the OBO artefacts. Since there is already a `obo_format_options` in the ODK configuration, we reuse it, and set the default value to --clean-obo 'strict drop-untranslatable-axioms' We default to dropping the untranslatable axioms because this has always been the standard behaviour of the ODK (before this option existed, this was done by forcibly grepping out the `owl-axioms` tag from the OBO files). I would prefer to default to `--clean-obo simple`, which has the additional effect of forcibly removing GCI axioms. However this is a consequential change, one that we should probably not force upon our users. We set the default value using some custom code, instead of statically when declaring the `obo_format_options` field. This way, if a user has already set this option to something in her configuration file, she will still get the default behaviour of dropping the untranslatable axioms. But we do _not_ touch the value set by the user if it already contains a `--clean-obo` flag.
1 parent bf0becb commit dd260b2

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

odk/odk.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ class OntologyProject(JsonSchemaMixin):
791791
"""Emails to use in travis configurations. """
792792

793793
obo_format_options : str = ""
794-
"""Additional args to pass to robot when saving to obo. TODO consider changing to a boolean for checks"""
794+
"""Additional args to pass to robot when saving to obo. The default is '--clean-obo "strict drop-untranslatable-axioms"'."""
795795

796796
catalog_file : str = "catalog-v001.xml"
797797
"""Name of the catalog file to be used by the build."""
@@ -854,7 +854,8 @@ def fill_missing(self):
854854
The config can be lazy and just specify an id list.
855855
These are used to create stub product objects.
856856
857-
(this adds complexity and may be removed)
857+
This method is also intended to perform any checks
858+
and initialisations on the entire configuration tree.
858859
"""
859860
if self.import_group is not None:
860861
self.import_group.fill_missing(self)
@@ -867,6 +868,11 @@ def fill_missing(self):
867868
if self.components is not None:
868869
self.components.fill_missing(self)
869870

871+
if not '--clean-obo' in self.obo_format_options:
872+
if len(self.obo_format_options) > 0:
873+
self.obo_format_options += ' '
874+
self.obo_format_options += '--clean-obo "strict drop-untranslatable-axioms"'
875+
870876
@dataclass
871877
class ExecutionContext(JsonSchemaMixin):
872878
"""

template/src/ontology/Makefile.jinja2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ $(SUBSETDIR)/%.owl: $(ONT).owl | $(SUBSETDIR) all_robot_plugins
917917

918918
{% if 'obo' in project.export_formats %}
919919
$(SUBSETDIR)/%.obo: $(SUBSETDIR)/%.owl
920-
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o $@.tmp.obo && grep -v ^owl-axioms $@.tmp.obo > $@ && rm $@.tmp.obo
920+
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o $@
921921
{% endif -%}
922922
{% if 'ttl' in project.export_formats %}
923923
$(SUBSETDIR)/%.ttl: $(SUBSETDIR)/%.owl
@@ -1249,7 +1249,7 @@ $(TRANSLATIONSDIR)/%.babelon.json: $(TRANSLATIONSDIR)/%.babelon.tsv
12491249
{% if r.startswith('custom-') %}{% set release = r | replace("custom-","") %}{% else %}{% set release = "$(ONT)-" ~ r %}{% endif -%}
12501250
{% if 'obo' in project.export_formats -%}
12511251
{{ release }}.obo: {{ release }}.owl
1252-
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o $@.tmp.obo && grep -v ^owl-axioms $@.tmp.obo > $@ && rm $@.tmp.obo
1252+
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o $@
12531253
{% endif -%}
12541254
{% if 'ttl' in project.export_formats -%}
12551255
{{ release }}.ttl: {{ release }}.owl
@@ -1287,7 +1287,7 @@ $(ONT).owl: $(ONT)-{{ project.primary_release }}.owl
12871287

12881288
{% if 'obo' in project.export_formats -%}
12891289
$(ONT).obo: $(ONT).owl
1290-
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o $@.tmp.obo && grep -v ^owl-axioms $@.tmp.obo > $@ && rm $@.tmp.obo
1290+
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o $@
12911291
{% endif -%}
12921292
{% if 'ttl' in project.export_formats -%}
12931293
$(ONT).ttl: $(ONT).owl

0 commit comments

Comments
 (0)