@@ -125,52 +125,6 @@ $(FASTOBO): | build
125125 fi ; \
126126 fi
127127
128- # ----------------------------------------
129- # FILE UTILITIES
130- # ----------------------------------------
131-
132- # cleans csv files from a directory, optionally matching pattern(s)
133- # --> to prevent existing file inclusion in concat_csv
134- # args = input-directory, pattern(s)-to-match-files (should end with .csv)
135- define clean_existing_csv
136- @PATTERN=($(2 ) ) ; \
137- if [ "$$PATTERN" ]; then \
138- TMP_FILES=$$(find $(1 ) -name "$(firstword $(2 ) ) " $(patsubst % ,-o -name "% ",$(wordlist 2,$(words $(2 ) ) ,$(2 ) ) ) ) ; \
139- else \
140- TMP_FILES=$$(find $(1 ) -name "*.csv" ) ; \
141- fi ; \
142- if [ "$$TMP_FILES" ]; then \
143- rm -f $$TMP_FILES ; \
144- fi
145- endef
146-
147- # concatenate multiple CSV files into one
148- # args = file category ('TEST' to error, if output), output-file, input-directory, pattern(s)-to-match-files (should end with .csv)
149- define concat_csv
150- @PATTERN=($(4 ) ) ; \
151- if [ "$$PATTERN" ]; then \
152- TMP_FILES=$$(find $(3 ) -name "$(firstword $(4 ) ) " $(patsubst % ,-o -name "% ",$(wordlist 2,$(words $(4 ) ) ,$(4 ) ) ) ) ; \
153- else \
154- TMP_FILES=$$(find $(3 ) -name "*.csv" ) ; \
155- fi ; \
156- if [ "$$TMP_FILES" ]; then \
157- awk 'BEGIN { OFS = FS = "," } ; { \
158- if (FNR == 1) { \
159- gsub(/^.*\/|\.csv/, "", FILENAME) ; \
160- if (NR != 1) { print "" } ; \
161- print "$(1 ) : " FILENAME ; print $$0 \
162- } \
163- else { print $$0 } \
164- }' $$TMP_FILES > $(2 ) \
165- && rm -f $$TMP_FILES ; \
166- if [ "$(1 ) " = "TEST" ] ; then \
167- exit 1 ; \
168- fi ; \
169- elif [ "$(1 ) " = "TEST" ]; then \
170- echo "" > $(2 ) ; \
171- fi
172- endef
173-
174128
175129# #########################################
176130# # CI TESTS & DIFF
@@ -218,34 +172,42 @@ build/doid-edit-reasoned.owl: $(EDIT) | check_robot build
218172 --output $@
219173 @echo -e " \n## Reasoning completed successfully!"
220174
221- # Verify doid -edit.owl
175+ # Verify * -edit.owl
222176EDIT_V_QUERIES := $(wildcard src/sparql/verify/edit-verify-* .rq src/sparql/verify/verify-* .rq)
177+ EDIT_V_RES := $(patsubst src/sparql/verify/% .rq,build/reports/temp/% .csv,$(EDIT_V_QUERIES ) )
223178
224179.PRECIOUS : build/reports/edit-verify.csv
225180verify-edit : build/reports/edit-verify.csv
226181build/reports/edit-verify.csv : $(EDIT ) | check_robot build/reports/temp
227- $( call clean_existing_csv, $( word 2,$|) ,edit-verify- * .csv verify- * .csv )
182+ @rm -f $( EDIT_V_RES )
228183 @$(ROBOT ) verify \
229184 --input $< \
230185 --queries $(EDIT_V_QUERIES ) \
231186 --fail-on-violation false \
232187 --output-dir $(word 2,$|)
233- $(call concat_csv,TEST,$@ ,$(word 2,$|) ,edit-verify-* .csv verify-* .csv)
188+ @python3 src/util/concat_csv.py \
189+ --input $(EDIT_V_RES ) \
190+ --category TEST \
191+ --output $@
234192
235- # Verify of doid -edit.owl that should be run quarterly (not part of release)
193+ # Verify of * -edit.owl that should be run quarterly (not part of release)
236194QUARTER_V_QUERIES := $(wildcard src/sparql/verify/quarter-verify-* .rq)
195+ QUARTER_V_RES := $(patsubst src/sparql/verify/% .rq,build/reports/temp/% .csv,$(QUARTER_V_QUERIES ) )
237196
238197.PRECIOUS : build/reports/quarterly_test.csv
239198quarterly_test : build/reports/quarterly_test.csv
240199build/reports/quarterly_test.csv : $(EDIT ) | check_robot build/reports/temp
241200 @echo " Verifying $<..."
242- $( call clean_existing_csv, $( word 2,$|) ,quarter-verify- * .csv )
201+ @rm -f $( QUARTER_V_RES )
243202 @$(ROBOT ) verify \
244203 --input $< \
245204 --queries $(QUARTER_V_QUERIES ) \
246205 --fail-on-violation false \
247206 --output-dir $(word 2,$|)
248- $(call concat_csv,TEST,$@ ,$(word 2,$|) ,quarter-verify-* .csv)
207+ @python3 src/util/concat_csv.py \
208+ --input $(QUARTER_V_RES ) \
209+ --category TEST \
210+ --output $@
249211
250212# ----------------------------------------
251213# DIFF
0 commit comments