Skip to content

Commit

Permalink
Call rdf-toolkit via pre-commit
Browse files Browse the repository at this point in the history
References:
* ucoProject/UCO#373

Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
  • Loading branch information
ajnelson-nist committed May 31, 2022
1 parent 13375f1 commit b3a5e11
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 41 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ repos:
- --indent=4
- --no-ensure-ascii
- --no-sort-keys
- repo: https://github.com/kchason/rdf-toolkit-action
rev: 0.1.2
hooks:
- id: rdf-toolkit-normalizer
args:
- --autofix
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ all: \
|| (git submodule init dependencies/UCO-unstable && git submodule update dependencies/UCO-unstable)
test -r dependencies/UCO-unstable/README.md \
|| (echo "ERROR:Makefile:UCO-unstable submodule README.md file not found, even though UCO-unstable submodule initialized." >&2 ; exit 2)
# Retrieve rdf-toolkit.jar.
cd dependencies/CASE-Utilities-Python \
&& git submodule update --init dependencies/CASE
$(MAKE) \
--directory dependencies/CASE-Utilities-Python/dependencies/CASE \
.lib.done.log
touch $@

# This virtual environment is meant to be built once and then persist, even through 'make clean'.
Expand Down
44 changes: 9 additions & 35 deletions examples/illustrations/src/illustration-nosrc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ SHELL := /bin/bash
# The expected execution context is in any sibling directory of this Makefile's directory.
top_srcdir := $(shell cd ../../.. ; pwd)

RDF_TOOLKIT_JAR := $(top_srcdir)/dependencies/CASE-Utilities-Python/dependencies/CASE/lib/rdf-toolkit.jar

example_name := $(shell basename $$PWD)

# Use a drafting.ttl file in the validation and dependency list, if it is present.
Expand All @@ -42,78 +40,54 @@ all: \

$(example_name)_validation.ttl: \
$(example_name).json \
$(RDF_TOOLKIT_JAR) \
$(drafting_ttl) \
$(top_srcdir)/.venv.done.log
rm -f __$@
rm -f _$@
source $(top_srcdir)/venv/bin/activate \
&& case_validate \
--format turtle \
$(drafting_validation_flag) \
--output __$@ \
--output _$@ \
$< \
$(drafting_ttl) \
; rc=$$? ; test 0 -eq $$rc -o 1 -eq $$rc
test -s __$@
java -jar $(RDF_TOOLKIT_JAR) \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
test -s _$@
mv _$@ $@

$(example_name)_validation-develop.ttl: \
$(example_name).json \
$(RDF_TOOLKIT_JAR) \
$(drafting_ttl) \
$(top_srcdir)/.venv.done.log \
$(top_srcdir)/dependencies/CASE-develop.ttl
rm -f __$@
rm -f _$@
source $(top_srcdir)/venv/bin/activate \
&& case_validate \
--built-version none \
--format turtle \
$(drafting_validation_flag) \
--ontology-graph $(top_srcdir)/dependencies/CASE-develop.ttl \
--output __$@ \
--output _$@ \
$< \
; rc=$$? ; test 0 -eq $$rc -o 1 -eq $$rc
test -s __$@
java -jar $(RDF_TOOLKIT_JAR) \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
test -s _$@
mv _$@ $@

$(example_name)_validation-unstable.ttl: \
$(example_name).json \
$(RDF_TOOLKIT_JAR) \
$(drafting_ttl) \
$(top_srcdir)/.venv.done.log \
$(top_srcdir)/dependencies/CASE-unstable.ttl
rm -f __$@
rm -f _$@
source $(top_srcdir)/venv/bin/activate \
&& case_validate \
--built-version none \
--format turtle \
$(drafting_validation_flag) \
--ontology-graph $(top_srcdir)/dependencies/CASE-unstable.ttl \
--output __$@ \
--output _$@ \
$< \
; rc=$$? ; test 0 -eq $$rc -o 1 -eq $$rc
test -s __$@
java -jar $(RDF_TOOLKIT_JAR) \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
test -s _$@
mv _$@ $@

check: \
Expand Down

0 comments on commit b3a5e11

Please sign in to comment.