Skip to content

Commit

Permalink
Merge pull request #30 from obophenotype/ODK-Release-July-6-2021
Browse files Browse the repository at this point in the history
ODK Release July 6 2021
  • Loading branch information
chris-grove authored Jul 6, 2021
2 parents 99f1917 + cbffaf7 commit 5729250
Show file tree
Hide file tree
Showing 18 changed files with 4,033 additions and 114 deletions.
127 changes: 94 additions & 33 deletions src/ontology/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# ----------------------------------------
# Makefile for wbls
# Generated using ontology-starter-kit
# ODK Version: v1.2.22
# Generated using ontology-development-kit
# ODK Version: v1.2.29
# ----------------------------------------
# IMPORTANT: DO NOT EDIT THIS FILE. To override default make goals, use wbls.Makefile instead


# ----------------------------------------
# More information: https://github.com/INCATools/ontology-development-kit/


# ----------------------------------------
# Standard Constants
# ----------------------------------------
Expand All @@ -19,36 +24,44 @@ CATALOG= catalog-v001.xml
ROBOT= robot --catalog $(CATALOG)
RELEASEDIR= ../..
REPORTDIR= reports
TEMPLATEDIR= ../templates
TMPDIR= tmp
SCRIPTSDIR= ../scripts
SPARQLDIR = ../sparql
COMPONENTSDIR = components
REPORT_FAIL_ON = None
REPORT_LABEL = -l true
REPORT_PROFILE_OPTS =
OBO_FORMAT_OPTIONS =
SPARQL_VALIDATION_CHECKS = equivalent-classes owldef-self-reference
SPARQL_EXPORTS = basic-report class-count-by-prefix edges xrefs obsoletes synonyms
ODK_VERSION_MAKEFILE = v1.2.22
ODK_VERSION_MAKEFILE = v1.2.29

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)
OTHER_SRC =
ONTOLOGYTERMS = tmp/ontologyterms.txt
ONTOLOGYTERMS = $(TMPDIR)/ontologyterms.txt

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

# ----------------------------------------
# Top-level targets
# ----------------------------------------

.PHONY: .FORCE

.PHONY: all
all: odkversion all_imports all_main all_subsets sparql_test all_reports all_assets
test: odkversion sparql_test all_reports

.PHONY: test
test: odkversion sparql_test all_reports
$(ROBOT) reason --input $(SRC) --reasoner ELK --equivalent-classes-allowed all --exclude-tautologies structural --output test.owl && rm test.owl && echo "Success"

.PHONY: odkversion
odkversion:
echo "ODK Makefile version: $(ODK_VERSION_MAKEFILE) (this is the version of the ODK with which this Makefile was generated, not the version of the ODK you are running)" &&\
echo "ROBOT version (ODK): " && $(ROBOT) --version
Expand All @@ -60,10 +73,11 @@ $(TMPDIR) $(REPORTDIR) :
##
## By default this is the cross-product of {ont, ont-base} x FORMATS

MAIN_PRODUCTS = $(sort $(foreach r,$(RELEASE_ARTEFACTS), $(ONT)-$(r)) $(ONT))
MAIN_PRODUCTS = $(sort $(foreach r,$(RELEASE_ARTEFACTS), $(r)) $(ONT))
MAIN_GZIPPED =
MAIN_FILES = $(foreach n,$(MAIN_PRODUCTS), $(foreach f,$(FORMATS), $(n).$(f))) $(MAIN_GZIPPED)

.PHONY: all_main
all_main: $(MAIN_FILES)

## -- import targets --
Expand All @@ -78,6 +92,7 @@ IMPORT_OWL_FILES = $(foreach n,$(IMPORT_ROOTS), $(n).owl)
IMPORT_FILES = $(IMPORT_OWL_FILES)


.PHONY: all_imports
all_imports: $(IMPORT_FILES)

## -- subset targets --
Expand All @@ -91,14 +106,26 @@ SUBSETS =
SUBSET_ROOTS = $(patsubst %, subsets/%, $(SUBSETS))
SUBSET_FILES = $(foreach n,$(SUBSET_ROOTS), $(foreach f,$(FORMATS_INCL_TSV), $(n).$(f)))

.PHONY: all_subsets
all_subsets: $(SUBSET_FILES)

OBO_REPORT = $(SRC)-obo-report $(ONT).owl-obo-report
OBO_REPORT = $(SRC)-obo-report
REPORTS = $(OBO_REPORT)
REPORT_FILES = $(patsubst %, $(REPORTDIR)/%.tsv, $(REPORTS))

.PHONY: robot_reports
robot_reports: $(REPORT_FILES)

.PHONY: all_reports
all_reports: all_reports_onestep $(REPORT_FILES)

$(REPORTDIR)/validate_profile_owl2dl_%.txt: % | $(REPORTDIR)
$(ROBOT) validate-profile --profile DL -i $< -o $@
.PRECIOUS: $(REPORTDIR)/validate_profile_owl2dl_%.txt

