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
10 changes: 10 additions & 0 deletions src/incatools/odk/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,16 @@ 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: 1 addition & 1 deletion src/incatools/odk/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
SSSOM_SOURCE = "https://github.com/gouttegd/sssom-java/releases/download/sssom-java-1.11.2/sssom-cli-1.11.2.jar"
DOSDP_SOURCE = "https://github.com/INCATools/dosdp-tools/releases/download/v0.20.0/dosdp-tools-0.20.0.tgz"
RELGR_SOURCE = "https://github.com/INCATools/relation-graph/releases/download/v2.3.4/relation-graph-cli-2.3.4.tgz"
ODK_PLUGIN_SOURCE = "https://github.com/INCATools/odk-robot-plugin/releases/download/odk-robot-plugin-0.3.1/odk.jar"
ODK_PLUGIN_SOURCE = "https://github.com/INCATools/odk-robot-plugin/releases/download/odk-robot-plugin-0.3.3/odk.jar"
SSSOM_PLUGIN_SOURCE = "https://github.com/gouttegd/sssom-java/releases/download/sssom-java-1.11.2/sssom-robot-plugin-1.11.2.jar"
OBO_EPM_SOURCE = "https://raw.githubusercontent.com/biopragmatics/bioregistry/main/exports/contexts/obo.epm.json"

Expand Down
2 changes: 2 additions & 0 deletions src/incatools/odk/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ 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: 22 additions & 1 deletion src/incatools/odk/templates/_dynamic_files.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ import: {{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ proj
{% endfor -%}
{% endif -%}
{% 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 @@ -89,7 +92,10 @@ Import(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ proj
Import(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ project.uribase_suffix }}{% else %}{{ project.id }}{% endif %}/imports/{{ imp.id }}_import.owl>)
{% endfor -%}
{% endif -%}
{% endif %}
{% 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 @@ -256,6 +262,21 @@ Ontology(<{{ project.uribase }}/{% if project.uribase_suffix is not none %}{{ pr
^^^ src/ontology/imports/{{ imp.id }}_terms.txt
{% 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
39 changes: 38 additions & 1 deletion src/incatools/odk/templates/src/ontology/Makefile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ IMPORTS = {% for imp in project.import_group.products %} {{ imp.id }}{% endfor %
{% else %}
IMPORTS =
{% endif %}
IMPORT_ROOTS = {% if project.import_group.use_base_merging %} $(IMPORTDIR)/merged_import{% else %}$(patsubst %, $(IMPORTDIR)/%_import, $(IMPORTS)){% endif %}
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 %}
IMPORT_OWL_FILES = $(foreach n,$(IMPORT_ROOTS), $(n).owl)
{%- if project.import_group.export_obo %}
IMPORT_OBO_FILES = $(foreach n,$(IMPORT_ROOTS), $(n).obo)
Expand Down Expand Up @@ -786,6 +786,43 @@ no-mirror-refresh-%:

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

{% if project.orcidio_support -%}
# ----------------------------------------
# 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 %} \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did NOT look at the defaults for project.import_group, but is it in theory possible to request "orcidio_support" and not have any other imports configured?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The orcidio_support setting is a top-level setting, which may very well be set while no imports are configured. Hence the check on project.import_group here.

--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 -%}

{% if project.components is not none -%}
# ----------------------------------------
# Components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
{%- endfor %}
{%- endif %}
{%- 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
Loading