diff --git a/.gitignore b/.gitignore index da4d127..7430e87 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ .venv-pre-commit _*.* __pycache__ +generated-* venv diff --git a/Makefile b/Makefile index 0af62de..3d535a8 100644 --- a/Makefile +++ b/Makefile @@ -20,13 +20,14 @@ 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 \ @@ -34,7 +35,12 @@ all: \ 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 @@ -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 \ @@ -103,6 +109,7 @@ all-dependencies: \ .git_submodule_init.done.log \ .venv.done.log $(MAKE) \ + PYTHON3=$(PYTHON3) \ --directory dependencies all-ontology: \ @@ -110,26 +117,20 @@ all-ontology: \ $(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 @@ -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. @@ -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 diff --git a/dependencies/Makefile b/dependencies/Makefile index 5cdc1f1..3cb801b 100644 --- a/dependencies/Makefile +++ b/dependencies/Makefile @@ -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 _$@ $@ diff --git a/dependencies/UCO-Profile-Example b/dependencies/UCO-Profile-Example index 1987d5f..8ea4bf6 160000 --- a/dependencies/UCO-Profile-Example +++ b/dependencies/UCO-Profile-Example @@ -1 +1 @@ -Subproject commit 1987d5ffaf55b6ccc703ec7fac8d46db41854f28 +Subproject commit 8ea4bf6ed9e78561e290e433e42578d57ce7f66c diff --git a/dependencies/catalog-v001.xml b/dependencies/catalog-v001.xml deleted file mode 100644 index 5e64e00..0000000 --- a/dependencies/catalog-v001.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dependencies/imports-transitive.ttl b/dependencies/imports-transitive.ttl deleted file mode 100644 index 4d74e10..0000000 --- a/dependencies/imports-transitive.ttl +++ /dev/null @@ -1,32 +0,0 @@ -# imports: http://example.org/ontology/example/0.0.1 -# imports: https://ontology.unifiedcyberontology.org/uco/uco/1.4.0 - -@prefix ex: . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix uco-core: . -@prefix xs: . - - - a owl:Ontology ; - owl:versionIRI ex:0.0.1 ; - . - - - a owl:Ontology ; - owl:imports - ex:0.0.1 , - - ; - . - -ex:Object - a owl:Class ; - rdfs:subClassOf owl:Thing ; - . - -uco-core:UcoObject - rdfs:subClassOf ex:Object ; - . - diff --git a/etc/dependency_files.tsv b/etc/dependency_files.tsv index 95e6e78..e5cd9f8 100644 --- a/etc/dependency_files.tsv +++ b/etc/dependency_files.tsv @@ -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 diff --git a/ontology/.empty.ttl b/ontology/.empty.ttl new file mode 100644 index 0000000..895b243 --- /dev/null +++ b/ontology/.empty.ttl @@ -0,0 +1,5 @@ +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . + diff --git a/ontology/Makefile b/ontology/Makefile index 888b4a2..60c93b2 100644 --- a/ontology/Makefile +++ b/ontology/Makefile @@ -22,17 +22,26 @@ case_srcdir := $(top_srcdir)/dependencies/CASE uco_srcdir := $(case_srcdir)/dependencies/UCO +generated_dependencies_ttls := \ + $(top_srcdir)/dependencies/UCO-Profile-Example/dependencies/CDO-Shapes-Example/dependencies/formatted-example.ttl \ + $(case_srcdir)/tests/case_monolithic.ttl + test_pys := $(wildcard test_*.py) -ttl_basenames := $(wildcard case-*.ttl) +ttl_basenames := $(wildcard uco-*.ttl) all: \ catalog-v001.xml +# .empty.ttl is retained to guarantee rdfpipe takes at least one file as +# an input when building generated-dependencies.ttl and -local.ttl. +.empty.ttl: + test -r $@ + .pytest.done.log: \ $(test_pys) \ $(top_srcdir)/.venv.done.log \ - $(ttl_basenames) + generated-local.ttl source $(top_srcdir)/venv/bin/activate \ && pytest \ --log-level=DEBUG @@ -43,8 +52,8 @@ catalog-v001.xml: \ $(top_srcdir)/.venv.done.log \ $(top_srcdir)/etc/domain_directories.tsv \ $(top_srcdir)/etc/dependency_files.tsv \ - $(ttl_basenames) \ - $(uco_srcdir)/src/create-catalog-v001.xml.py + $(uco_srcdir)/src/create-catalog-v001.xml.py \ + generated-ontology.ttl rm -f _$@ source $(top_srcdir)/venv/bin/activate \ && python3 $(uco_srcdir)/src/create-catalog-v001.xml.py \ @@ -53,12 +62,12 @@ catalog-v001.xml: \ $(top_srcdir)/etc/domain_directories.tsv \ $(top_srcdir)/etc/dependency_files.tsv \ "$(top_srcdir)" \ - $(ttl_basenames) + generated-ontology.ttl mv _$@ $@ check: \ .pytest.done.log \ - catalog-v001.xml + all clean: @rm -rf \ @@ -66,4 +75,53 @@ clean: @rm -f \ .*.done.log \ _* \ - catalog-v001.xml + catalog-v001.xml \ + generated-*.ttl + +generated-dependencies.ttl: \ + $(generated_dependencies_ttls) \ + $(top_srcdir)/.venv.done.log \ + $(uco_srcdir)/ontology/owl/owl.ttl \ + .empty.ttl + source $(top_srcdir)/venv/bin/activate \ + && rdfpipe \ + --output-format turtle \ + $(generated_dependencies_ttls) \ + .empty.ttl \ + > _$@ + # Check for conflicts when merging ontology files. + source $(top_srcdir)/venv/bin/activate \ + && pyshacl \ + --shacl $(uco_srcdir)/ontology/owl/owl.ttl \ + _$@ + mv _$@ $@ + +# OWL shapes not run against this file, as there may be axioms needed +# from generated-dependencies.ttl. +generated-local.ttl: \ + $(top_srcdir)/.venv.done.log \ + $(ttl_basenames) \ + .empty.ttl + source $(top_srcdir)/venv/bin/activate \ + && rdfpipe \ + --output-format turtle \ + $(ttl_basenames) \ + .empty.ttl \ + > _$@ + mv _$@ $@ + +generated-ontology.ttl: \ + generated-dependencies.ttl \ + generated-local.ttl + source $(top_srcdir)/venv/bin/activate \ + && rdfpipe \ + --output-format turtle \ + generated-dependencies.ttl \ + generated-local.ttl \ + > _$@ + # Check for conflicts when merging ontology files. + source $(top_srcdir)/venv/bin/activate \ + && pyshacl \ + --shacl $(uco_srcdir)/ontology/owl/owl.ttl \ + _$@ + mv _$@ $@ diff --git a/ontology/catalog-v001.xml b/ontology/catalog-v001.xml index d2bbc08..efa28c4 100644 --- a/ontology/catalog-v001.xml +++ b/ontology/catalog-v001.xml @@ -2,28 +2,46 @@ + + + + + + + + + + + + + + + + + + + - + + - - - + diff --git a/ontology/test_disjointedness_symmetry.py b/ontology/test_disjointedness_symmetry.py index f561725..e758e1f 100644 --- a/ontology/test_disjointedness_symmetry.py +++ b/ontology/test_disjointedness_symmetry.py @@ -34,16 +34,7 @@ def test_disjointedness_symmetry() -> None: computed: set[tuple[URIRef, URIRef]] = set() profile_graph = Graph() - for filepath in (srcdir).iterdir(): - if filepath.name.startswith("_"): - # Skip temporary build artifacts. - continue - if filepath.name.startswith("."): - # Skip quality control test artifacts. - continue - if filepath.name.endswith(".ttl"): - logging.debug("Loading profile graph %r.", filepath) - profile_graph.parse(filepath) + profile_graph.parse(srcdir / "generated-local.ttl") logging.debug("len(profile_graph) = %d.", len(profile_graph)) for triple in profile_graph.triples((None, NS_OWL.disjointWith, None)): diff --git a/shapes/.empty.ttl b/shapes/.empty.ttl new file mode 100644 index 0000000..895b243 --- /dev/null +++ b/shapes/.empty.ttl @@ -0,0 +1,5 @@ +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . + diff --git a/shapes/Makefile b/shapes/Makefile index a7a7cee..06a0df2 100644 --- a/shapes/Makefile +++ b/shapes/Makefile @@ -24,6 +24,13 @@ uco_srcdir := $(case_srcdir)/dependencies/UCO test_pys := $(wildcard test_*.py) +# This list is all of the graph files that contain shapes graphs linked +# by owl:imports, including UCO. Non-shapes graphs are delegated to +# ../ontology/generated-dependencies.ttl. +generated_dependencies_ttls := \ + $(top_srcdir)/dependencies/UCO-Profile-Example/dependencies/CDO-Shapes-Example/shapes/sh-example.ttl \ + $(case_srcdir)/tests/case_monolithic.ttl + ttl_basenames := $(wildcard sh-*.ttl) all: \ @@ -46,8 +53,8 @@ catalog-v001.xml: \ $(top_srcdir)/.venv.done.log \ $(top_srcdir)/etc/domain_directories.tsv \ $(top_srcdir)/etc/dependency_files.tsv \ - $(ttl_basenames) \ - $(uco_srcdir)/src/create-catalog-v001.xml.py + $(uco_srcdir)/src/create-catalog-v001.xml.py \ + generated-shapes.ttl rm -f _$@ source $(top_srcdir)/venv/bin/activate \ && python3 $(uco_srcdir)/src/create-catalog-v001.xml.py \ @@ -56,7 +63,7 @@ catalog-v001.xml: \ $(top_srcdir)/etc/domain_directories.tsv \ $(top_srcdir)/etc/dependency_files.tsv \ "$(top_srcdir)" \ - $(ttl_basenames) + generated-shapes.ttl mv _$@ $@ check: \ @@ -69,4 +76,56 @@ clean: @rm -f \ .*.done.log \ _* \ - catalog-v001.xml + catalog-v001.xml \ + generated-* + +generated-dependencies.ttl: \ + $(generated_dependencies_ttls) \ + $(top_srcdir)/.venv.done.log \ + $(top_srcdir)/ontology/generated-dependencies.ttl \ + .empty.ttl + source $(top_srcdir)/venv/bin/activate \ + && rdfpipe \ + --output-format turtle \ + $(generated_dependencies_ttls) \ + .empty.ttl \ + > _$@ + # Check for conflicts when merging shape files. + source $(top_srcdir)/venv/bin/activate \ + && pyshacl \ + --metashacl \ + --ont-graph $(top_srcdir)/ontology/generated-dependencies.ttl \ + --shacl _$@ \ + .empty.ttl + mv _$@ $@ + +generated-local.ttl: \ + $(top_srcdir)/.venv.done.log \ + $(ttl_basenames) \ + .empty.ttl + source $(top_srcdir)/venv/bin/activate \ + && rdfpipe \ + --output-format turtle \ + $(ttl_basenames) \ + .empty.ttl \ + > _$@ + mv _$@ $@ + +generated-shapes.ttl: \ + $(top_srcdir)/ontology/generated-ontology.ttl \ + generated-dependencies.ttl \ + generated-local.ttl + source $(top_srcdir)/venv/bin/activate \ + && rdfpipe \ + --output-format turtle \ + generated-dependencies.ttl \ + generated-local.ttl \ + > _$@ + # Check for conflicts when merging shape files. + source $(top_srcdir)/venv/bin/activate \ + && pyshacl \ + --metashacl \ + --ont-graph $(top_srcdir)/ontology/generated-ontology.ttl \ + --shacl _$@ \ + .empty.ttl + mv _$@ $@ diff --git a/shapes/catalog-v001.xml b/shapes/catalog-v001.xml index 91f93dd..d7e8644 100644 --- a/shapes/catalog-v001.xml +++ b/shapes/catalog-v001.xml @@ -2,28 +2,50 @@ + + + + + + + + + + + + + + + + + + + + + - + + diff --git a/tests/.gitignore b/tests/.gitignore deleted file mode 100644 index 4a2adca..0000000 --- a/tests/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -exemplars-entailment.ttl -exemplars-expanded.ttl -monolithic.ttl diff --git a/tests/Makefile b/tests/Makefile index 6132a08..3cb077b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -16,8 +16,6 @@ SHELL := /bin/bash -PYTHON3 ?= python3 - top_srcdir := $(shell cd .. ; pwd) case_srcdir := $(top_srcdir)/dependencies/CASE @@ -26,34 +24,32 @@ uco_srcdir := $(case_srcdir)/dependencies/UCO test_pys := $(wildcard test_*.py) -profile_ttls := $(wildcard $(top_srcdir)/ontology/uco-*.ttl) - -shape_ttls := $(wildcard $(top_srcdir)/shapes/sh-*.ttl) - all: \ - monolithic.ttl + generated-exemplars-expanded.ttl .pyshacl.done.log: \ - exemplars-expanded.ttl \ - monolithic.ttl + $(top_srcdir)/ontology/generated-ontology.ttl \ + $(top_srcdir)/shapes/generated-shapes.ttl \ + generated-exemplars-expanded.ttl source $(top_srcdir)/venv/bin/activate \ && pyshacl \ - --metashacl \ - --ont-graph monolithic.ttl \ - --shacl monolithic.ttl \ - exemplars-expanded.ttl + --ont-graph $(top_srcdir)/ontology/generated-ontology.ttl \ + --shacl $(top_srcdir)/shapes/generated-shapes.ttl \ + generated-exemplars-expanded.ttl touch $@ .pytest.done.log: \ $(test_pys) \ - exemplars.ttl \ - monolithic.ttl + $(top_srcdir)/ontology/generated-local.ttl \ + $(top_srcdir)/ontology/generated-ontology.ttl \ + exemplars.ttl source $(top_srcdir)/venv/bin/activate \ && pytest \ --log-level=DEBUG touch $@ check: \ + generated-monolithic.ttl \ .pytest.done.log \ .pyshacl.done.log @@ -62,24 +58,22 @@ clean: __pycache__ @rm -f \ .*.done.log \ - exemplars-entailment.ttl \ - exemplars-expanded.ttl \ - monolithic.ttl + generated-* -exemplars-entailment.ttl: \ +generated-exemplars-entailment.ttl: \ $(top_srcdir)/.venv.done.log \ + $(top_srcdir)/ontology/generated-ontology.ttl \ $(top_srcdir)/src/entail.py \ - exemplars.ttl \ - monolithic.ttl + exemplars.ttl source $(top_srcdir)/venv/bin/activate \ && python3 $(top_srcdir)/src/entail.py \ _$@ \ exemplars.ttl \ - monolithic.ttl + $(top_srcdir)/ontology/generated-ontology.ttl mv _$@ $@ -exemplars-expanded.ttl: \ - exemplars-entailment.ttl +generated-exemplars-expanded.ttl: \ + generated-exemplars-entailment.ttl source $(top_srcdir)/venv/bin/activate \ && rdfpipe \ --output-format turtle \ @@ -88,27 +82,17 @@ exemplars-expanded.ttl: \ > _$@ mv _$@ $@ -monolithic.ttl: \ +# Cross-review OWL and SHACL specifications together. +generated-monolithic.ttl: \ $(top_srcdir)/.venv.done.log \ - $(top_srcdir)/dependencies/imports-transitive.ttl \ - $(profile_ttls) \ - $(shape_ttls) - $(MAKE) \ - PYTHON3=$(PYTHON3) \ - --directory $(case_srcdir) \ - .venv.done.log - $(MAKE) \ - --directory $(case_srcdir)/tests \ - case_monolithic.ttl + $(top_srcdir)/ontology/generated-ontology.ttl \ + $(top_srcdir)/shapes/generated-shapes.ttl \ + $(uco_srcdir)/ontology/owl/owl.ttl source $(top_srcdir)/venv/bin/activate \ && rdfpipe \ --output-format turtle \ - $(top_srcdir)/dependencies/imports-transitive.ttl \ - $(profile_ttls) \ - $(shape_ttls) \ - $(uco_srcdir)/dependencies/collections-ontology/collections.owl \ - $(uco_srcdir)/dependencies/error/docs/current/error.ttl \ - $(case_srcdir)/tests/case_monolithic.ttl \ + $(top_srcdir)/ontology/generated-ontology.ttl \ + $(top_srcdir)/shapes/generated-shapes.ttl \ > _$@ source $(top_srcdir)/venv/bin/activate \ && pyshacl \ diff --git a/tests/test_exemplar_coverage.py b/tests/test_exemplar_coverage.py index 4a765f1..ed3daed 100644 --- a/tests/test_exemplar_coverage.py +++ b/tests/test_exemplar_coverage.py @@ -28,38 +28,40 @@ top_srcdir = srcdir.parent -def test_exemplar_coverage() -> None: +def test_exemplar_profile_coverage() -> None: """ This test confirms that for each class C in the profile ontology (or ontologies) designated a class, or a subclass of some C'; and each property P designated a property, or a subproperty of some P'; C (/P) is used in the exemplars graph. + + The transitive import closure of the ontology graph is brought in + for subclass and subproperty entailment. But, only concepts locally + defined and/or mapped in this repository are checked for review- + subjects. (Else, each dependent ontology graphs would also incur + review-subject needs.) """ exemplar_graph = Graph() profile_graph = Graph() tbox_graph = Graph() combined_graph = Graph() - for filepath in (top_srcdir / "ontology").iterdir(): - if filepath.name.startswith("_"): - # Skip temporary build artifacts. - continue - if filepath.name.startswith("."): - # Skip quality control test artifacts. - continue - if filepath.name.endswith(".ttl"): - logging.debug("Loading profile graph %r.", filepath) - profile_graph.parse(filepath) - logging.debug("len(profile_graph) = %d.", len(profile_graph)) - - monolithic_filepath = srcdir / "monolithic.ttl" - tbox_graph.parse(monolithic_filepath) - exemplar_filepath = srcdir / "exemplars.ttl" + ontology_filepath = top_srcdir / "ontology" / "generated-ontology.ttl" + profile_filepath = top_srcdir / "ontology" / "generated-local.ttl" + logging.debug("Loading exemplars graph %r.", exemplar_filepath) exemplar_graph.parse(exemplar_filepath) logging.debug("len(exemplar_graph) = %d.", len(exemplar_graph)) + logging.debug("Loading TBox graph %r.", ontology_filepath) + tbox_graph.parse(ontology_filepath) + logging.debug("len(tbox_graph) = %d.", len(tbox_graph)) + + logging.debug("Loading profile graph %r.", profile_filepath) + profile_graph.parse(profile_filepath) + logging.debug("len(profile_graph) = %d.", len(profile_graph)) + combined_graph = exemplar_graph + tbox_graph classes_mapped: Set[URIRef] = set()