Skip to content

Commit 01a73f2

Browse files
committed
collection having appropriate context
1 parent 4a74803 commit 01a73f2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pipeline/src/collection.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ def save(self, path, individual_files=False, include_empty_properties=False):
8585
# we first re-add all child nodes to the collection.
8686
# This is probably not the most elegant or fast way to do this, but it is simple and robust.
8787
for node in tuple(self.nodes.values()):
88+
89+
if node.type_.startswith("https://openminds.ebrains.eu/"):
90+
data_context = {"@vocab": "https://openminds.ebrains.eu/vocab/"}
91+
else:
92+
data_context = {"@vocab": "https://openminds.om-i.org/vocab/"}
93+
8894
for linked_node in node.links:
8995
self._add_node(linked_node)
9096
# Now we can actually save the nodes
@@ -97,7 +103,7 @@ def save(self, path, individual_files=False, include_empty_properties=False):
97103
if parent_dir:
98104
os.makedirs(parent_dir, exist_ok=True)
99105
data = {
100-
"@context": {"@vocab": "https://openminds.ebrains.eu/vocab/"},
106+
"@context": data_context,
101107
"@graph": [
102108
node.to_jsonld(
103109
embed_linked_nodes=False, include_empty_properties=include_empty_properties, with_context=False

0 commit comments

Comments
 (0)