Skip to content

Commit dde50b4

Browse files
committed
Add basic support for ORCIDIO.
Add a new project-level configuration option: `orcidio_support`. When enabled, it creates a custom import module for ORCIDIO. The module is generated by (1) extracting all ORCID references in dcterms:contributor annotations within the source ontology and (2) extracting all individuals corresponding to the referenced ORCIDs from the ORCIDIO ontology.
1 parent ac5c30a commit dde50b4

6 files changed

Lines changed: 46 additions & 3 deletions

File tree

src/incatools/odk/model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,9 @@ class OntologyProject(JsonSchemaMixin):
11431143
release_diff: bool = False
11441144
"""Generates a diff with the previous release."""
11451145

1146+
orcidio_support: bool = False
1147+
"""Extracts ORCIDIO individuals representing the contributors to the ontology."""
1148+
11461149
robot: RobotOptionsGroup = field(default_factory=lambda: RobotOptionsGroup())
11471150
"""ROBOT-related options."""
11481151

src/incatools/odk/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
SSSOM_SOURCE = "https://github.com/gouttegd/sssom-java/releases/download/sssom-java-1.11.2/sssom-cli-1.11.2.jar"
2525
DOSDP_SOURCE = "https://github.com/INCATools/dosdp-tools/releases/download/v0.20.0/dosdp-tools-0.20.0.tgz"
2626
RELGR_SOURCE = "https://github.com/INCATools/relation-graph/releases/download/v2.3.4/relation-graph-cli-2.3.4.tgz"
27-
ODK_PLUGIN_SOURCE = "https://github.com/INCATools/odk-robot-plugin/releases/download/odk-robot-plugin-0.3.1/odk.jar"
27+
ODK_PLUGIN_SOURCE = "https://github.com/INCATools/odk-robot-plugin/releases/download/odk-robot-plugin-0.3.2/odk.jar"
2828
SSSOM_PLUGIN_SOURCE = "https://github.com/gouttegd/sssom-java/releases/download/sssom-java-1.11.2/sssom-robot-plugin-1.11.2.jar"
2929
OBO_EPM_SOURCE = "https://raw.githubusercontent.com/biopragmatics/bioregistry/main/exports/contexts/obo.epm.json"
3030

src/incatools/odk/template.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,8 @@ def update_import_declarations(self) -> None:
394394
cmd += f" --add {base}/patterns/definitions.owl"
395395
if self.project.import_pattern_ontology:
396396
cmd += f" --add {base}/patterns/pattern.owl"
397+
if self.project.orcidio_support:
398+
cmd += f" --add {base}/imports/orcidio_import.owl"
397399

398400
if self.project.edit_format == "owl":
399401
cmd += f" convert -f ofn -o {self.project.id}-edit.owl"

src/incatools/odk/templates/_dynamic_files.jinja2

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ import: {{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ proj
3232
{% endfor -%}
3333
{% endif -%}
3434
{% endif -%}
35+
{% if project.orcidio_support -%}
36+
import: {{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/orcidio_import.owl
37+
{% endif -%}
3538
{% if project.components is defined -%}
3639
{% for component in project.components.products -%}
3740
import: {{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/components/{{ component.filename }}
@@ -89,7 +92,10 @@ Import(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ proj
8992
Import(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/{{ imp.id }}_import.owl>)
9093
{% endfor -%}
9194
{% endif -%}
92-
{% endif %}
95+
{% endif -%}
96+
{% if project.orcidio_support -%}
97+
Import(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/orcidio_import.owl>)
98+
{% endif -%}
9399
{% if project.components is defined -%}
94100
{% for component in project.components.products -%}
95101
Import(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/components/{{ component.filename }}>)
@@ -256,6 +262,21 @@ Ontology(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ pr
256262
^^^ src/ontology/imports/{{ imp.id }}_terms.txt
257263
{% endfor -%}
258264
{% endif %}{# ! project.import_group is defined -#}
265+
{% if project.orcidio_support -%}
266+
^^^ src/ontology/imports/orcidio_import.owl
267+
Prefix(:=<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/orcidio_import.owl>)
268+
Prefix(obo:=<http://purl.obolibrary.org/obo/>)
269+
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
270+
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
271+
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
272+
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
273+
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)
274+
Prefix(oboInOwl:=<http://www.geneontology.org/formats/oboInOwl#>)
275+
276+
Ontology(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/orcidio_import.owl>
277+
# This is a placeholder, it will be regenerated when makefile is first executed.
278+
)
279+
{% endif -%}
259280
{#
260281
261282
Metadata files.

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

Lines changed: 15 additions & 1 deletion
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 %}
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)
@@ -786,6 +786,20 @@ no-mirror-refresh-%:
786786

787787
{% endif %}{# !project.import_group is defined -#}
788788

789+
{% if project.orcidio_support -%}
790+
# ----------------------------------------
791+
# ORCIDIO module
792+
# ----------------------------------------
793+
794+
ifeq ($(IMP),true)
795+
$(IMPORTDIR)/orcidio_import.owl: $(SRCMERGED) | all_robot_plugins
796+
$(ROBOT) odk:extract-orcids -i $(SRCMERGED) \
797+
$(ANNOTATE_CONVERT_FILE)
798+
799+
endif
800+
801+
{% endif -%}
802+
789803
{% if project.components is not none -%}
790804
# ----------------------------------------
791805
# Components

src/incatools/odk/templates/src/ontology/catalog-v001.xml.jinja2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
{%- endfor %}
1212
{%- endif %}
1313
{%- endif %}
14+
{%- if project.orcidio_support %}
15+
<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"/>
16+
{%- endif %}
1417
{%- if project.components is defined %}
1518
{%- for component in project.components.products %}
1619
<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}}"/>

0 commit comments

Comments
 (0)