Skip to content

Commit

Permalink
propagate namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
gtfierro committed Sep 16, 2024
1 parent c63d593 commit 2d04f9e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
for f in args.input:
graph.parse(f, format=rdflib.util.guess_format(f))

namespaces = dict(graph.namespace_manager.namespaces())

s223 = rdflib.Graph()
if args.do_import:
s223.parse("ontologies/223p.ttl")
namespaces.update(dict(s223.namespace_manager.namespaces()))

# remove QUDT prefix because it breaks things
#graph.bind("qudtprefix21", rdflib.Namespace("http://qudt.org/2.1/vocab/prefix/"))
Expand All @@ -46,6 +48,8 @@
print(report)
raise Exception("Validation failed: {}".format(report))
if args.output:
for prefix, uri in namespaces.items():
graph.bind(prefix, uri)
graph.serialize(args.output, format="turtle")
else:
print(graph.serialize(format="turtle"))

0 comments on commit 2d04f9e

Please sign in to comment.