generated from usnistgov/opensource-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
199 lines (181 loc) · 5.17 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#!/usr/bin/make -f
# This software was developed at the National Institute of Standards
# and Technology by employees of the Federal Government in the course
# of their official duties. Pursuant to title 17 Section 105 of the
# United States Code this software is not subject to copyright
# protection and is in the public domain. NIST assumes no
# responsibility whatsoever for its use by other parties, and makes
# no guarantees, expressed or implied, about its quality,
# reliability, or any other characteristic.
#
# We would appreciate acknowledgement if the software is used.
SHELL := /bin/bash
top_srcdir := $(shell cd .. ; pwd)
uco_srcdir := $(top_srcdir)/dependencies/UCO
uco_ontology_files := $(wildcard $(uco_srcdir)/ontology/*/*.ttl $(uco_srcdir)/ontology/*/*/*.ttl)
RDF_TOOLKIT_JAR := $(uco_srcdir)/lib/rdf-toolkit.jar
all:
.PHONY: \
check-shapes \
check-pytest
# NOTE - This file is needed to supply all concepts in shapes---both
# local to this repository and in UCO---into a single argument for
# pyshacl.
.local-monolithic.ttl: \
$(top_srcdir)/.venv.done.log \
$(top_srcdir)/shapes/dcam/dcam.ttl \
$(top_srcdir)/shapes/dcterms/dcterms.ttl \
$(top_srcdir)/shapes/skos/skos.ttl \
$(top_srcdir)/shapes/uco/uco.ttl \
$(uco_ontology_files)
source $(top_srcdir)/venv/bin/activate \
&& rdfpipe \
--output-format turtle \
$(uco_ontology_files) \
$(top_srcdir)/shapes/dcam/dcam.ttl \
$(top_srcdir)/shapes/dcterms/dcterms.ttl \
$(top_srcdir)/shapes/skos/skos.ttl \
$(top_srcdir)/shapes/uco/uco.ttl \
> _$@
# Review monolithic file with itself.
# (Build currently contains OWL review mechanisms.)
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--data-file-format turtle \
--inference none \
--ont-file-format turtle \
--ont-graph _$@ \
--shacl _$@ \
--shacl-file-format turtle \
_$@
mv _$@ $@
# NOTE - This file is needed to validate the sample JSON-LD file with
# taxonomy concepts available.
.taxonomy-and-sample.ttl: \
$(top_srcdir)/taxonomy/mime/mime.ttl \
sample.json
source $(top_srcdir)/venv/bin/activate \
&& rdfpipe \
--output-format turtle \
$(top_srcdir)/taxonomy/mime/mime.ttl \
sample.json \
> _$@
mv _$@ $@
check: \
check-shapes \
check-pytest
check-pytest: \
$(top_srcdir)/.venv.done.log \
skos_exactMatch_XFAIL_validation.ttl \
skos_notation_XFAIL_validation.ttl
source $(top_srcdir)/venv/bin/activate \
&& pytest \
--log-level=DEBUG \
--verbose \
--verbose
check-shapes: \
mime_validation.ttl \
sample_validation.ttl
clean:
@rm -f \
.local-monolithic.ttl \
.taxonomy-and-sample.ttl \
*_validation.ttl
mime_validation.ttl: \
$(RDF_TOOLKIT_JAR) \
.local-monolithic.ttl \
$(top_srcdir)/taxonomy/mime/mime.ttl
rm -f __$@
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--allow-infos \
--data-file-format turtle \
--format turtle \
--inference none \
--ont-file-format turtle \
--ont-graph .local-monolithic.ttl \
--output __$@ \
--shacl .local-monolithic.ttl \
--shacl-file-format turtle \
$(top_srcdir)/taxonomy/mime/mime.ttl
java -jar $(RDF_TOOLKIT_JAR) \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
mv _$@ $@
sample_validation.ttl: \
$(RDF_TOOLKIT_JAR) \
.local-monolithic.ttl \
.taxonomy-and-sample.ttl
rm -f __$@
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--allow-infos \
--data-file-format turtle \
--format turtle \
--inference none \
--ont-file-format turtle \
--ont-graph .local-monolithic.ttl \
--output __$@ \
--shacl .local-monolithic.ttl \
--shacl-file-format turtle \
.taxonomy-and-sample.ttl
java -jar $(RDF_TOOLKIT_JAR) \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
mv _$@ $@
skos_exactMatch_XFAIL_validation.ttl: \
$(RDF_TOOLKIT_JAR) \
$(top_srcdir)/shapes/skos/skos.ttl \
skos_exactMatch_XFAIL.json
rm -f __$@
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--allow-infos \
--data-file-format json-ld \
--format turtle \
--inference none \
--output __$@ \
--shacl $(top_srcdir)/shapes/skos/skos.ttl \
--shacl-file-format turtle \
skos_exactMatch_XFAIL.json \
; rc=$$? ; test 1 -eq $$rc
java -jar $(RDF_TOOLKIT_JAR) \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
mv _$@ $@
skos_notation_XFAIL_validation.ttl: \
$(RDF_TOOLKIT_JAR) \
$(top_srcdir)/shapes/skos/skos.ttl \
skos_notation_XFAIL.json
rm -f __$@
source $(top_srcdir)/venv/bin/activate \
&& pyshacl \
--allow-infos \
--data-file-format json-ld \
--format turtle \
--inference none \
--output __$@ \
--shacl $(top_srcdir)/shapes/skos/skos.ttl \
--shacl-file-format turtle \
skos_notation_XFAIL.json \
; rc=$$? ; test 1 -eq $$rc
java -jar $(RDF_TOOLKIT_JAR) \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
mv _$@ $@