Skip to content

Commit

Permalink
Delegate Turtle normalization for ontology and shapes files to pre-co…
Browse files Browse the repository at this point in the history
…mmit 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 <alexander.nelson@nist.gov>
  • Loading branch information
ajnelson-nist committed Jun 17, 2024
1 parent 4ff898f commit 18f92be
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 67 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
*.jar
*.swp
.*.done.log
.check-*.ttl
.venv-pre-commit
__pycache__
venv
33 changes: 0 additions & 33 deletions ontology/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
_* \
Expand Down
33 changes: 0 additions & 33 deletions shapes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
_* \
Expand Down

0 comments on commit 18f92be

Please sign in to comment.