From 8970b09105fe93141fc8375d242f5474e6bd344b Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Wed, 8 Apr 2026 07:59:43 +0200 Subject: [PATCH 1/2] Automatically download Jena RIOT --- .gitignore | 2 ++ Makefile | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index b11b1d5dc..9dc6f510e 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ share/python-wheels/ *.egg MANIFEST node_modules/ +apache-jena-*.tar.gz +apache-jena-*/ diff --git a/Makefile b/Makefile index b12b5202e..9e15f0ee8 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,11 @@ # Before editing this file, ensure that your editor is not set up to convert tabs # to spaces, and then use tabs to indent recipe lines. +JENA_VERSION := 6.0.0 +JENA_DIR := apache-jena-$(JENA_VERSION) +JENA_ARCHIVE := $(JENA_DIR).tar.gz +JENA_URL := https://archive.apache.org/dist/jena/binaries/$(JENA_ARCHIVE) +RIOT := ./$(JENA_DIR)/bin/riot ### Configuration @@ -51,7 +56,7 @@ integration-test: test valid-purl-report.txt # Remove and/or revert all targets to their repository versions: clean: - rm -Rf registry/ontologies.nt registry/ontologies.ttl registry/ontologies.yml sparql-consistency-report.txt jenkins-output.txt valid-purl-report.txt valid-purl-report.txt.tmp _site/ tmp/ reports/ + rm -Rf registry/ontologies.nt registry/ontologies.ttl registry/ontologies.yml sparql-consistency-report.txt jenkins-output.txt valid-purl-report.txt valid-purl-report.txt.tmp _site/ tmp/ reports/ $(JENA_DIR) $(JENA_ARCHIVE) git checkout _config.yml registry/ontologies.jsonld registry/ontologies.ttl registry/ontologies.yml @@ -103,15 +108,24 @@ registry/obo_context.jsonld: registry/ontologies.yml registry/obo_prefixes.ttl: registry/ontologies.yml ./util/make-shacl-prefixes.py $< > $@.tmp && mv $@.tmp $@ +# Download and extract Jena +$(RIOT): $(JENA_DIR)/bin/riot +$(JENA_DIR)/bin/riot: $(JENA_ARCHIVE) + tar -xzf $(JENA_ARCHIVE) + touch $@ + +$(JENA_ARCHIVE): + curl -fL $(JENA_URL) -o $(JENA_ARCHIVE) + # Use Apache-Jena RIOT to convert jsonld to n-triples # NOTE: UGLY HACK. If there is a problem then Jena will write WARN message (to stdout!!!), there appears to # be no way to get it to flag this even with strict and check options, so we do a check with grep, ugh. # see: http://stackoverflow.com/questions/20860222/why-do-i-have-these-warnings-with-jena-2-11-0 -registry/ontologies.nt: registry/ontologies.jsonld - riot --base=http://purl.obolibrary.org/obo/ --strict --check -q registry/context.jsonld $< > $@.tmp && mv $@.tmp $@ && egrep '(WARN|ERROR)' $@ && exit 1 || echo ok +registry/ontologies.nt: registry/ontologies.jsonld $(RIOT) + $(RIOT) --base=http://purl.obolibrary.org/obo/ --strict --check -q registry/context.jsonld $< > $@.tmp && mv $@.tmp $@ && egrep '(WARN|ERROR)' $@ && exit 1 || echo ok -registry/ontologies.ttl: registry/ontologies.nt - riot --base=http://purl.obolibrary.org/obo/ --out=ttl $< > $@.tmp && mv $@.tmp $@ +registry/ontologies.ttl: registry/ontologies.nt $(RIOT) + $(RIOT) --base=http://purl.obolibrary.org/obo/ --out=ttl $< > $@.tmp && mv $@.tmp $@ ### Validate Configuration Files From b7d47574f608dd77415dd79ba02944ffe66a7729 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Wed, 8 Apr 2026 08:02:34 +0200 Subject: [PATCH 2/2] Update Makefile --- Makefile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9e15f0ee8..d59428376 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,10 @@ JENA_VERSION := 6.0.0 JENA_DIR := apache-jena-$(JENA_VERSION) JENA_ARCHIVE := $(JENA_DIR).tar.gz JENA_URL := https://archive.apache.org/dist/jena/binaries/$(JENA_ARCHIVE) -RIOT := ./$(JENA_DIR)/bin/riot +LOCAL_RIOT := ./$(JENA_DIR)/bin/riot + +# Use system riot if available, otherwise fall back to local +RIOT := $(shell command -v riot 2>/dev/null || echo "$(LOCAL_RIOT)") ### Configuration @@ -108,15 +111,18 @@ registry/obo_context.jsonld: registry/ontologies.yml registry/obo_prefixes.ttl: registry/ontologies.yml ./util/make-shacl-prefixes.py $< > $@.tmp && mv $@.tmp $@ -# Download and extract Jena -$(RIOT): $(JENA_DIR)/bin/riot -$(JENA_DIR)/bin/riot: $(JENA_ARCHIVE) +# Only built if RIOT resolved to the local path +$(LOCAL_RIOT): $(JENA_ARCHIVE) tar -xzf $(JENA_ARCHIVE) touch $@ $(JENA_ARCHIVE): curl -fL $(JENA_URL) -o $(JENA_ARCHIVE) +# If RIOT is the system one, this is a no-op (file already exists) +$(shell command -v riot 2>/dev/null): + @true + # Use Apache-Jena RIOT to convert jsonld to n-triples # NOTE: UGLY HACK. If there is a problem then Jena will write WARN message (to stdout!!!), there appears to # be no way to get it to flag this even with strict and check options, so we do a check with grep, ugh.