Skip to content

Commit

Permalink
Merge pull request #13 from JCGiron/master
Browse files Browse the repository at this point in the history
New terms and new release
  • Loading branch information
JCGiron authored Mar 30, 2023
2 parents eea6a53 + 1fd8200 commit f1afbef
Show file tree
Hide file tree
Showing 36 changed files with 94,278 additions and 168,694 deletions.
Binary file modified .DS_Store
Binary file not shown.
290 changes: 281 additions & 9 deletions colao-base.obo

Large diffs are not rendered by default.

8,314 changes: 3,995 additions & 4,319 deletions colao-base.owl

Large diffs are not rendered by default.

296 changes: 284 additions & 12 deletions colao-full.obo

Large diffs are not rendered by default.

45,626 changes: 16,328 additions & 29,298 deletions colao-full.owl

Large diffs are not rendered by default.

296 changes: 284 additions & 12 deletions colao.obo

Large diffs are not rendered by default.

45,562 changes: 16,329 additions & 29,233 deletions colao.owl

Large diffs are not rendered by default.

Binary file modified src/.DS_Store
Binary file not shown.
128 changes: 94 additions & 34 deletions src/ontology/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ----------------------------------------
# Makefile for colao
# Generated using ontology-development-kit
# ODK Version: v1.3.1
# ODK Version: v1.4
# ----------------------------------------
# IMPORTANT: DO NOT EDIT THIS FILE. To override default make goals, use colao.Makefile instead

Expand All @@ -15,11 +15,13 @@
# ----------------------------------------
# these can be overwritten on the command line

OBOBASE= http://purl.obolibrary.org/obo
URIBASE= http://purl.obolibrary.org/obo
ONT= colao
ONTBASE= $(URIBASE)/$(ONT)
ONTBASE= http://purl.obolibrary.org/obo/colao
EDIT_FORMAT= owl
SRC = $(ONT)-edit.$(EDIT_FORMAT)
MAKE_FAST= $(MAKE) IMP=false PAT=false COMP=false MIR=false
CATALOG= catalog-v001.xml
ROBOT= robot --catalog $(CATALOG)

Expand All @@ -32,26 +34,29 @@ MIRRORDIR= mirror
IMPORTDIR= imports
SUBSETDIR= subsets
SCRIPTSDIR= ../scripts
UPDATEREPODIR= target
SPARQLDIR = ../sparql
COMPONENTSDIR = components
REPORT_FAIL_ON = None
REPORT_LABEL = -l true
REPORT_PROFILE_OPTS =
OBO_FORMAT_OPTIONS =
SPARQL_VALIDATION_CHECKS = owldef-self-reference iri-range label-with-iri
SPARQL_VALIDATION_CHECKS = owldef-self-reference iri-range label-with-iri multiple-replaced_by
SPARQL_EXPORTS = basic-report class-count-by-prefix edges xrefs obsoletes synonyms
ODK_VERSION_MAKEFILE = v1.3.1
ODK_VERSION_MAKEFILE = v1.4

TODAY ?= $(shell date +%Y-%m-%d)
OBODATE ?= $(shell date +'%d:%m:%Y %H:%M')
VERSION= $(TODAY)
ANNOTATE_ONTOLOGY_VERSION = annotate -V $(ONTBASE)/releases/$(VERSION)/$@ --annotation owl:versionInfo $(VERSION)
ANNOTATE_CONVERT_FILE = annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) convert -f ofn --output $@.tmp.owl && mv $@.tmp.owl $@
OTHER_SRC =
ONTOLOGYTERMS = $(TMPDIR)/ontologyterms.txt
EDIT_PREPROCESSED = $(TMPDIR)/$(ONT)-preprocess.owl

FORMATS = $(sort owl obo owl)
FORMATS_INCL_TSV = $(sort $(FORMATS) tsv)
RELEASE_ARTEFACTS = $(sort $(ONT)-full $(ONT)-base $(ONT)-base $(ONT)-full)
RELEASE_ARTEFACTS = $(sort $(ONT)-full $(ONT)-base )

# ----------------------------------------
# Top-level targets
Expand All @@ -66,10 +71,16 @@ all: all_odk
all_odk: odkversion test all_assets

.PHONY: test
test: odkversion sparql_test robot_reports $(REPORTDIR)/validate_profile_owl2dl_$(ONT).owl.txt
$(ROBOT) reason --input $(SRC) --reasoner ELK --equivalent-classes-allowed asserted-only \
--exclude-tautologies structural --output test.owl && rm test.owl &&\
echo "Success"
test: odkversion reason_test sparql_test robot_reports $(REPORTDIR)/validate_profile_owl2dl_$(ONT).owl.txt
echo "Finished running all tests successfully."

