From 18f92be63d13448231177d30ac31c6b8482763ce Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Mon, 17 Jun 2024 15:56:54 -0400 Subject: [PATCH] Delegate Turtle normalization for ontology and shapes files to pre-commit hook No effects were observed on Make-managed files. Disclaimer: Participation by NIST in the creation of the documentation of mentioned software is not intended to imply a recommendation or endorsement by the National Institute of Standards and Technology, nor is it intended to imply that any specific software is necessarily the best available for the purpose. Signed-off-by: Alex Nelson --- .gitignore | 1 - ontology/Makefile | 33 --------------------------------- shapes/Makefile | 33 --------------------------------- 3 files changed, 67 deletions(-) diff --git a/.gitignore b/.gitignore index 3249754..605534e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ *.jar *.swp .*.done.log -.check-*.ttl .venv-pre-commit __pycache__ venv diff --git a/ontology/Makefile b/ontology/Makefile index 261a613..cae85be 100644 --- a/ontology/Makefile +++ b/ontology/Makefile @@ -20,37 +20,11 @@ top_srcdir := $(shell cd .. ; pwd) uco_srcdir := $(top_srcdir)/dependencies/UCO -RDF_TOOLKIT_JAR := $(uco_srcdir)/lib/rdf-toolkit.jar - ttl_basenames := $(wildcard uco-*.ttl) -check_ttl_targets := $(foreach ttl_basename,$(ttl_basenames),check-$(ttl_basename)) - all: \ catalog-v001.xml -.PHONY: \ - check-%.ttl - -.PRECIOUS: \ - .check-%.ttl - -$(RDF_TOOLKIT_JAR): - @echo "DEBUG:ontology/Makefile:top_srcdir=$(top_srcdir)" >&2 - @echo "ERROR:ontology/Makefile:rdf-toolkit.jar not found. Did you run `make` from the top source directory?" >&2 - @test -r $@ - -.check-%.ttl: \ - %.ttl \ - $(RDF_TOOLKIT_JAR) - java -jar $(RDF_TOOLKIT_JAR) \ - --inline-blank-nodes \ - --source $< \ - --source-format turtle \ - --target _$@ \ - --target-format turtle - mv _$@ $@ - catalog-v001.xml: \ $(top_srcdir)/.venv.done.log \ $(top_srcdir)/etc/domain_directories.tsv \ @@ -69,15 +43,8 @@ catalog-v001.xml: \ mv _$@ $@ check: \ - $(check_ttl_targets) \ catalog-v001.xml -check-%.ttl: \ - %.ttl \ - .check-%.ttl - diff $^ \ - || (echo "ERROR:ontology/Makefile:The local $< does not match the normalized version. If the above reported changes look fine, run 'cp .check-$< $<' while in the sub-folder ontology/ to get a file ready to commit to Git." >&2 ; exit 1) - clean: @rm -f \ _* \ diff --git a/shapes/Makefile b/shapes/Makefile index ed4546c..71e91ff 100644 --- a/shapes/Makefile +++ b/shapes/Makefile @@ -20,37 +20,11 @@ top_srcdir := $(shell cd .. ; pwd) uco_srcdir := $(top_srcdir)/dependencies/UCO -RDF_TOOLKIT_JAR := $(uco_srcdir)/lib/rdf-toolkit.jar - ttl_basenames := $(wildcard sh-*.ttl) -check_ttl_targets := $(foreach ttl_basename,$(ttl_basenames),check-$(ttl_basename)) - all: \ catalog-v001.xml -.PHONY: \ - check-%.ttl - -.PRECIOUS: \ - .check-%.ttl - -$(RDF_TOOLKIT_JAR): - @echo "DEBUG:shapes/Makefile:top_srcdir=$(top_srcdir)" >&2 - @echo "ERROR:shapes/Makefile:rdf-toolkit.jar not found. Did you run `make` from the top source directory?" >&2 - @test -r $@ - -.check-%.ttl: \ - %.ttl \ - $(RDF_TOOLKIT_JAR) - java -jar $(RDF_TOOLKIT_JAR) \ - --inline-blank-nodes \ - --source $< \ - --source-format turtle \ - --target _$@ \ - --target-format turtle - mv _$@ $@ - catalog-v001.xml: \ $(top_srcdir)/.venv.done.log \ $(top_srcdir)/etc/domain_directories.tsv \ @@ -69,15 +43,8 @@ catalog-v001.xml: \ mv _$@ $@ check: \ - $(check_ttl_targets) \ catalog-v001.xml -check-%.ttl: \ - %.ttl \ - .check-%.ttl - diff $^ \ - || (echo "ERROR:shapes/Makefile:The local $< does not match the normalized version. If the above reported changes look fine, run 'cp .check-$< $<' while in the sub-folder shapes/ to get a file ready to commit to Git." >&2 ; exit 1) - clean: @rm -f \ _* \