Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ share/python-wheels/
*.egg
MANIFEST
node_modules/
apache-jena-*.tar.gz
apache-jena-*/
30 changes: 25 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
# 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)
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

Expand All @@ -51,7 +59,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


Expand Down Expand Up @@ -103,15 +111,27 @@ registry/obo_context.jsonld: registry/ontologies.yml
registry/obo_prefixes.ttl: registry/ontologies.yml
./util/make-shacl-prefixes.py $< > $@.tmp && mv $@.tmp $@

# 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.
# 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

Expand Down
Loading