.PHONY: release_diff
release_diff: $(REPORTDIR)/release-diff.md

.PHONY: reason_test
reason_test: $(EDIT_PREPROCESSED)
$(ROBOT) reason --input $< --reasoner ELK --equivalent-classes-allowed asserted-only \
--exclude-tautologies structural --output test.owl && rm test.owl

.PHONY: odkversion
odkversion:
Expand Down Expand Up @@ -120,6 +131,19 @@ SUBSET_FILES = $(foreach n,$(SUBSET_ROOTS), $(foreach f,$(FORMATS_INCL_TSV), $(n
.PHONY: all_subsets
all_subsets: $(SUBSET_FILES)

# ----------------------------------------
# Mapping assets
# ----------------------------------------


MAPPINGS =

MAPPING_FILES = $(patsubst %, $(MAPPINGDIR)/%.sssom.tsv, $(MAPPINGS))

.PHONY: all_mappings
all_mappings: $(MAPPING_FILES)


# ----------------------------------------
# QC Reports & Utilities
# ----------------------------------------
Expand All @@ -138,7 +162,7 @@ all_reports: custom_reports robot_reports
# ROBOT OWL Profile checking
# ----------------------------------------

# The conversion to functional syntax is necessary to avoid undeclared entity violations.
# The merge step is necessary to avoid undeclared entity violations.
$(REPORTDIR)/validate_profile_owl2dl_%.txt: % | $(REPORTDIR) $(TMPDIR)
$(ROBOT) merge -i $< convert -f ofn -o $(TMPDIR)/validate.ofn
$(ROBOT) validate-profile --profile DL -i $(TMPDIR)/validate.ofn -o $@ || { cat $@ && exit 1; }
Expand All @@ -156,9 +180,10 @@ validate_profile_%: $(REPORTDIR)/validate_profile_owl2dl_%.txt

SPARQL_VALIDATION_QUERIES = $(foreach V,$(SPARQL_VALIDATION_CHECKS),$(SPARQLDIR)/$(V)-violation.sparql)

sparql_test: $(SRC) catalog-v001.xml | $(REPORTDIR)
sparql_test: $(EDIT_PREPROCESSED) catalog-v001.xml | $(REPORTDIR)
ifneq ($(SPARQL_VALIDATION_QUERIES),)
$(ROBOT) verify --catalog catalog-v001.xml -i $< --queries $(SPARQL_VALIDATION_QUERIES) -O $(REPORTDIR)

$(ROBOT) verify --catalog catalog-v001.xml -i $(EDIT_PREPROCESSED) --queries $(SPARQL_VALIDATION_QUERIES) -O $(REPORTDIR)
endif

# ----------------------------------------
Expand All @@ -179,25 +204,32 @@ ASSETS = \
$(IMPORT_FILES) \
$(MAIN_FILES) \
$(REPORT_FILES) \
$(SUBSET_FILES)
$(SUBSET_FILES) \
$(MAPPING_FILES)

RELEASE_ASSETS = \
$(MAIN_FILES) \
$(SUBSET_FILES)

.PHONY: all_assets
all_assets: $(ASSETS)
all_assets: $(ASSETS)

.PHONY: show_assets
show_assets:
echo $(ASSETS)
du -sh $(ASSETS)

check_rdfxml_%: %
@check-rdfxml $<

.PHONY: check_rdfxml_assets
check_rdfxml_assets: $(foreach product,$(MAIN_PRODUCTS),check_rdfxml_$(product).owl)

# ----------------------------------------
# Release Management
# ----------------------------------------

CLEANFILES=$(MAIN_FILES) $(SRCMERGED)
CLEANFILES=$(MAIN_FILES) $(SRCMERGED) $(EDIT_PREPROCESSED)
# This should be executed by the release manager whenever time comes to make a release.
# It will ensure that all assets/files are fresh, and will copy to release folder

Expand All @@ -218,6 +250,14 @@ prepare_initial_release: all_assets
prepare_release_fast:
$(MAKE) prepare_release IMP=false PAT=false MIR=false COMP=false

CURRENT_RELEASE=$(ONTBASE).owl

$(TMPDIR)/current-release.owl:
wget $(CURRENT_RELEASE) -O $@

$(REPORTDIR)/release-diff.md: $(ONT).owl $(TMPDIR)/current-release.owl
$(ROBOT) diff --labels true --left $(TMPDIR)/current-release.owl --right $(ONT).owl -f markdown -o $@

# ------------------------
# Imports: Seeding system
# ------------------------
Expand All @@ -226,10 +266,13 @@ prepare_release_fast:
IMPORTSEED=$(TMPDIR)/seed.txt
PRESEED=$(TMPDIR)/pre_seed.txt

$(SRCMERGED): $(SRC) $(OTHER_SRC)
$(SRCMERGED): $(EDIT_PREPROCESSED) $(OTHER_SRC)
$(ROBOT) remove --input $< --select imports --trim false \
merge $(patsubst %, -i %, $(OTHER_SRC)) -o $@

$(EDIT_PREPROCESSED): $(SRC)
$(ROBOT) convert --input $< --format ofn --output $@

$(PRESEED): $(SRCMERGED)
$(ROBOT) query -f csv -i $< --query ../sparql/terms.sparql $@.tmp &&\
cat $@.tmp | sort | uniq > $@
Expand Down Expand Up @@ -262,7 +305,7 @@ $(IMPORTDIR)/%_import.owl: $(MIRRORDIR)/%.owl $(IMPORTDIR)/%_terms_combined.txt
if [ $(IMP) = true ]; then $(ROBOT) query -i $< --update ../sparql/preprocess-module.ru \
extract -T $(IMPORTDIR)/$*_terms_combined.txt --force true --copy-ontology-annotations true --individuals include --method BOT \
query --update ../sparql/inject-subset-declaration.ru --update ../sparql/inject-synonymtype-declaration.ru --update ../sparql/postprocess-module.ru \
annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@.tmp.owl && mv $@.tmp.owl $@; fi
$(ANNOTATE_CONVERT_FILE); fi

.PRECIOUS: $(IMPORTDIR)/%_import.owl

Expand Down Expand Up @@ -337,7 +380,7 @@ SPARQL_EXPORTS_ARGS = $(foreach V,$(SPARQL_EXPORTS),-s $(SPARQLDIR)/$(V).sparql
# This combines all into one single command

.PHONY: custom_reports
custom_reports: $(SRC) | $(REPORTDIR)
custom_reports: $(EDIT_PREPROCESSED) | $(REPORTDIR)
ifneq ($(SPARQL_EXPORTS_ARGS),)
$(ROBOT) query -f tsv --use-graphs true -i $< $(SPARQL_EXPORTS_ARGS)
endif
Expand Down Expand Up @@ -366,34 +409,46 @@ $(ONT).obo: $(ONT).owl
# -----------------------------------------------------
SHARED_ROBOT_COMMANDS =

$(ONTOLOGYTERMS): $(SRC) $(OTHER_SRC)
touch $(ONTOLOGYTERMS) && \
$(ROBOT) query --use-graphs true -f csv -i $< --query ../sparql/colao_terms.sparql $@
$(ONTOLOGYTERMS): $(SRCMERGED)
$(ROBOT) query -f csv -i $< --query ../sparql/colao_terms.sparql $@

# base: OTHER sources of interest, such as definitions owl
$(ONT)-base.owl: $(SRC) $(OTHER_SRC)
$(ROBOT) remove --input $< --select imports --trim false \
merge $(patsubst %, -i %, $(OTHER_SRC)) \
$(SHARED_ROBOT_COMMANDS) annotate --link-annotation http://purl.org/dc/elements/1.1/type http://purl.obolibrary.org/obo/IAO_8000001 \
# ROBOT pipeline that merges imports, including components.
ROBOT_RELEASE_IMPORT_MODE=$(ROBOT) merge --input $<

# ROBOT pipeline that removes imports, then merges components. This is for release artefacts that start from "base"
ROBOT_RELEASE_IMPORT_MODE_BASE=$(ROBOT) remove --input $< --select imports --trim false merge $(patsubst %, -i %, $(OTHER_SRC))

# base: All the axioms as they are editted by the editors, excluding reasoning
$(ONT)-base.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC)
$(ROBOT_RELEASE_IMPORT_MODE_BASE) \
$(SHARED_ROBOT_COMMANDS) \
annotate --link-annotation http://purl.org/dc/elements/1.1/type http://purl.obolibrary.org/obo/IAO_8000001 \
--ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
--output $@.tmp.owl && mv $@.tmp.owl $@

# Full: The full artefacts with imports merged, reasoned
$(ONT)-full.owl: $(SRC) $(OTHER_SRC) $(IMPORT_FILES)
$(ROBOT) merge --input $< \
# Full: The full artefacts with imports merged, reasoned.
$(ONT)-full.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(IMPORT_FILES)
$(ROBOT_RELEASE_IMPORT_MODE) \
reason --reasoner ELK --equivalent-classes-allowed asserted-only --exclude-tautologies structural \
relax \
reduce -r ELK \
$(SHARED_ROBOT_COMMANDS) annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@.tmp.owl && mv $@.tmp.owl $@

# ----------------------------------------
# Debugging Tools
# ----------------------------------------

explain_unsat: $(SRC)
$(ROBOT) explain -i $(SRC) -M unsatisfiability --unsatisfiable random:10 --explanation $(TMPDIR)/$@.md
explain_unsat: $(EDIT_PREPROCESSED)
$(ROBOT) explain -i $< -M unsatisfiability --unsatisfiable random:10 --explanation $(TMPDIR)/$@.md



RELEASE_ASSETS_AFTER_RELEASE=$(foreach n,$(RELEASE_ASSETS), ../../$(n))
GHVERSION=v$(VERSION)

.PHONY: public_release
public_release:
@test $(GHVERSION)
ls -alt $(RELEASE_ASSETS_AFTER_RELEASE)
gh release create $(GHVERSION) --title "$(VERSION) Release" --draft $(RELEASE_ASSETS_AFTER_RELEASE) --generate-notes

# ----------------------------------------
# General Validation
Expand Down Expand Up @@ -436,6 +491,7 @@ update_repo:
clean:
[ -n "$(MIRRORDIR)" ] && [ $(MIRRORDIR) != "." ] && [ $(MIRRORDIR) != "/" ] && [ $(MIRRORDIR) != ".." ] && [ -d ./$(MIRRORDIR) ] && rm -rf ./$(MIRRORDIR)/*
[ -n "$(TMPDIR)" ] && [ $(TMPDIR) != "." ] && [ $(TMPDIR) != "/" ] && [ $(TMPDIR) != ".." ] && [ -d ./$(TMPDIR) ] && rm -rf ./$(TMPDIR)/*
[ -n "$(UPDATEREPODIR)" ] && [ $(UPDATEREPODIR) != "." ] && [ $(UPDATEREPODIR) != "/" ] && [ $(UPDATEREPODIR) != ".." ] && [ -d ./$(UPDATEREPODIR) ] && rm -rf ./$(UPDATEREPODIR)/*
rm -f $(CLEANFILES)

.PHONY: help
Expand All @@ -457,11 +513,12 @@ Core commands:
* odkversion: Show the current version of the ODK Makefile and ROBOT.
* clean: Delete all temporary files
* help: Print ODK Usage information
* public_release: Uploads the release file to a release management system, such as GitHub releases. Must be configured.


Imports management:
* refresh-imports: Refresh all imports and mirrors.
* refresh-components: Refresh all components.
* recreate-components: Recreate all components.
* no-mirror-refresh-imports: Refresh all imports without downloading mirrors.
* refresh-imports-excluding-large: Refresh all imports and mirrors, but skipping the ones labelled as 'is_large'.
* refresh-%: Refresh a single import, i.e. refresh-go will refresh 'imports/go_import.owl'.
Expand All @@ -474,17 +531,20 @@ Editor utilities:
* explain_unsat: If you have unsatisfiable classes, this command will create a markdown file (tmp/explain_unsat.md) which will explain all your unsatisfiable classes
* validate-all-tsv: Check all your tsv files for possible problems in syntax. Use ALL_TSV_FILES variable to list files
* validate-tsv: Check a tsv file for syntactic problems with tsvalid. Use TSV variable to pass filepath, e.g. make TSV=../my.tsv validate-tsv.
* release_diff: Create a diff between the current release and the new release

Additional build commands (advanced users)
* all: Run the entire pipeline (like prepare_release), but without copying the release files to the release directory.
* all_subsets: Build all subsets
* custom_reports: Generate all custom sparql reports you have configured in your colao-odk.yaml file.
* all_assets: Build all assets
* show_assets: Print a list of all assets that would be build by the release pipeline
* all_mappings: Update all SSSOM mapping sets

Additional QC commands (advanced users)
* robot_reports: Run all configured ROBOT reports
* validate_profile_%: Run an OWL2 DL profile validation check, for example validate_profile_colao-edit.owl.
* reason_test: Run a basic reasoning test

Examples:
* sh run.sh make IMP=false prepare_release
Expand Down
Loading

0 comments on commit f1afbef

Please sign in to comment.