Skip to content

Commit 0b4481d

Browse files
committed
Consolidate reviews
This patch consolidates the review of CASE-Corpora's knowledge base graph against prerelease states of CASE and UCO. The current implementation reviews each dataset against CASE's `develop` and `unstable` states. Before resolution of the slowdown noted in `case-utils` PR 72, this is a significant time cost that can be decreased by instead reviewing the consolidated knowledge base graph at `/catalog/kb-all.ttl`. This will be a more significant time cost if CASE-Corpora starts reviewing against the `-2.0.0` prerelease builds, using the review scheme outlined in UCO Issue 493. This patch also speeds up CI's review of each dataset by only running per-dataset validation against the current CASE release when not operating in a GitHub Action. This supports local (offline) development still running review in a focused dataset directory. (The Bash syntax used for variable definition detection is compatible with Bash's `set -u`. See tldp.org reference.) A follow-on patch will regenerate Make-managed files. References: * casework/CASE-Utilities-Python#72 * ucoProject/UCO#493 * https://tldp.org/LDP/abs/html/parameter-substitution.html Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
1 parent c211560 commit 0b4481d

File tree

4 files changed

+113
-96
lines changed

4 files changed

+113
-96
lines changed

catalog/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1+
*validation*.ttl
12
datasets.md
23
devices.md
34
kb-*.ttl
4-
validate-*.ttl

catalog/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ all:
2222
--file postvisit.mk
2323

2424
check: \
25-
validate-catalog.ttl \
25+
catalog_validation.ttl \
2626
all
2727
$(MAKE) \
2828
--directory datasets \
@@ -33,10 +33,10 @@ check: \
3333

3434
clean:
3535
@rm -f \
36-
kb-*.ttl \
37-
validate-*.ttl
36+
*_validation*.ttl \
37+
kb-*.ttl
3838

39-
validate-catalog.ttl: \
39+
catalog_validation.ttl: \
4040
$(top_srcdir)/.venv.done.log \
4141
$(top_srcdir)/dependencies/dependencies.ttl \
4242
$(top_srcdir)/ontology/case-corpora.ttl \

catalog/postvisit.mk

