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

OAK Validation workflow #988

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
37 changes: 37 additions & 0 deletions odk/odk.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,40 @@ class ReportConfig(JsonSchemaMixin):
sparql_test_on: List[str] = field(default_factory=lambda: ['edit'])
"""Chose which file to run the custom sparql checks. Supported 'edit', any release artefact."""


@dataclass_json
@dataclass
class OAKProfile(JsonSchemaMixin):
id: str
"""profile identifier."""

filename: Optional[str] = None
"""Filename of the profile. """

description: Optional[str] = None
"""Description of the profile. """

mirror_from: Optional[str] = None
"""URL where the profile is located and will be downloaded"""


@dataclass_json
@dataclass
class OAKValidationConfig(JsonSchemaMixin):
"""
A configuration section that consists of list of `OAKProfile` descriptions
Run reports into "reports/" directory
"""

profiles: Optional[List[OAKProfile]] = None
"""all OAK profiles"""

def _add_stub(self, filename: str):
if self.profiles is None:
self.profiles = []
self.profiles.append(OAKProfile(id=id))


@dataclass_json
@dataclass
class DocumentationGroup(JsonSchemaMixin):
Expand Down Expand Up @@ -683,6 +717,9 @@ class OntologyProject(JsonSchemaMixin):

release_diff : bool = False
"""When enabled, a diff is generated between the current release and the new one"""

oak_validation: Optional[OAKValidationConfig] = None
"""Block that includes profiles to be used to validate the ontology"""

def fill_missing(self):
"""
Expand Down
24 changes: 24 additions & 0 deletions template/src/ontology/Makefile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,30 @@ $(REPORTDIR)/$(SRC)-obo-report.tsv: $(SRCMERGED) | $(REPORTDIR)
$(REPORTDIR)/%-obo-report.tsv: % | $(REPORTDIR)
$(ROBOT) report -i $< $(REPORT_LABEL) $(REPORT_PROFILE_OPTS) --fail-on $(REPORT_FAIL_ON) {% if project.robot_report.use_base_iris %}{% if project.namespaces is not none %}{% for iri in project.namespaces %}--base-iri {{ iri }} {% endfor %}{% else %}--base-iri $(URIBASE)/{{ project.id.upper() }}_ --base-iri $(URIBASE)/{{ project.id }} {% endif %}{% endif -%} --print 5 -o $@

{% if project. oak_validation %}
# ----------------------------------------
# OAK Validation
# ----------------------------------------

$(ONT)-simple.db: $(ONT)-simple.owl
semsql make $@
rm $(ONT)-simple-relation-graph.tsv.gz

{% for profile in project.oak_validation.profiles %}
$(TMPDIR)/{{ profile.id }}.yaml:
{% if profile.mirror_from %}wget {{ profile.mirror_from }} -O $@{% else %}cp {{ profile.filename }} $@
{% endif %}

$(REPORTDIR)/{{ profile.id }}.tsv: $(ONT)-simple.db $(TMPDIR)/{{ profile.id }}.yaml
runoak validate-multiple $< --schema $(TMPDIR)/{{ profile.id }}.yaml --output $@ --cutoff 5000
awk 'NR==1 {print} NR!=1 && $$2~/{{ project.id.upper() }}:/' $@ > [email protected] && mv [email protected] $@
{% endfor%}

.PHONY: oak_validation
oak_validation:
$(MAKE_FAST) {% for profile in project.oak_validation.profiles %} $(REPORTDIR)/{{ profile.id }}.tsv{% endfor %}
{%- endif %}

# ----------------------------------------
# Release assets
# ----------------------------------------
Expand Down
Loading