Skip to content

Commit

Permalink
Integrate monolithic build into coverage test
Browse files Browse the repository at this point in the history
This addresses an issue where a subclass relationship not explicitly
noted in the profile graph gets missed when reviewing whether a
higher-level concept has been tested.

E.g. when reviewing the Endurant vs Perdurant proposal (UCO Issue 544),
had the following statements:

Profile graph:

```turtle
uco-core:Item
	rdfs:subClassOf drafting:Endurant ;
	.
```

Exemplars graph:

```turtle
kb:File-e364d7d2-25c8-4d4a-95d1-b03f73934e83
	a uco-observable:File ;
	.
```

Upstream, UCO contains subclass statements that tie `uco-observable:File`
to `uco-core:Item`, but the profiles graph did not contain those axioms.
So, the exemplars coverage test failed, reporting that `core:Item` had
not been demonstrated.

After this patch, exemplars coverage now respects all imported subclass
hierarchies.

References:
* ucoProject/UCO#544

Signed-off-by: Alex Nelson <[email protected]>
  • Loading branch information
ajnelson-nist committed Aug 15, 2023
1 parent 8859c6d commit 68a1454
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ all: \
touch $@

.pytest.done.log: \
$(profile_ttls) \
exemplars.ttl \
monolithic.ttl \
test_exemplar_coverage.py
source $(top_srcdir)/venv/bin/activate \
&& pytest \
Expand Down
6 changes: 5 additions & 1 deletion tests/test_exemplar_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def test_exemplar_coverage() -> None:
"""
exemplar_graph = Graph()
profile_graph = Graph()
tbox_graph = Graph()
combined_graph = Graph()

for filepath in (top_srcdir / "ontology").iterdir():
Expand All @@ -48,12 +49,15 @@ def test_exemplar_coverage() -> None:
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"
logging.debug("Loading exemplars graph %r.", exemplar_filepath)
exemplar_graph.parse(exemplar_filepath)
logging.debug("len(exemplar_graph) = %d.", len(exemplar_graph))

combined_graph = exemplar_graph + profile_graph
combined_graph = exemplar_graph + tbox_graph

classes_mapped: Set[URIRef] = set()
classes_with_exemplars: Set[URIRef] = set()
Expand Down

0 comments on commit 68a1454

Please sign in to comment.