Skip to content
Open
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
16 changes: 6 additions & 10 deletions src/incatools/odk/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,12 @@ def derive_fields(self, project: OntologyProject) -> None:
self.import_names.append("merged")

for p in self.products:
if p.id == "orcidio" and p.module_type is None:
p.module_type = "orcidio"
if p.module_type == "orcidio":
p.exclude_from_merge = True
if p.mirror_from is None:
p.mirror_from = "https://w3id.org/orcidio/orcidio.owl"
if p.module_type is None:
# Use group-level module type
p.module_type = self.module_type
Expand Down Expand Up @@ -1195,16 +1201,6 @@ class OntologyProject(JsonSchemaMixin):
release_diff: bool = False
"""Generates a diff with the previous release."""

orcidio_support: bool = False
"""Enables the automatic production of an ORCIDIO import module.

If enabled, this option will cause the build pipeline to (1) scan
the ontology for references to ORCID identifiers in all IRI-valued
annotations, and (2) create a orcidio_import.owl import module
containing all ORCIDIO individuals corresponding to the referenced
ORCID identifiers.
"""

robot: RobotOptionsGroup = field(default_factory=lambda: RobotOptionsGroup())
"""ROBOT-related options."""

Expand Down
2 changes: 0 additions & 2 deletions src/incatools/odk/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,6 @@ def update_import_declarations(self) -> None:
cmd += f" --add {base}/patterns/definitions.owl"
if self.project.import_pattern_ontology:
cmd += f" --add {base}/patterns/pattern.owl"
if self.project.orcidio_support:
cmd += f" --add {base}/imports/orcidio_import.owl"

