-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
109 lines (87 loc) · 2.27 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
# OGMS ontology Makefile
# Jie Zheng
#
# This Makefile is used to build artifacts
# for the OGMS ontology.
#
### Configuration
#
# prologue:
# <http://clarkgrubb.com/makefile-style-guide#toc2>
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := all
.DELETE_ON_ERROR:
.SUFFIXES:
### Definitions
SHELL := /bin/bash
OBO := http://purl.obolibrary.org/obo
OGMS := $(OBO)/OGMS_
TODAY := $(shell date +%Y-%m-%d)
### Directories
#
# This is a temporary place to put things.
build:
mkdir -p $@
### ROBOT
#
# We use the official development version of ROBOT
build/robot.jar: | build
curl -L -o $@ "https://github.com/ontodev/robot/releases/latest/download/robot.jar"
ROBOT := java -jar build/robot.jar
### Imports
#
# Use Ontofox to import various modules.
build/import_%.owl: src/ontology/OntoFox_input/input_%.txt | build/robot.jar build
curl -s -F file=@$< -o $@ http://ontofox.hegroup.org/service.php
# Use ROBOT to remove external 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)
### Build
# Here we create a standalone OWL file appropriate for release.
# This involves merging, reasoning, annotating.
build/ogms_merged.owl: src/ontology/ogms_dev.owl | build/robot.jar build
$(ROBOT) merge \
--input $< \
annotate \
--ontology-iri "$(OBO)/ogms/ogms_merged.owl" \
--output build/ogms_merged.tmp.owl
sed '/<owl:imports/d' build/ogms_merged.tmp.owl > $@
rm build/ogms_merged.tmp.owl
ogms.owl: build/ogms_merged.owl
$(ROBOT) reason \
--input $< \
--reasoner HermiT \
annotate \
--ontology-iri "$(OBO)/ogms.owl" \
--version-iri "$(OBO)/ogms/$(TODAY)/ogms.owl" \
--annotation owl:versionInfo "$(TODAY)" \
--output $@
ogms.obo: ogms.owl
$(ROBOT) convert \
--input $< \
--format obo \
--output $@
build/report.tsv: ogms.owl
$(ROBOT) report \
--input $< \
--fail-on none \
--output $@
###
#
# Full build
.PHONY: all
all: ogms.owl ogms.obo build/report.tsv
# Remove generated files
.PHONY: clean
clean:
rm -rf build