Skip to content

Commit 2d08c3d

Browse files
committed
Include closure in monolithic builds
A follow-on patch will regenerate Make-managed files. References: * #155 Signed-off-by: Alex Nelson <[email protected]>
1 parent a312046 commit 2d08c3d

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

case_utils/ontology/Makefile

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,30 @@ $(case_srcdir)/.venv.done.log: \
4040
touch -c $@
4141
test -r $@
4242

43+
# Build monolith including transitive import closure outside of
44+
# CDO-maintained ontologies, removing need for network retrieval for
45+
# non-CDO class and property definitions.
4346
case-$(case_version).ttl: \
4447
$(case_srcdir)/.venv.done.log \
4548
$(RDF_TOOLKIT_JAR)
4649
$(MAKE) \
4750
--directory $(case_srcdir)/tests \
4851
case_monolithic.ttl
49-
cp \
50-
$(case_srcdir)/tests/case_monolithic.ttl \
51-
$@
52+
source $(case_srcdir)/venv/bin/activate \
53+
&& rdfpipe \
54+
--output-format turtle \
55+
$(case_srcdir)/tests/case_monolithic.ttl \
56+
$(uco_srcdir)/dependencies/collections-ontology/collections.owl \
57+
$(uco_srcdir)/dependencies/error/docs/current/error.ttl \
58+
> __$@
59+
java -jar $(RDF_TOOLKIT_JAR) \
60+
--inline-blank-nodes \
61+
--source __$@ \
62+
--source-format turtle \
63+
--target _$@ \
64+
--target-format turtle
65+
rm __$@
66+
mv _$@ $@
5267

5368
case-$(case_version)-subclasses.ttl: \
5469
case-$(case_version).ttl \

case_utils/ontology/src/subclasses_ttl.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
This script creates an excerpt of an ontology graph that consists solely of all rdfs:subClassOf statements.
1919
"""
2020

21-
__version__ = "0.1.1"
21+
__version__ = "0.2.0"
2222

2323
import argparse
2424

@@ -39,6 +39,10 @@ def main() -> None:
3939
in_graph.parse(in_ttl)
4040

4141
for triple in in_graph.triples((None, rdflib.RDFS.subClassOf, None)):
42+
# Avoid owl:Restrictions and set-complements, which would get
43+
# emitted as empty blank nodes.
44+
if isinstance(triple[2], rdflib.BNode):
45+
continue
4246
out_graph.add(triple)
4347

4448
out_graph.serialize(args.out_ttl)

0 commit comments

Comments
 (0)