Lines changed: 93 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@ kb_datasets_dependencies := \
2929
$(wildcard datasets/*/distribution.ttl)
3030

3131
kb_all_dependencies := \
32-
kb-datasets.ttl \
3332
$(top_srcdir)/taxonomy/devices/drafting.ttl \
33+
kb-datasets.ttl \
3434
$(wildcard datasets/*/generated-*.ttl) \
3535
$(wildcard datasets/*/supplemental.ttl)
3636

3737
all: \
3838
README.md \
39-
kb-all.ttl
39+
kb-all_validation-develop.ttl \
40+
kb-all_validation-unstable.ttl
4041

4142
README.md: \
4243
README.md.in \
@@ -49,7 +50,7 @@ README.md: \
4950
mv _$@ $@
5051

5152
check: \
52-
validate-kb-all.ttl
53+
kb-all_validation.ttl
5354

5455
datasets.md: \
5556
$(top_srcdir)/ontology/case-corpora.ttl \
@@ -82,16 +83,22 @@ kb-all.ttl: \
8283
rm __$@
8384
mv _$@ $@
8485

85-
kb-datasets.ttl: \
86-
$(kb_datasets_dependencies) \
87-
$(rdf_toolkit_jar) \
88-
$(top_srcdir)/.venv.done.log
86+
kb-all_validation.ttl: \
87+
kb-all.ttl \
88+
kb-datasets_validation.ttl
8989
rm -f __$@ _$@
9090
source $(top_srcdir)/venv/bin/activate \
91-
&& rdfpipe \
92-
--output-format turtle \
93-
$(kb_datasets_dependencies) \
94-
> __$@
91+
&& case_validate \
92+
--allow-infos \
93+
--format turtle \
94+
--inference rdfs \
95+
--ontology-graph $(top_srcdir)/dependencies/dependencies.ttl \
96+
--ontology-graph $(top_srcdir)/ontology/case-corpora.ttl \
97+
--ontology-graph $(top_srcdir)/shapes/debug.ttl \
98+
--ontology-graph $(top_srcdir)/shapes/shapes.ttl \
99+
--output __$@ \
100+
kb-all.ttl \
101+
|| (cat __$@ ; exit 1)
95102
java -jar $(rdf_toolkit_jar) \
96103
--inline-blank-nodes \
97104
--source-format turtle \
@@ -101,28 +108,82 @@ kb-datasets.ttl: \
101108
rm __$@
102109
mv _$@ $@
103110

104-
validate-kb-all.ttl: \
105-
kb-all.ttl \
106-
validate-kb-datasets.ttl
107-
rm -f _$@
111+
kb-all_validation-develop.ttl: \
112+
$(top_srcdir)/dependencies/CASE-develop.ttl \
113+
kb-all.ttl
114+
rm -f __$@ _$@
108115
source $(top_srcdir)/venv/bin/activate \
109116
&& case_validate \
110117
--allow-infos \
118+
--built-version none \
111119
--format turtle \
112120
--inference rdfs \
121+
--ontology-graph $(top_srcdir)/dependencies/CASE-develop.ttl \
113122
--ontology-graph $(top_srcdir)/dependencies/dependencies.ttl \
114123
--ontology-graph $(top_srcdir)/ontology/case-corpora.ttl \
115-
--ontology-graph $(top_srcdir)/shapes/debug.ttl \
116124
--ontology-graph $(top_srcdir)/shapes/shapes.ttl \
117-
--output _$@ \
118-
kb-all.ttl \
119-
|| (cat _$@ ; exit 1)
125+
--output __$@ \
126+
kb-all.ttl
127+
java -jar $(rdf_toolkit_jar) \
128+
--inline-blank-nodes \
129+
--source-format turtle \
130+
--source __$@ \
131+
--target-format turtle \
132+
--target _$@
133+
rm __$@
120134
mv _$@ $@
121135

122-
validate-kb-datasets.ttl: \
123-
kb-datasets.ttl \
124-
validate-catalog.ttl
125-
rm -f _$@
136+
kb-all_validation-unstable.ttl: \
137+
$(top_srcdir)/dependencies/CASE-unstable.ttl \
138+
kb-all.ttl
139+
rm -f __$@ _$@
140+
source $(top_srcdir)/venv/bin/activate \
141+
&& case_validate \
142+
--allow-infos \
143+
--built-version none \
144+
--format turtle \
145+
--inference rdfs \
146+
--ontology-graph $(top_srcdir)/dependencies/CASE-unstable.ttl \
147+
--ontology-graph $(top_srcdir)/dependencies/dependencies.ttl \
148+
--ontology-graph $(top_srcdir)/ontology/case-corpora.ttl \
149+
--ontology-graph $(top_srcdir)/shapes/shapes.ttl \
150+
--output __$@ \
151+
kb-all.ttl
152+
java -jar $(rdf_toolkit_jar) \
153+
--inline-blank-nodes \
154+
--source-format turtle \
155+
--source __$@ \
156+
--target-format turtle \
157+
--target _$@
158+
rm __$@
159+
mv _$@ $@
160+
161+
kb-datasets.ttl: \
162+
$(kb_datasets_dependencies) \
163+
$(rdf_toolkit_jar) \
164+
$(top_srcdir)/dependencies/dependencies.ttl \
165+
$(top_srcdir)/ontology/case-corpora.ttl \
166+
$(top_srcdir)/shapes/shapes.ttl \
167+
$(top_srcdir)/.venv.done.log
168+
rm -f __$@ _$@
169+
source $(top_srcdir)/venv/bin/activate \
170+
&& rdfpipe \
171+
--output-format turtle \
172+
$(kb_datasets_dependencies) \
173+
> __$@
174+
java -jar $(rdf_toolkit_jar) \
175+
--inline-blank-nodes \
176+
--source-format turtle \
177+
--source __$@ \
178+
--target-format turtle \
179+
--target _$@
180+
rm __$@
181+
mv _$@ $@
182+
183+
kb-datasets_validation.ttl: \
184+
catalog_validation.ttl \
185+
kb-datasets.ttl
186+
rm -f __$@ _$@
126187
source $(top_srcdir)/venv/bin/activate \
127188
&& case_validate \
128189
--allow-infos \
@@ -132,7 +193,14 @@ validate-kb-datasets.ttl: \
132193
--ontology-graph $(top_srcdir)/ontology/case-corpora.ttl \
133194
--ontology-graph $(top_srcdir)/shapes/debug.ttl \
134195
--ontology-graph $(top_srcdir)/shapes/shapes.ttl \
135-
--output _$@ \
196+
--output __$@ \
136197
kb-datasets.ttl \
137-
|| (cat _$@ ; exit 1)
198+
|| (cat __$@ ; exit 1)
199+
java -jar $(rdf_toolkit_jar) \
200+
--inline-blank-nodes \
201+
--source-format turtle \
202+
--source __$@ \
203+
--target-format turtle \
204+
--target _$@
205+
rm __$@
138206
mv _$@ $@

src/dataset.mk

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ maybe_ground_truth_graph := $(wildcard ground-truth.*)
2424
rdf_toolkit_jar := $(top_srcdir)/dependencies/CASE/dependencies/UCO/lib/rdf-toolkit.jar
2525

2626
all: \
27-
kb_validation-CASE-develop.ttl \
28-
kb_validation-CASE-unstable.ttl
27+
kb.ttl
2928

3029
.PHONY: \
3130
check-pytest \
@@ -52,16 +51,20 @@ kb.ttl: \
5251
$(maybe_ground_truth_graph) \
5352
generated-*.ttl \
5453
> __$@
55-
source $(top_srcdir)/venv/bin/activate \
56-
&& case_validate \
57-
--allow-infos \
58-
--inference rdfs \
59-
--ontology-graph $(top_srcdir)/dependencies/dependencies.ttl \
60-
--ontology-graph $(top_srcdir)/ontology/case-corpora.ttl \
61-
--ontology-graph $(top_srcdir)/shapes/debug.ttl \
62-
--ontology-graph $(top_srcdir)/shapes/shapes.ttl \
63-
--ontology-graph $(top_srcdir)/taxonomy/devices/drafting.ttl \
64-
__$@
54+
# Skip per-dataset validation when this file is called in a GitHub action.
55+
test ! -z "$${GITHUB_ACTIONS+x}" \
56+
|| ( \
57+
source $(top_srcdir)/venv/bin/activate \
58+
&& case_validate \
59+
--allow-infos \
60+
--inference rdfs \
61+
--ontology-graph $(top_srcdir)/dependencies/dependencies.ttl \
62+
--ontology-graph $(top_srcdir)/ontology/case-corpora.ttl \
63+
--ontology-graph $(top_srcdir)/shapes/debug.ttl \
64+
--ontology-graph $(top_srcdir)/shapes/shapes.ttl \
65+
--ontology-graph $(top_srcdir)/taxonomy/devices/drafting.ttl \
66+
__$@ \
67+
)
6568
java -jar $(rdf_toolkit_jar) \
6669
--inline-blank-nodes \
6770
--source-format turtle \
@@ -129,57 +132,3 @@ generated-prov.ttl: \
129132
--target _$@
130133
rm __$@
131134
mv _$@ $@
132-
133-
kb_validation-CASE-develop.ttl: \
134-
$(top_srcdir)/dependencies/CASE-develop.ttl \
135-
$(top_srcdir)/taxonomy/devices/drafting.ttl \
136-
kb.ttl
137-
rm -f __$@ _$@
138-
source $(top_srcdir)/venv/bin/activate \
139-
&& case_validate \
140-
--allow-infos \
141-
--built-version none \
142-
--format turtle \
143-
--inference rdfs \
144-
--ontology-graph $(top_srcdir)/dependencies/CASE-develop.ttl \
145-
--ontology-graph $(top_srcdir)/dependencies/dependencies.ttl \
146-
--ontology-graph $(top_srcdir)/ontology/case-corpora.ttl \
147-
--ontology-graph $(top_srcdir)/shapes/shapes.ttl \
148-
--ontology-graph $(top_srcdir)/taxonomy/devices/drafting.ttl \
149-
--output __$@ \
150-
kb.ttl
151-
java -jar $(rdf_toolkit_jar) \
152-
--inline-blank-nodes \
153-
--source-format turtle \
154-
--source __$@ \
155-
--target-format turtle \
156-
--target _$@
157-
rm __$@
158-
mv _$@ $@
159-
160-
kb_validation-CASE-unstable.ttl: \
161-
$(top_srcdir)/dependencies/CASE-unstable.ttl \
162-
$(top_srcdir)/taxonomy/devices/drafting.ttl \
163-
kb.ttl
164-
rm -f __$@ _$@
165-
source $(top_srcdir)/venv/bin/activate \
166-
&& case_validate \
167-
--allow-infos \
168-
--built-version none \
169-
--format turtle \
170-
--inference rdfs \
171-
--ontology-graph $(top_srcdir)/dependencies/CASE-unstable.ttl \
172-
--ontology-graph $(top_srcdir)/dependencies/dependencies.ttl \
173-
--ontology-graph $(top_srcdir)/ontology/case-corpora.ttl \
174-
--ontology-graph $(top_srcdir)/shapes/shapes.ttl \
175-
--ontology-graph $(top_srcdir)/taxonomy/devices/drafting.ttl \
176-
--output __$@ \
177-
kb.ttl
178-
java -jar $(rdf_toolkit_jar) \
179-
--inline-blank-nodes \
180-
--source-format turtle \
181-
--source __$@ \
182-
--target-format turtle \
183-
--target _$@
184-
rm __$@
185-
mv _$@ $@

0 commit comments

Comments
 (0)