Skip to content

Commit 8e83018

Browse files
committed
allow setting of @base via prefix _base
1 parent bea8840 commit 8e83018

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

linkml_runtime/dumpers/rdflib_dumper.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ def as_rdf_graph(self, element: YAMLRoot, schemaview: SchemaView, prefix_map: Di
4747
else:
4848
for prefix in schemaview.namespaces():
4949
g.bind(prefix, URIRef(schemaview.namespaces()[prefix]))
50-
if schemaview.namespaces()._base:
51-
g.base = schemaview.namespaces()._base
50+
# user can pass in base in prefixmap using '_base'. This gets set
51+
# in namespaces as a plain dict assignment - explicitly call the setter
52+
# to set the underlying "@base"
53+
if "_base" in schemaview.namespaces():
54+
schemaview.namespaces()._base = schemaview.namespaces()["_base"]
5255
self.inject_triples(element, schemaview, g)
5356
return g
5457

0 commit comments

Comments
 (0)