.PHONY: validate_profile_%
validate_profile_%: $(REPORTDIR)/validate_profile_owl2dl_%.txt

## -- all files/assets --

ASSETS = \
Expand All @@ -109,11 +136,13 @@ ASSETS = \

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

.PHONY: all_assets
all_assets: $(ASSETS)


.PHONY: show_assets
show_assets:
echo $(ASSETS)
du -sh $(ASSETS)
Expand All @@ -126,11 +155,14 @@ show_assets:
CLEANFILES=$(MAIN_FILES) $(SRCMERGED)
# 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

.PHONY: prepare_release
prepare_release: $(ASSETS) $(PATTERN_RELEASE_FILES)
rsync -R $(RELEASE_ASSETS) $(RELEASEDIR) &&\
rm -f $(CLEANFILES) &&\
echo "Release files are now in $(RELEASEDIR) - now you should commit, push and make a release on your git hosting site such as GitHub or GitLab"

.PHONY: prepare_initial_release
prepare_initial_release: prepare_release
cd $(RELEASEDIR) && git add $(RELEASE_ASSETS)

Expand All @@ -145,9 +177,9 @@ prepare_initial_release: prepare_release
# ------------------------

# seed.txt contains all referenced entities
IMPORTSEED=tmp/seed.txt
SRCMERGED=tmp/merged-$(SRC)
PRESEED=tmp/pre_seed.txt
IMPORTSEED=$(TMPDIR)/seed.txt
SRCMERGED=$(TMPDIR)/merged-$(SRC)
PRESEED=$(TMPDIR)/pre_seed.txt

$(SRCMERGED): $(SRC)
$(ROBOT) remove --input $< --select imports --trim false \
Expand All @@ -157,17 +189,23 @@ $(PRESEED): $(SRCMERGED)
$(ROBOT) query -f csv -i $< --query ../sparql/terms.sparql $@.tmp &&\
cat $@.tmp | sort | uniq > $@

SIMPLESEED=tmp/simple_seed.txt
SIMPLESEED=$(TMPDIR)/simple_seed.txt

$(SIMPLESEED): $(SRCMERGED) $(ONTOLOGYTERMS)
$(ROBOT) query -f csv -i $< --query ../sparql/simple-seed.sparql $@.tmp &&\
cat $@.tmp $(ONTOLOGYTERMS) | sort | uniq > $@ &&\
echo "http://www.geneontology.org/formats/oboInOwl#SubsetProperty" >> $@ &&\
echo "http://www.geneontology.org/formats/oboInOwl#SynonymTypeProperty" >> $@

$(IMPORTSEED): $(PRESEED)
if [ $(IMP) = true ]; then cat $(PRESEED) | sort | uniq > $@; fi

ALLSEED = $(PRESEED) \


$(IMPORTSEED): $(ALLSEED)
if [ $(IMP) = true ]; then cat $(ALLSEED) | sort | uniq > $@; fi


ANNOTATION_PROPERTIES=rdfs:label IAO:0000115

# -- Generate Import Modules --
#
Expand All @@ -179,13 +217,24 @@ imports/%_terms_combined.txt: $(IMPORTSEED) imports/%_terms.txt


imports/%_import.owl: mirror/%.owl imports/%_terms_combined.txt
if [ $(IMP) = true ]; then $(ROBOT) query -i $< --update ../sparql/preprocess-module.ru \
extract -T imports/$*_terms_combined.txt --force true --copy-ontology-annotations true --individuals exclude --method STAR \
if [ $(IMP) = true ]; then $(ROBOT) query -i $< --update ../sparql/preprocess-module.ru \
extract -T imports/$*_terms_combined.txt --force true --copy-ontology-annotations true --individuals include --method BOT \
query --update ../sparql/inject-subset-declaration.ru --update ../sparql/postprocess-module.ru \
annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@.tmp.owl && mv $@.tmp.owl $@; fi

.PRECIOUS: imports/%_import.owl

.PHONY: refresh-imports
refresh-imports:
make IMP=true MIR=true PAT=false IMP_LARGE=true all_imports -B

.PHONY: refresh-imports-excluding-large
refresh-imports-excluding-large:
make IMP=true MIR=true PAT=false IMP_LARGE=false all_imports -B

.PHONY: refresh-%
refresh-%:
make IMP=true IMP_LARGE=true MIR=true PAT=false imports/$*_import.owl -B



Expand All @@ -196,6 +245,7 @@ imports/%_import.owl: mirror/%.owl imports/%_terms_combined.txt

IMP=true # Global parameter to bypass import generation
MIR=true # Global parameter to bypass mirror generation
IMP_LARGE=true # Global parameter to bypass handling of large imports


## ONTOLOGY: ro
Expand All @@ -204,7 +254,6 @@ mirror/ro.trigger: $(SRC)

mirror/ro.owl: mirror/ro.trigger
if [ $(MIR) = true ] && [ $(IMP) = true ]; then $(ROBOT) convert -I $(URIBASE)/ro.owl -o $@.tmp.owl && mv $@.tmp.owl $@; fi

