Skip to content

Commit f0cf2bf

Browse files
committed
Put the current ROBOT profile in the templates directory.
For now, when building the image, we download the ROBOT report profile for the current version of ROBOT (the version used in the ODK) and put it in /tools/robot_report_profile.txt. We do that so that we can check, as part of the standard workflow, whether the custom profile that the project may be using is not lacking any new tests that are available in the current version of ROBOT (see #998). Here, we simply move the location of the profile file within the image, from /tools/robot_report_profile.txt to /tools/templates/src/ontology/profile.txt This does not change how the check mentioned above works (we just update the path involved in that check), but this will have the benefit of automatically installing the ROBOT profile when seeding a repository, since the file is now within the template directory used by the seeding system. Therefore, we can remove the 'src/ontology/profile.txt' block from the dynamic template pack (which needed to be manually updated by us whenever we updated ROBOT -- something I don't think we have really been doing). But we do not want to _always_ install this profile.txt file in a seeded repository -- we only need to do that when the use of a custom profile is enabled in the configuration (that was the reason why the profile was part of the dynamic template pack). To avoid installing the file when a custom profile is _not_ enabled, we use the recently introduced per-template policies system: we set the policy for the 'src/ontology/profile.txt' template to NEVER if a custom profile is not enabled. closes #999
1 parent 6931c3f commit f0cf2bf

File tree

4 files changed

+9
-38
lines changed

4 files changed

+9
-38
lines changed

docker/odklite/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ RUN wget -nv $ROBOT_JAR \
4646
wget -nv https://raw.githubusercontent.com/ontodev/robot/v$ROBOT_VERSION/bin/robot \
4747
-O /tools/robot && \
4848
chmod 755 /tools/robot &&\
49+
mkdir -p /tools/templates/src/ontology &&\
4950
wget -nv https://raw.githubusercontent.com/ontodev/robot/v$ROBOT_VERSION/robot-core/src/main/resources/report_profile.txt \
50-
-O /tools/robot_report_profile.txt
51+
-O /tools/templates/src/ontology/profile.txt
5152

5253
# Install DOSDPTOOLS.
5354
RUN wget -nv https://github.com/INCATools/dosdp-tools/releases/download/v$DOSDP_VERSION/dosdp-tools-$DOSDP_VERSION.tgz && \

odk/odk.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,8 @@ def update(templatedir):
11471147
policies.append(('.github/workflows/' + workflow + '.yml', ALWAYS))
11481148
if project.documentation is not None and 'docs' in project.workflows:
11491149
policies.append(('.github/workflows/docs.yml', ALWAYS))
1150+
if not project.robot_report.get('custom_profile', False):
1151+
policies.append(('src/ontology/profile.txt', NEVER))
11501152

11511153
# Proceed with template instantiation, using the policies
11521154
# declared above. We instantiate directly at the root of
@@ -1223,7 +1225,10 @@ def seed(config, clean, outdir, templatedir, dependencies, title, user, source,
12231225
if not os.path.exists(templatedir) and templatedir == "/tools/templates/":
12241226
logging.info("No templates folder in /tools/; assume not in docker context")
12251227
templatedir = "./template"
1226-
tgts += install_template_files(mg, templatedir, outdir)
1228+
policies = []
1229+
if not project.robot_report.get('custom_profile', False):
1230+
policies.append(('src/ontology/profile.txt', NEVER))
1231+
tgts += install_template_files(mg, templatedir, outdir, policies)
12271232

12281233
tgt_project_file = "{}/project.yaml".format(outdir)
12291234
if project.export_project_yaml:

template/_dynamic_files.jinja2

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -692,41 +692,6 @@ SELECT ?term ?predicate WHERE {
692692
</rdf:RDF>
693693
{%- endfor %}
694694
{%- endif %}
695-
{%- if project.robot_report.custom_profile %}
696-
^^^ src/ontology/profile.txt
697-
WARN annotation_whitespace
698-
ERROR deprecated_boolean_datatype
699-
ERROR deprecated_class_reference
700-
ERROR deprecated_property_reference
701-
ERROR duplicate_definition
702-
WARN duplicate_exact_synonym
703-
WARN duplicate_label_synonym
704-
ERROR duplicate_label
705-
WARN duplicate_scoped_synonym
706-
WARN equivalent_pair
707-
WARN equivalent_class_axiom_no_genus
708-
ERROR illegal_use_of_built_in_vocabulary
709-
WARN invalid_xref
710-
ERROR label_formatting
711-
ERROR label_whitespace
712-
INFO lowercase_definition
713-
WARN missing_definition
714-
ERROR missing_label
715-
WARN missing_obsolete_label
716-
ERROR missing_ontology_description
717-
ERROR missing_ontology_license
718-
ERROR missing_ontology_title
719-
WARN missing_subset_declaration
720-
INFO missing_superclass
721-
WARN missing_synonymtype_declaration
722-
ERROR misused_obsolete_label
723-
ERROR misused_replaced_by
724-
ERROR multiple_definitions
725-
ERROR multiple_equivalent_classes
726-
ERROR multiple_equivalent_class_definitions
727-
ERROR multiple_labels
728-
WARN invalid_entity_uri
729-
{%- endif %}
730695
{%- if 'basic' in project.release_artefacts or project.primary_release == 'basic' %}
731696
^^^ src/ontology/keeprelations.txt
732697
BFO:0000050

template/src/ontology/Makefile.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ $(REPORTDIR)/%-align-report.tsv: % | $(REPORTDIR) all_robot_plugins
364364

365365
check_for_robot_updates:
366366
{%- if project.robot_report.custom_profile %}
367-
@cut -f2 "/tools/robot_report_profile.txt" | sort > $(TMPDIR)/sorted_tsv2.txt
367+
@cut -f2 "/tools/templates/src/ontology/profile.txt" | sort > $(TMPDIR)/sorted_tsv2.txt
368368
@cut -f2 "$(ROBOT_PROFILE)" | sort > $(TMPDIR)/sorted_tsv1.txt
369369
@comm -23 $(TMPDIR)/sorted_tsv2.txt $(TMPDIR)/sorted_tsv1.txt > $(TMPDIR)/missing.txt
370370
@echo "Missing tests:"

0 commit comments

Comments
 (0)