Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to include defined-by annotation in imports #929

Merged
merged 4 commits into from
Nov 6, 2023
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
6 changes: 6 additions & 0 deletions odk/odk.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ class ImportGroup(ProductGroup):

directory : Directory = "imports/"
"""directory where imports are extracted into to"""

annotate_defined_by : bool = False
"""If set to true, the annotation rdfs:definedBy is added for each external class.
In the case of use_base_merging is also true, this will be added to the imports/merged_import.owl file.
When imports are not merged, the annotation is added during the release process to the full release artefact.
"""

def _add_stub(self, id : OntologyHandle):
if self.products is None:
Expand Down
4 changes: 2 additions & 2 deletions template/src/ontology/Makefile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ ALL_MIRRORS = $(patsubst %, $(MIRRORDIR)/%.owl, $(IMPORTS))
MERGE_MIRRORS = true

$(MIRRORDIR)/merged.owl: $(ALL_MIRRORS)
if [ $(IMP) = true ] && [ $(MERGE_MIRRORS) = true ]; then $(ROBOT) merge $(patsubst %, -i %, $^) {% if project.import_group.base_merge_drop_equivalent_class_axioms %}remove --axioms equivalent --preserve-structure false {% endif %}-o $@; fi
if [ $(IMP) = true ] && [ $(MERGE_MIRRORS) = true ]; then $(ROBOT) merge $(patsubst %, -i %, $^) {% if project.import_group.annotate_defined_by %}--annotate-defined-by true{% endif %} {% if project.import_group.base_merge_drop_equivalent_class_axioms %}remove --axioms equivalent --preserve-structure false {% endif %}-o $@; fi
.PRECIOUS: $(MIRRORDIR)/merged.owl
{% endif %}

Expand Down Expand Up @@ -915,7 +915,7 @@ $(ONT).owl: $(ONT)-{{ project.primary_release }}.owl
{% endif -%}

# ROBOT pipeline that merges imports, including components.
ROBOT_RELEASE_IMPORT_MODE={% if project.use_edit_file_imports -%}$(ROBOT) merge --input $< {% else -%}
ROBOT_RELEASE_IMPORT_MODE={% if project.use_edit_file_imports -%}$(ROBOT) merge --input $< {% if project.import_group is defined and project.import_group.use_base_merging is false and project.import_group.annotate_defined_by %}--annotate-defined-by true{% endif -%}{% else -%}
anitacaron marked this conversation as resolved.
Show resolved Hide resolved
$(ROBOT) remove --input $< --select imports --trim false {% if project.use_dosdps or project.components is defined -%}
merge $(patsubst %, -i %, $(OTHER_SRC)) {% endif %}{% if project.import_group is defined -%}
merge $(patsubst %, -i %, $(IMPORT_FILES)){% endif %}{% endif %}
Expand Down