if self.project.edit_format == "owl":
cmd += f" convert -f ofn -o {self.project.id}-edit.owl"
Expand Down
23 changes: 2 additions & 21 deletions src/incatools/odk/templates/_dynamic_files.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ format-version: 1.2
import: {{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/{{ name }}_import.owl
{% endfor -%}
{% endif -%}
{% if project.orcidio_support -%}
import: {{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/orcidio_import.owl
{% endif -%}
{% if project.components is defined -%}
{% for component in project.components.products -%}
import: {{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/components/{{ component.filename }}
Expand Down Expand Up @@ -85,9 +82,6 @@ Ontology(<{{ project.uribase }}/{{ project.id }}.owl>
Import(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/{{ name }}_import.owl>)
{% endfor -%}
{% endif -%}
{% if project.orcidio_support -%}
Import(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/orcidio_import.owl>)
{% endif -%}
{% if project.components is defined -%}
{% for component in project.components.products -%}
Import(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/components/{{ component.filename }}>)
Expand Down Expand Up @@ -230,24 +224,11 @@ Ontology(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ pr

-#}
{% for imp in project.import_group.products -%}
{% if imp.module_type != "orcidio" -%}
^^^ src/ontology/imports/{{ imp.id }}_terms.txt
{% endif -%}
{% endfor -%}
{% endif %}{# ! project.import_group is defined -#}
{% if project.orcidio_support -%}
^^^ src/ontology/imports/orcidio_import.owl
Prefix(:=<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/orcidio_import.owl>)
Prefix(obo:=<http://purl.obolibrary.org/obo/>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)
Prefix(oboInOwl:=<http://www.geneontology.org/formats/oboInOwl#>)

Ontology(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/orcidio_import.owl>
# This is a placeholder, it will be regenerated when makefile is first executed.
)
{% endif -%}
{#

Metadata files.
Expand Down
62 changes: 14 additions & 48 deletions src/incatools/odk/templates/src/ontology/Makefile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,19 @@ $(IMPORTDIR)/{{ ont.id }}_import.owl: $(MIRRORDIR)/{{ ont.id }}.owl $(IMPORTDIR)
--select complement \
--select "classes individuals annotation-properties" \
$(ANNOTATE_CONVERT_FILE)
{% elif "orcidio" == ont.module_type -%}
# By default, an ORCIDIO module is seeded from ORCID references in ALL
# IRI-valued annotations in the ontology, regardless of the annotation
# property. To seed only from annotations using specific properties,
# override the following variable with the desired list of properties.
ORCIDIO_PROPERTIES =

$(IMPORTDIR)/{{ ont.id }}_import.owl: $(SRCMERGED) $(MIRRORDIR)/{{ ont.id }}.owl | all_robot_plugins
$(ROBOT) odk:extract-orcids --input $(SRCMERGED) \
--orcid-file $(MIRRORDIR)/{{ ont.id }}.owl \
$(foreach p, $(ORCIDIO_PROPERTIES), --property $(p)) \
$(ANNOTATE_CONVERT_FILE)

{% elif 'custom' -%}
$(IMPORTDIR)/{{ ont.id }}_import.owl: {% if "no_mirror" != ont.mirror_type %}$(MIRRORDIR)/{{ ont.id }}.owl{% endif %}
@echo "ERROR: You have configured {{ ont.id }} as a custom module;"
Expand All @@ -787,8 +800,7 @@ $(IMPORTDIR)/%_import.obo: $(IMPORTDIR)/%_import.owl
endif # IMP=true

.PHONY: all_imports
all_imports: $(IMPORT_FILES){# -#}
{% if project.orcidio_support %} $(IMPORTDIR)/orcidio_import.owl{% endif %}
all_imports: $(IMPORT_FILES)

.PHONY: refresh-imports
refresh-imports:
Expand Down Expand Up @@ -925,49 +937,6 @@ no-mirror-recreate-%:

{% endif %}{# ! project.components is not none -#}

{% if project.orcidio_support -%}
# ----------------------------------------
# Special components
# ----------------------------------------

# ORCIDIO module
# ----------------------------------------

# By default, the ORCIDIO module is seeded from ORCID references in ALL
# IRI-valued annotations in the ontology, regardless of the annotation
# property. To seed only from annotations using specific properties,
# override the following variable with the desired list of properties.
ORCIDIO_PROPERTIES =

ifeq ($(IMP),true)
$(IMPORTDIR)/orcidio_import.owl: $(SRCMERGED) $(MIRRORDIR)/orcidio.owl | all_robot_plugins
$(ROBOT) odk:extract-orcids --input $(SRCMERGED) \
--orcid-file $(MIRRORDIR)/orcidio.owl \
$(foreach p, $(ORCIDIO_PROPERTIES), --property $(p)) \
$(ANNOTATE_CONVERT_FILE)

endif

ifeq ($(MIR),true)
.PHONY: download-mirror-orcidio
download-mirror-orcidio: | $(TMPDIR) $(MIRRORDIR)
@odk-helper download --output $(TMPDIR)/$@.owl \
--reference $(MIRRORDIR)/orcidio.owl \
{% if project.import_group is defined -%}
--max-retry {{ project.import_group.mirror_retry_download }} \
{% endif -%}
https://w3id.org/orcidio/orcidio.owl

$(MIRRORDIR)/orcidio.owl: download-mirror-orcidio
@if [ -f $(TMPDIR)/download-mirror-orcidio.owl ]; then \
cp $(TMPDIR)/download-mirror-orcidio.owl $@ ; \
fi

endif


{% endif %}{# !project.orcidio_support -#}

{% if project.use_mappings or project.bridge_group is not none -%}
# ----------------------------------------
# Mappings and bridges
Expand Down Expand Up @@ -1889,9 +1858,6 @@ ASSETS = $(MAIN_FILES){# -#}
{% if project.import_group is not none %} \
$(IMPORT_FILES){# -#}
{% endif -%}
{% if project.orcidio_support %} \
$(IMPORTDIR)/orcidio_import.owl{# -#}
{% endif -%}
{% if project.use_dosdps %} \
$(PATTERN_RELEASE_FILES){# -#}
{% endif -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
<uri name="{{project.uribase}}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/{{name}}_import.owl" uri="imports/{{name}}_import.owl"/>
{%- endfor %}
{%- endif %}
{%- if project.orcidio_support %}
<uri name="{{project.uribase}}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/orcidio_import.owl" uri="imports/orcidio_import.owl"/>
{%- endif %}
{%- if project.components is defined %}
{%- for component in project.components.products %}
<uri name="{{project.uribase}}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/components/{{component.filename}}" uri="components/{{component.filename}}"/>
Expand Down
12 changes: 12 additions & 0 deletions tests/configs/test-module-orcidio-with-base-merging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
id: modorcid
title: Test ORCIDIO import module type
github_org: INCATools
report_fail_on: ERROR
repo: modorcid
import_group:
use_base_merging: true
products:
- id: ro
- id: bfo
- id: pato
- id: orcidio
11 changes: 11 additions & 0 deletions tests/configs/test-module-orcidio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
id: modorcid
title: Test ORCIDIO import module type
github_org: INCATools
report_fail_on: ERROR
repo: modorcid
import_group:
products:
- id: ro
- id: bfo
- id: pato
- id: orcidio