Skip to content

Commit 414d458

Browse files
committed
Add a local ORCIDIO mirror.
If `orcidio_support` is enabled, then instead of reading ORCIDIO from its online location whenever we build the `orcidio_import` module, we download the ontology separately and store it alongside the other mirrored ontologies in `$(MIRRORDIR)`. This allows (1) refreshing the import under MIR=false (to take into account new ORCID references in the -edit file, but without refreshing the ORCID mirror), and (2) avoiding rebuilding the import module just because the ORCIDIO mirror has been refreshed, if there has been no changes to the actual contents of ORCIDIO.
1 parent dde50b4 commit 414d458

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

src/incatools/odk/templates/src/ontology/Makefile.jinja2

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ IMPORTS = {% for imp in project.import_group.products %} {{ imp.id }}{% endfor %
249249
{% else %}
250250
IMPORTS =
251251
{% endif %}
252-
IMPORT_ROOTS = {% if project.import_group.use_base_merging %} $(IMPORTDIR)/merged_import{% else %}$(patsubst %, $(IMPORTDIR)/%_import, $(IMPORTS)){% endif %}{% if project.orcidio_support %} $(IMPORTDIR)//orcidio_import{% endif %}
252+
IMPORT_ROOTS = {% if project.import_group.use_base_merging %} $(IMPORTDIR)/merged_import{% else %}$(patsubst %, $(IMPORTDIR)/%_import, $(IMPORTS)){% endif %}{% if project.orcidio_support %} $(IMPORTDIR)/orcidio_import{% endif %}
253253
IMPORT_OWL_FILES = $(foreach n,$(IMPORT_ROOTS), $(n).owl)
254254
{%- if project.import_group.export_obo %}
255255
IMPORT_OBO_FILES = $(foreach n,$(IMPORT_ROOTS), $(n).obo)
@@ -792,12 +792,28 @@ no-mirror-refresh-%:
792792
# ----------------------------------------
793793

794794
ifeq ($(IMP),true)
795-
$(IMPORTDIR)/orcidio_import.owl: $(SRCMERGED) | all_robot_plugins
796-
$(ROBOT) odk:extract-orcids -i $(SRCMERGED) \
795+
$(IMPORTDIR)/orcidio_import.owl: $(SRCMERGED) $(MIRRORDIR)/orcidio.owl | all_robot_plugins
796+
$(ROBOT) odk:extract-orcids --input $(SRCMERGED) \
797+
--orcid-file $(MIRRORDIR)/orcidio.owl \
797798
$(ANNOTATE_CONVERT_FILE)
798799

799800
endif
800801

802+
ifeq ($(MIR),true)
803+
.PHONY: download-mirror-orcidio
804+
download-mirror-orcidio: | $(TMPDIR) $(MIRRORDIR)
805+
@odk-helper download --output $(TMPDIR)/$@.owl \
806+
--reference $(MIRRORDIR)/orcidio.owl{% if project.import_group is defined %} \
807+
--max-retry {{ project.import_group.mirror_retry_download }}{% endif %} \
808+
https://w3id.org/orcidio/orcidio.owl
809+
810+
$(MIRRORDIR)/orcidio.owl: download-mirror-orcidio
811+
@if [ -f $(TMPDIR)/download-mirror-orcidio.owl ]; then \
812+
cp $(TMPDIR)/download-mirror-orcidio.owl $@ ; \
813+
fi
814+
815+
endif
816+
801817
{% endif -%}
802818

803819
{% if project.components is not none -%}

0 commit comments

Comments
 (0)