Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
.venv-pre-commit
_*.*
__pycache__
generated-*
venv
92 changes: 54 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,27 @@ PYTHON3 ?= python3

all: \
.venv-pre-commit/var/.pre-commit-built.log \
all-ontology \
all-shapes
all-shapes \
all-tests

.PHONY: \
all-dependencies \
all-ontology \
all-shapes \
all-tests \
check-dependencies \
check-mypy \
check-ontology \
check-shapes \
check-supply-chain \
check-supply-chain-cdo-profile \
check-supply-chain-pre-commit \
check-supply-chain-submodules
check-supply-chain-submodules \
check-tests \
clean-dependencies \
clean-ontology \
clean-shapes \
clean-tests

# This Make target should be left in place, even if it does nothing. It
# has been found beneficial with profiles that have a submodule-based
Expand All @@ -53,7 +59,7 @@ all: \
# profile builds on a UCO profile.
$(MAKE) \
--directory dependencies/UCO-Profile-Example \
.git_submodule_init_imports.done.log
.git_submodule_init.done.log
$(MAKE) \
--directory dependencies/CASE \
.git_submodule_init.done.log \
Expand Down Expand Up @@ -103,33 +109,28 @@ all-dependencies: \
.git_submodule_init.done.log \
.venv.done.log
$(MAKE) \
PYTHON3=$(PYTHON3) \
--directory dependencies

all-ontology: \
all-dependencies
$(MAKE) \
--directory ontology

# NOTE: For profiles that don't include shapes, the $(top_srcdir)/shapes
# directory might be missing. Checking for its existence first relieves
# each profile of needing to modify the top Makefile when removing
# shapes.
all-shapes: \
all-dependencies
test ! -d shapes \
|| $(MAKE) \
--directory shapes
all-ontology
$(MAKE) \
--directory shapes

all-tests: \
all-ontology
$(MAKE) \
--directory tests

check: \
.venv-pre-commit/var/.pre-commit-built.log \
check-mypy \
check-dependencies \
check-ontology \
check-shapes
$(MAKE) \
PYTHON3=$(PYTHON3) \
--directory tests \
check
check-tests

check-dependencies: \
all-dependencies
Expand All @@ -147,21 +148,18 @@ check-mypy: \
.

check-ontology: \
all-ontology
all-ontology \
check-dependencies
$(MAKE) \
--directory ontology \
check

# NOTE: For profiles that don't include shapes, the $(top_srcdir)/shapes
# directory might be missing. Checking for its existence first relieves
# each profile of needing to modify the top Makefile when removing
# shapes.
check-shapes: \
all-shapes
test ! -d shapes \
|| $(MAKE) \
--directory shapes \
check
all-shapes \
check-ontology
$(MAKE) \
--directory shapes \
check

# This target's dependencies potentially modify the working directory's
# Git state, so it is intentionally not a dependency of check.
Expand Down Expand Up @@ -228,19 +226,37 @@ check-supply-chain-submodules: \
--ignore-submodules=dirty \
dependencies

clean:
@$(MAKE) \
check-tests: \
all-tests \
check-shapes
$(MAKE) \
--directory tests \
check

clean: \
clean-tests \
clean-shapes \
clean-ontology \
clean-dependencies
@rm -f \
.*.done.log

clean-dependencies:
@$(MAKE) \
--directory dependencies \
clean
@test ! -d shapes \
|| $(MAKE) \
--directory shapes \
clean

clean-ontology:
@$(MAKE) \
--directory ontology \
clean

clean-shapes:
@$(MAKE) \
--directory dependencies \
--directory shapes \
clean

clean-tests:
@$(MAKE) \
--directory tests \
clean
@rm -f \
.*.done.log
71 changes: 13 additions & 58 deletions dependencies/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,71 +16,26 @@

SHELL := /bin/bash

top_srcdir := $(shell cd .. ; pwd)
PYTHON3 ?= python3

case_srcdir := CASE

uco_srcdir := $(case_srcdir)/dependencies/UCO

RDF_TOOLKIT_JAR := $(uco_srcdir)/lib/rdf-toolkit.jar