.PRECIOUS: mirror/%.owl


Expand All @@ -214,14 +263,27 @@ mirror/ro.owl: mirror/ro.trigger
# ----------------------------------------
subsets/%.tsv: subsets/%.owl
$(ROBOT) query -f tsv -i $< -s ../sparql/labels.sparql $@
.PRECIOUS: subsets/%.tsv

subsets/%.owl: $(ONT).owl
owltools --use-catalog $< --extract-ontology-subset --fill-gaps --subset $* -o $@.tmp.owl && mv $@.tmp.owl $@
owltools --use-catalog $< --extract-ontology-subset --fill-gaps --subset $* -o $@.tmp.owl && mv $@.tmp.owl $@ &&\
$(ROBOT) annotate --input $@ --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) -o $@.tmp.owl && mv $@.tmp.owl $@
.PRECIOUS: subsets/%.owl


subsets/%.obo: subsets/%.owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o $@.tmp.obo && grep -v ^owl-axioms $@.tmp.obo > $@ && rm $@.tmp.obo

subsets/%.json: subsets/%.owl
$(ROBOT) convert --input $< --check false -f json -o $@.tmp.json &&\
jq -S 'walk(if type == "array" then sort else . end)' $@.tmp.json > $@ && rm $@.tmp.json


# ----------------------------------------
# Release
# ----------------------------------------
# copy from staging area (this directory) to top-level
.PHONY: release
release: $(ONT).owl $(ONT).obo
cp $^ $(RELEASEDIR) && cp imports/* $(RELEASEDIR)/imports

Expand Down Expand Up @@ -252,19 +314,13 @@ $(REPORTDIR)/%-obo-report.tsv: % | $(REPORTDIR)

SPARQL_EXPORTS_ARGS = $(foreach V,$(SPARQL_EXPORTS),-s $(SPARQLDIR)/$(V).sparql $(REPORTDIR)/$(V).tsv)
# This combines all into one single command

.PHONY: all_reports_onestep
all_reports_onestep: $(SRC)
ifneq ($(SPARQL_EXPORTS_ARGS),)
$(ROBOT) query -f tsv -i $< $(SPARQL_EXPORTS_ARGS)
endif


# ----------------------------------------
# Docker (experimental)
# ----------------------------------------
IM=build-$(ONT)
build-docker:
docker build -t $(ONT) .

# ----------------------------------------
# Release artefacts: export formats
# ----------------------------------------
Expand Down Expand Up @@ -307,6 +363,7 @@ $(ONT).json: $(ONT)-full.owl
# -----------------------------------------------------
# Release artefacts: variants (base, full, simple, etc)
# -----------------------------------------------------
SHARED_ROBOT_COMMANDS =

$(ONTOLOGYTERMS): $(SRC) $(OTHER_SRC)
touch $(ONTOLOGYTERMS) && \
Expand All @@ -325,7 +382,7 @@ $(ONTOLOGYTERMS): $(SRC) $(OTHER_SRC)
$(ONT)-base.owl: $(SRC) $(OTHER_SRC)
$(ROBOT) remove --input $< --select imports --trim false \
merge $(patsubst %, -i %, $(OTHER_SRC)) \
annotate --link-annotation http://purl.org/dc/elements/1.1/type http://purl.obolibrary.org/obo/IAO_8000001 \
$(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 $@

Expand All @@ -335,7 +392,7 @@ $(ONT)-full.owl: $(SRC) $(OTHER_SRC)
reason --reasoner ELK --equivalent-classes-allowed all --exclude-tautologies structural \
relax \
reduce -r ELK \
annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@.tmp.owl && mv $@.tmp.owl $@
$(SHARED_ROBOT_COMMANDS) annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@.tmp.owl && mv $@.tmp.owl $@

# foo-simple: (edit->reason,relax,reduce,drop imports, drop every axiom which contains an entity outside the "namespaces of interest")
# drop every axiom: filter --term-file keep_terms.txt --trim true
Expand All @@ -350,15 +407,19 @@ $(ONT)-simple.owl: $(SRC) $(OTHER_SRC) $(SIMPLESEED)
filter --term-file $(SIMPLESEED) --select "annotations ontology anonymous self" --trim true --signature true \
reduce -r ELK \
query --update ../sparql/inject-subset-declaration.ru \
annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@.tmp.owl && mv $@.tmp.owl $@
$(SHARED_ROBOT_COMMANDS) annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@.tmp.owl && mv $@.tmp.owl $@




.PHONY: validate_idranges
validate_idranges:
amm ../scripts/validate_id_ranges.sc wbls-idranges.owl
amm $(SCRIPTSDIR)/validate_id_ranges.sc wbls-idranges.owl

.PHONY: update_repo
update_repo:
sh ../scripts/update_repo.sh
sh $(SCRIPTSDIR)/update_repo.sh



include wbls.Makefile
Loading

0 comments on commit 5729250

Please sign in to comment.