Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 11 additions & 1 deletion src/incatools/odk/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def update_config_dict(obj: Dict[str, Any]) -> None:
# First take care of stubs, if needed
update_stubs(obj)

# Then all the other changes
# Then all the other simple changes
changes = [
# old key path new key path
("reasoner", "robot.reasoner"),
Expand All @@ -213,6 +213,16 @@ def update_config_dict(obj: Dict[str, Any]) -> None:
else:
logging.warning(f"Option {old} is deprecated")

# Then the more complex changes, that cannot be handled simply by
# renaming or moving keys around.

# `use_base: True` ==> `use_variant: base`
if "import_group" in obj:
for imp in obj["import_group"]["products"]:
use_base = imp.pop("use_base", False)
if use_base:
imp["use_variant"] = "base"
Comment thread
matentzn marked this conversation as resolved.


def pop_key(obj: Dict[str, Any], path: str) -> Optional[str]:
"""Gets the value of a key in a nested dictionary structure.
Expand Down
4 changes: 2 additions & 2 deletions src/incatools/odk/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ class ImportProduct(Product):
for the list of allowed values and their meaning.
"""

use_base: bool = False
"""If true, download the -base version of the upstream source.
use_variant: Optional[str] = None
Comment thread
gouttegd marked this conversation as resolved.
"""If set, use the specified variant of the ontology.

Only meaningful if ``mirror_from`` is not set, that is if the
upstream source is downloaded from http://purl.obolibrary.org/obo/.
Expand Down
2 changes: 1 addition & 1 deletion src/incatools/odk/templates/src/ontology/Makefile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ download-mirror-{{ ont.id }}: | $(TMPDIR)
odk-helper download --output $(TMPDIR)/$@.owl \
--reference $(MIRRORDIR)/{{ ont.id }}.owl \
--max-retry {{ project.import_group.mirror_retry_download }} \
{% if ont.mirror_from %}{{ ont.mirror_from }}{% elif ont.use_base %}$(OBOBASE)/{{ ont.id }}/{{ ont.id }}-base.owl{% if ont.use_gzipped %}.gz{% endif %}{% else %}$(OBOBASE)/{{ ont.id }}.owl{% if ont.use_gzipped %}.gz{% endif %}{% endif %}
{% if ont.mirror_from %}{{ ont.mirror_from }}{% elif ont.use_variant is not none %}$(OBOBASE)/{{ ont.id }}/{{ ont.id }}-{{ ont.use_variant }}.owl{% if ont.use_gzipped %}.gz{% endif %}{% else %}$(OBOBASE)/{{ ont.id }}.owl{% if ont.use_gzipped %}.gz{% endif %}{% endif %}

{% if ont.mirror_type == 'custom' -%}
$(MIRRORDIR)/{{ ont.id }}.owl:
Expand Down
20 changes: 20 additions & 0 deletions tests/configs/test-use-variant.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
id: tvariant
title: "Test Variant"
github_org: INCATools
repo: ontology-development-kit
import_group:
use_base_merging: true
exclude_iri_patterns:
- <http://purl.obolibrary.org/obo/GOCHE_*>
- <http://purl.obolibrary.org/obo/OBA_*>
slme_individuals: exclude
mirror_max_time_download: 400
products:
- id: ro
mirror_from: https://raw.githubusercontent.com/INCATools/ontology-development-kit/master/tests/ontologies/ro.owl
- id: pato
use_variant: base
# This test cannot be easily replaced, because use_variant and custom URL dont mix
- id: pr
make_base: true
mirror_from: https://raw.githubusercontent.com/INCATools/ontology-development-kit/master/tests/ontologies/pr_slim.owl
Loading