Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding draft for base-plus pipeline #643

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

- Adding new `make reason_test` command ([pull](https://github.com/INCATools/ontology-development-kit/pull/639), [issue](https://github.com/INCATools/ontology-development-kit/issues/645))
- Adding intermediate artefact `$(TMPDIR)/$(ONT)-preprocess.owl` to the release workflow which enable the centralisation of preprocessing in a single make step. Basically, rather than creating release artefacts directly from the editors file (e.g. bfo-edit.owl), we add intermediate step from which all releases are derived. This intermediate can then be customised by the user ([pull](https://github.com/INCATools/ontology-development-kit/pull/639), [issue](https://github.com/INCATools/ontology-development-kit/issues/544))
- Re-defines the base from being "all axioms as edited by the ontology editors" to "all axioms and inferences as specified by the ontology editors". The new goal is much more rigorous in removing axioms from other ontologies as well. The old base file can now be exported as an "editors release" instead ([pull](https://github.com/INCATools/ontology-development-kit/pull/643), [issue](https://github.com/INCATools/ontology-development-kit/issues/646)).
matentzn marked this conversation as resolved.
Show resolved Hide resolved
- Introduces the option of skipping the use of reasoner during the release process (important for application ontologies), ([pull](https://github.com/INCATools/ontology-development-kit/pull/643), [issue](https://github.com/INCATools/ontology-development-kit/issues/644))
- Introduces a new mode that enable the use of ODK entirely without owl:imports in the edit file (this is great in case we want to use the ODK workflows but not check in any files, imports or components, into version control, like huge application ontologies), ([pull](https://github.com/INCATools/ontology-development-kit/pull/643), [issue](https://github.com/INCATools/ontology-development-kit/issues/629)).

# v1.3.1

Expand Down
11 changes: 9 additions & 2 deletions odk/odk.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,19 @@ class OntologyProject(JsonSchemaMixin):
release_artefacts : List[str] = field(default_factory=lambda: ['full', 'base'])
"""A list of release artefacts you wish to be exported."""

release_use_reasoner : bool = True
"""If set to True, the reasoner will be used during the release process."""

export_formats : List[str] = field(default_factory=lambda: ['owl', 'obo'])
"""A list of export formats you wish your release artefacts to be exported to, such as owl, obo, gz, ttl."""

namespaces : Optional[List[str]] = None
"""A list of namespaces that are considered at home in this ontology. Used for certain filter commands."""


use_edit_file_imports : bool = True
"""If True, ODK will release the ontology with imports explicitly specified by owl:imports in the edit file.
If False, ODK will build and release the ontology with _all_ imports and _all_ components specified in the ODK config file."""

dosdp_tools_options: str = "--obo-prefixes=true"
"""default parameters for dosdp-tools"""

Expand Down Expand Up @@ -583,7 +590,7 @@ class OntologyProject(JsonSchemaMixin):
pattern_pipelines_group : Optional[PatternPipelineGroup] = None
"""Block that includes information on all ontology imports to be generated"""

robotemplate_group : Optional[RobotTemplateGroup] = None
robot_template_group : Optional[RobotTemplateGroup] = None
"""Block that includes information on all ROBOT templates used"""

def fill_missing(self):
Expand Down
58 changes: 40 additions & 18 deletions template/src/ontology/Makefile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -814,26 +814,49 @@ $(ONT).owl: $(ONT)-{{ project.primary_release }}.owl
cp $< $@
{% endif -%}

ROBOT_RELEASE_IMPORT_MODE={% if project.use_edit_file_imports -%}$(ROBOT) merge --input $< {% else -%}
$(ROBOT) remove --input $< --select imports --trim false {% if project.use_dosdps or project.components is defined -%}
merge $(patsubst %, -i %, $(OTHER_SRC)) {% endif %}{% if project.import_group is defined -%}
merge $(patsubst %, -i %, $(IMPORT_FILES)){% endif %}{% endif %}

{% if 'base' in project.release_artefacts or project.primary_release == 'base' -%}
# base: OTHER sources of interest, such as definitions owl
$(ONT)-base.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC)
$(ONT)-base.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(IMPORT_FILES)
$(ROBOT_RELEASE_IMPORT_MODE) \{% if project.release_use_reasoner %}
reason --reasoner {{ project.reasoner }} --equivalent-classes-allowed {{ project.allow_equivalents }} --exclude-tautologies {{ project.exclude_tautologies }} \{% endif %}
relax \{% if project.release_use_reasoner %}
reduce -r {{ project.reasoner }} \{% endif %}
remove {% if project.namespaces is not none %}{% for iri in project.namespaces %}--base-iri {{iri}} {% endfor %}{% else %}--base-iri $(URIBASE)/{{ project.id.upper() }} {% endif %}--axioms external --preserve-structure false --trim false \
$(SHARED_ROBOT_COMMANDS) \
annotate --link-annotation http://purl.org/dc/elements/1.1/type http://purl.obolibrary.org/obo/IAO_8000001 \
--ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
{% if project.release_date -%} --annotation oboInOwl:date "$(OBODATE)" {% endif -%}--output $@.tmp.owl && mv $@.tmp.owl $@
{% endif -%}

{% if 'editors' in project.release_artefacts or project.primary_release == 'editors' -%}
# base: OTHER sources of interest, such as definitions owl
$(ONT)-editors.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC)
$(ROBOT) remove --input $< --select imports --trim false \
{% if project.use_dosdps or project.components is defined %}merge $(patsubst %, -i %, $(OTHER_SRC)) \
{% endif %} $(SHARED_ROBOT_COMMANDS) annotate --link-annotation http://purl.org/dc/elements/1.1/type http://purl.obolibrary.org/obo/IAO_8000001 \
$(ROBOT_RELEASE_IMPORT_MODE) \
matentzn marked this conversation as resolved.
Show resolved Hide resolved
$(SHARED_ROBOT_COMMANDS) annotate --link-annotation http://purl.org/dc/elements/1.1/type http://purl.obolibrary.org/obo/IAO_8000001 \
--ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
{% if project.release_date -%} --annotation oboInOwl:date "$(OBODATE)" {% endif -%}--output $@.tmp.owl && mv $@.tmp.owl $@
{% endif -%}

{% if 'full' in project.release_artefacts or project.primary_release == 'full' -%}
# Full: The full artefacts with imports merged, reasoned
$(ONT)-full.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(IMPORT_FILES)
$(ROBOT) merge --input $< \
reason --reasoner {{ project.reasoner }} --equivalent-classes-allowed {{ project.allow_equivalents }} --exclude-tautologies {{ project.exclude_tautologies }} \
relax \
reduce -r {{ project.reasoner }} \
$(ROBOT_RELEASE_IMPORT_MODE) \{% if project.release_use_reasoner %}
matentzn marked this conversation as resolved.
Show resolved Hide resolved
reason --reasoner {{ project.reasoner }} --equivalent-classes-allowed {{ project.allow_equivalents }} --exclude-tautologies {{ project.exclude_tautologies }} \{% endif %}
relax \{% if project.release_use_reasoner %}
reduce -r {{ project.reasoner }} \{% endif %}
$(SHARED_ROBOT_COMMANDS) annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) {% if project.release_date -%}--annotation oboInOwl:date "$(OBODATE)" {% endif -%}--output $@.tmp.owl && mv $@.tmp.owl $@
{% endif -%}

{% if 'non-classified' in project.release_artefacts or project.primary_release == 'non-classified' -%}
# foo-non-classified: (edit->imports-merged)
$(ONT)-non-classified.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(IMPORT_FILES)
$(ROBOT) merge --input $< \
$(ROBOT_RELEASE_IMPORT_MODE) \
$(SHARED_ROBOT_COMMANDS) annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) {% if project.release_date -%}--annotation oboInOwl:date "$(OBODATE)" {% endif -%}--output $@.tmp.owl && mv $@.tmp.owl $@
{% endif -%}

Expand All @@ -842,13 +865,13 @@ $(ONT)-non-classified.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(IMPORT_FILES)
# drop every axiom: filter --term-file keep_terms.txt --trim true
# remove --select imports --trim false
$(ONT)-simple.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(SIMPLESEED) $(IMPORT_FILES)
$(ROBOT) merge --input $< $(patsubst %, -i %, $(OTHER_SRC)) \
reason --reasoner {{ project.reasoner }} --equivalent-classes-allowed {{ project.allow_equivalents }} --exclude-tautologies {{ project.exclude_tautologies }} \
$(ROBOT_RELEASE_IMPORT_MODE) \{% if project.release_use_reasoner %}
reason --reasoner {{ project.reasoner }} --equivalent-classes-allowed {{ project.allow_equivalents }} --exclude-tautologies {{ project.exclude_tautologies }} \{% endif %}
relax \
remove --axioms equivalent \
relax \
filter --term-file $(SIMPLESEED) --select "annotations ontology anonymous self" --trim true --signature true \
reduce -r {{ project.reasoner }} \
filter --term-file $(SIMPLESEED) --select "annotations ontology anonymous self" --trim true --signature true \{% if project.release_use_reasoner %}
reduce -r {{ project.reasoner }} \{% endif %}
query --update ../sparql/inject-subset-declaration.ru --update ../sparql/inject-synonymtype-declaration.ru \
$(SHARED_ROBOT_COMMANDS) annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) {% if project.release_date -%}--annotation oboInOwl:date "$(OBODATE)" {% endif -%}--output $@.tmp.owl && mv $@.tmp.owl $@
{% endif -%}
Expand All @@ -858,10 +881,9 @@ $(ONT)-simple.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(SIMPLESEED) $(IMPORT_FILE
# Should this be the non-classified ontology with the drop foreign axiom filter?
# Consider adding remove --term "http://www.geneontology.org/formats/oboInOwl#hasOBONamespace"
$(ONT)-simple-non-classified.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(SIMPLESEED) $(IMPORT_FILES)
$(ROBOT) remove --input $< --select imports --trim true \
merge $(patsubst %, -i %, $(OTHER_SRC)) \
remove --axioms equivalent \
reduce -r {{ project.reasoner }} \
$(ROBOT_RELEASE_IMPORT_MODE) \
matentzn marked this conversation as resolved.
Show resolved Hide resolved
remove --axioms equivalent \{% if project.release_use_reasoner %}
reduce -r {{ project.reasoner }} \{% endif %}
filter --select ontology --term-file $(SIMPLESEED) --trim false \
$(SHARED_ROBOT_COMMANDS) annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) {% if project.release_date -%}--annotation oboInOwl:date "$(OBODATE)" {% endif -%}--output $@.tmp.owl && mv $@.tmp.owl $@
{% endif -%}
Expand All @@ -871,8 +893,8 @@ $(ONT)-simple-non-classified.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(SIMPLESEED
# See above (David comment) for explanation.
# removes any axioms that contains one of the ops that not in the whitelist file
$(ONT)-basic.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(SIMPLESEED) $(KEEPRELATIONS) $(IMPORT_FILES)
$(ROBOT) merge --input $< $(patsubst %, -i %, $(OTHER_SRC)) \
reason --reasoner {{ project.reasoner }} --equivalent-classes-allowed {{ project.allow_equivalents }} --exclude-tautologies {{ project.exclude_tautologies }} \
$(ROBOT_RELEASE_IMPORT_MODE) \{% if project.release_use_reasoner %}
reason --reasoner {{ project.reasoner }} --equivalent-classes-allowed {{ project.allow_equivalents }} --exclude-tautologies {{ project.exclude_tautologies }} \{% endif %}
relax \
remove --axioms equivalent \
remove --axioms disjoint \
Expand Down
1 change: 1 addition & 0 deletions tests/test-non-import-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ release_artefacts:
- editors
- base
primary_release: base
release_use_reasoner: FALSE
import_group:
release_imports: TRUE
products:
Expand Down