-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
154 lines (127 loc) · 3.51 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
147
148
149
150
151
152
153
# OccO ontology Makefile
# Jie Zheng
#
# This Makefile is used to build artifacts for the Occupation 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
OCCO := $(OBO)/OCCO_
TODAY := $(shell date +%Y-%m-%d)
### Directories
#
# This is a temporary place to put things.
build:
mkdir -p $@
### ROBOT
#
# We use the latest official release 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/%_imports.owl: src/ontology/Ontofox_input/%_import_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/%_imports.owl: build/%_imports.owl
$(ROBOT) remove --input build/$*_imports.owl \
--base-iri 'http://purl.obolibrary.org/obo/$*_' \
--axioms external \
--preserve-structure false \
--trim false \
--output $@
IMPORT_FILES := $(wildcard src/ontology/imports/*_imports.owl)
.PHONY: imports
imports: $(IMPORT_FILES)
### Templates
#
src/ontology/Modules/%.owl: src/ontology/Templates/%.tsv | build/robot.jar
echo '' > $@
$(ROBOT) merge \
--input src/ontology/occo-edit.owl \
template \
--template $< \
--prefix "OCCO: http://purl.obolibrary.org/obo/OCCO_" \
--ontology-iri "http://purl.obolibrary.org/obo/occo/dev/$(notdir $@)" \
--output $@
# Update all modules
MODULE_NAMES := occo_terms\
US_SOC_ID\
ability_types\
skill_types\
job_zones_equivalent\
job_zones\
top_abilities_axioms\
top_abilities_annotations\
top_skills_axioms\
top_skills_annotations\
Alabama_subset\
occo_obsolete
MODULE_FILES := $(foreach x,$(MODULE_NAMES),src/ontology/Modules/$(x).owl)
.PHONY: modules
modules: $(MODULE_FILES)
### Views
# Build Alabama occupation view
views/occo_alabama.owl: occo.owl src/ontology/views/Alabama.txt | build/robot.jar
$(ROBOT) extract \
--input $< \
--method STAR \
--term-file $(word 2,$^) \
--individuals definitions \
--copy-ontology-annotations true \
annotate \
--ontology-iri "$(OBO)/occo/occo_alabama.owl" \
--version-iri "$(OBO)/occo/releases/$(TODAY)/occo_alabama.owl" \
--output $@
.PHONY: views
views: views/occo_alabama.owl
### Build
#
# Here we create a standalone OWL file appropriate for release.
# This involves merging, reasoning, annotating,
# and removing any remaining import declarations.
build/occo-merged.owl: src/ontology/occo-edit.owl | build/robot.jar build
$(ROBOT) merge \
--input $< \
annotate \
--ontology-iri "$(OBO)/occo/occo-merged.owl" \
--version-iri "$(OBO)/occo/releases/$(TODAY)/occo-merged.owl" \
--annotation owl:versionInfo "$(TODAY)" \
--output build/occo-merged.tmp.owl
sed '/<owl:imports/d' build/occo-merged.tmp.owl > $@
rm build/occo-merged.tmp.owl
occo.owl: build/occo-merged.owl
$(ROBOT) reason \
--input $< \
--reasoner HermiT \
annotate \
--ontology-iri "$(OBO)/occo.owl" \
--version-iri "$(OBO)/occo/releases/$(TODAY)/occo.owl" \
--annotation owl:versionInfo "$(TODAY)" \
--output $@
robot_report.tsv: build/occo-merged.owl
$(ROBOT) report \
--input $< \
--fail-on none \
--output $@
###
#
# Full build
.PHONY: all
all: occo.owl robot_report.tsv
# Remove generated files
.PHONY: clean
clean:
rm -rf build