all: \
catalog-v001.xml
$(case_srcdir)/tests/case_monolithic.ttl

$(RDF_TOOLKIT_JAR):
@echo "DEBUG:dependencies/Makefile:top_srcdir=$(top_srcdir)" >&2
@echo "ERROR:dependencies/Makefile:rdf-toolkit.jar not found. Did you run `make` from the top source directory?" >&2
@test -r $@
$(case_srcdir)/.venv.done.log:
$(MAKE) \
PYTHON3=$(PYTHON3) \
--directory $(case_srcdir) \
.venv.done.log

catalog-v001.xml: \
$(case_srcdir)/ontology/master/catalog-v001.xml \
$(top_srcdir)/.venv.done.log \
$(top_srcdir)/etc/domain_directories.tsv \
$(top_srcdir)/etc/dependency_files.tsv \
$(uco_srcdir)/src/create-catalog-v001.xml.py \
imports-transitive.ttl
rm -f _$@
source $(top_srcdir)/venv/bin/activate \
&& python3 $(uco_srcdir)/src/create-catalog-v001.xml.py \
--catalog-xml $(case_srcdir)/ontology/master/catalog-v001.xml \
_$@ \
$(top_srcdir)/etc/domain_directories.tsv \
$(top_srcdir)/etc/dependency_files.tsv \
"$(top_srcdir)" \
imports-transitive.ttl
mv _$@ $@
$(case_srcdir)/tests/case_monolithic.ttl: \
$(case_srcdir)/.venv.done.log
$(MAKE) \
--directory $(case_srcdir)/tests \
case_monolithic.ttl

check: \
catalog-v001.xml
all

# TODO: This recipe deletes files generated by Make. The line deleting
# example.ttl should be adapted.
clean:
@rm -f \
catalog-v001.xml \
imports-transitive.ttl

# This recipe intentionally does not incorporate CDO ontologies (UCO,
# CASE, etc.), to avoid redundant imports between multiple profiles.
# TODO: Adapt this recipe to depend instead on the normalized file, as
# well as any profile submodules' imports-transitive files.
# Note that the piping command, analagous to the concatenate ('cat')
# command but for RDF graph files, will combine all recipe dependencies
# into one file, using the $^ ("all dependencies") Make variable.
imports-transitive.ttl: \
UCO-Profile-Example/dependencies/example.ttl \
UCO-Profile-Example/dependencies/imports-transitive.ttl \
UCO-Profile-Example/ontology/uco-example.ttl
source $(top_srcdir)/venv/bin/activate \
&& rdfpipe \
--output-format turtle \
$^ \
> __$@
java -jar $(RDF_TOOLKIT_JAR) \
--inline-blank-nodes \
--source __$@ \
--source-format turtle \
--target _$@ \
--target-format turtle
rm __$@
mv _$@ $@
26 changes: 0 additions & 26 deletions dependencies/catalog-v001.xml

This file was deleted.

32 changes: 0 additions & 32 deletions dependencies/imports-transitive.ttl

This file was deleted.

3 changes: 2 additions & 1 deletion etc/dependency_files.tsv
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
http://example.org/ontology/example/0.0.1 ${top_srcdir}/dependencies/UCO-Profile-Example/dependencies/example.ttl
http://example.org/ontology/example/0.0.1 ${top_srcdir}/dependencies/UCO-Profile-Example/dependencies/CDO-Shapes-Example/dependencies/formatted-example.ttl
http://example.org/ontology/uco-example ${top_srcdir}/dependencies/UCO-Profile-Example/ontology/uco-example.ttl
http://example.org/shapes/sh-case-example ${top_srcdir}/shapes/sh-case-example.ttl
http://example.org/shapes/sh-example ${top_srcdir}/dependencies/UCO-Profile-Example/dependencies/CDO-Shapes-Example/shapes/sh-example.ttl
http://example.org/shapes/sh-uco-example ${top_srcdir}/dependencies/UCO-Profile-Example/shapes/sh-uco-example.ttl
5 changes: 5 additions & 0 deletions ontology/.empty.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

Loading