-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathMakefile
148 lines (118 loc) · 3.69 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# config
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := all
.DELETE_ON_ERROR:
.SUFFIXES:
# Run `make all` to create a new IAO release:
# - download the latest build of ROBOT
# - merge iao-edit.owl with imports to create iao-merged.owl
# - reason over iao-merged.owl to create iao.owl
# - clean build files
# If you wish to keep build/robot.jar, run `make release` instead.
# ===============================
# VARIABLES
# ===============================
SHELL := /bin/bash
OBO := http://purl.obolibrary.org/obo
DEV := $(OBO)/iao/dev
ROBOT := java -jar build/robot.jar
# release vars
TODAY := $(shell date +%Y-%m-%d)
TS := $(shell date +'%d:%m:%Y %H:%M')
# directories
SRC = src/ontology
# ===============================
# MAIN TASK
# ===============================
# run `make all` or `make release` to make a new release
# `make all` will remove the build dir with ROBOT on completion
all: clean
### Directories
#
# This is a temporary place to put things.
build:
mkdir -p $@
# ===============================
# ROBOT
# ===============================
# download the most recent build of ROBOT
build/robot.jar: | build
@echo "Getting ROBOT" && \
curl -L -o $@ https://github.com/ontodev/robot/releases/download/v1.6.0/robot.jar
clean: | release
@echo "Removing build files" && \
rm -rf build
# ===============================
# IAO TASKS
# ===============================
# Update import file, commented on this release
# regenerate fresh import-OBO file
# .PHONY: src/ontology/import-OBO.owl
# $(SRC)/import-OBO.owl:
# @echo "Generating $@" && \
# cd src/ontology/ontofox && \
# curl -s -F [email protected] http://ontofox.hegroup.org/service.php > ../import-OBO.owl
### Imports
#
# Use Ontofox to import various modules.
build/import_%.owl: src/ontology/ontoFox/%_input.txt | build/robot.jar build
curl -s -F file=@$< -o $@ https://ontofox.hegroup.org/service.php
# Use ROBOT to remove external java axioms
src/ontology/imports/import_%.owl: build/import_%.owl
$(ROBOT) remove --input build/import_$*.owl \
--base-iri 'http://purl.obolibrary.org/obo/$*_' \
--axioms external \
--preserve-structure false \
--trim false \
--output $@
IMPORT_FILES := $(wildcard src/ontology/imports/import_*.owl)
.PHONY: imports
imports: $(IMPORT_FILES)
# merge components to generate iao-merged
build/iao-merged.owl: $(SRC)/iao-edit.owl | build/robot.jar build
@echo "Merging $< to $@" && \
$(ROBOT) merge \
--input $< \
annotate \
--ontology-iri "$(OBO)/iao/iao-merged.owl" \
--version-iri "$(OBO)/iao/$(TODAY)/iao-merged.owl" \
--annotation owl:versionInfo "$(TODAY)" \
--output build/iao_merged.tmp.owl
sed '/<owl:imports/d' build/iao_merged.tmp.owl > $@
rm build/iao_merged.tmp.owl
# reason over iao-merged to generate IAO
iao.owl: build/iao-merged.owl
@echo "Reasoning $< to $@" && \
$(ROBOT) reason \
--input $< \
--reasoner HermiT \
--exclude-tautologies all \
annotate \
--ontology-iri "$(OBO)/iao.owl" \
--version-iri "$(OBO)/iao/$(TODAY)/iao.owl" \
--annotation owl:versionInfo "$(TODAY)" \
--output $@
### Test
#
# Run tests
# Run a reasoner to find inconsistencies
.PHONY: reason
reason: build/iao-merged.owl | build/robot.jar
@echo "Running tests"
@echo "Run reasoning"
$(ROBOT) reason --input $< --reasoner hermit --equivalent-classes-allowed none
# Run robot report
build/robot-report.tsv: build/iao-merged.owl
@echo "Generate robot report ignoring term IAO_0000118 alternative label"
$(ROBOT) remove \
--input $< \
--term IAO:0000118 \
report \
--fail-on error \
--output $@
.PHONY: test
test: reason build/robot-report.tsv
release: build/iao-merged.owl iao.owl
@echo "A new release is made"