forked from Occupation-Ontology/OccO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
135 lines (109 loc) · 3 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
# 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\
ability_types\
skill_types\
job_zones_equivalent\
job_zones\
top_abilities_axioms\
top_abilities_annotations\
top_skills_axioms\
top_skills_annotations
MODULE_FILES := $(foreach x,$(MODULE_NAMES),src/ontology/Modules/$(x).owl)
.PHONY: modules
modules: $(MODULE_FILES)
### 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/$(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/$(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