Skip to content

Commit 348d4a7

Browse files
committed
corrections
1 parent 51bd3d9 commit 348d4a7

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

build.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848

4949
python_modules = defaultdict(list)
5050

51-
class_module_dict={}
52-
5351
for schema_version in schema_loader.get_schema_versions():
5452

5553
# Step 3 - find all involved schemas for the current version
@@ -58,10 +56,10 @@
5856
# Step 4a - figure out which schemas are embedded and which are linked
5957
embedded = set()
6058
linked = set()
61-
class_module_dict={}
59+
class_to_module_map = {}
6260
for schema_file_path in schemas_file_paths:
6361
emb, lnk = PythonBuilder(schema_file_path, schema_loader.schemas_sources).get_edges()
64-
class_module_dict=PythonBuilder(schema_file_path, schema_loader.schemas_sources).get_module_dict(class_module_dict)
62+
class_to_module_map=PythonBuilder(schema_file_path, schema_loader.schemas_sources).update_class_to_module_map(class_to_module_map)
6563
embedded.update(emb)
6664
linked.update(lnk)
6765
conflicts = linked.intersection(embedded)
@@ -81,7 +79,7 @@
8179
schema_loader.schemas_sources,
8280
instances=instances.get(schema_version, None),
8381
additional_methods=additional_methods,
84-
).build(embedded=embedded,class_module_dict=class_module_dict)
82+
).build(embedded=embedded,class_to_module_map=class_to_module_map)
8583

8684
parts = module_path.split(".")
8785
parent_path = ".".join(parts[:-1])

pipeline/src/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def to_jsonld(
7676
if self.type_.startswith("https://openminds.ebrains.eu/"):
7777
data["@context"] = {"@vocab": "https://openminds.ebrains.eu/vocab/"}
7878
else:
79-
data["@context"] = {"@vocab": "https://openminds.om-i.org/vocab/"}
79+
data["@context"] = {"@vocab": "https://openminds.om-i.org/props/"}
8080
if hasattr(self, "id") and self.id:
8181
data["@id"] = self.id
8282
for property in self.__class__.properties:

pipeline/src/collection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def save(self, path, individual_files=False, include_empty_properties=False):
8989
if node.type_.startswith("https://openminds.ebrains.eu/"):
9090
data_context = {"@vocab": "https://openminds.ebrains.eu/vocab/"}
9191
else:
92-
data_context = {"@vocab": "https://openminds.om-i.org/vocab/"}
92+
data_context = {"@vocab": "https://openminds.om-i.org/props/"}
9393

9494
for linked_node in node.links:
9595
self._add_node(linked_node)

pipeline/src/module_template.py.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class {{ class_name }}({{ base_class }}):
1616
"""
1717
type_ = "{{ openminds_type }}"
1818
context = {
19-
"@vocab": "https://openminds.om-i.org/vocab/"
19+
"@vocab": "https://openminds.om-i.org/props/"
2020
}
2121
schema_version = "{{ schema_version }}"
2222

pipeline/translator.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -262,19 +262,19 @@ def get_edges(self):
262262
linked.update(property.get("_linkedTypes", []))
263263
return embedded, linked
264264

265-
def get_module_dict(self,class_module_dict):
265+
def update_class_to_module_map(self,class_to_module_map):
266266
"""
267267
Updates a dictionary with the class name and its corresponding module based on the schemas.
268268
269269
This method extracts the class name and module from the `_schema_payload` attribute
270-
and updates the provided dictionary (`class_module_dict`) with a mapping of
270+
and updates the provided dictionary (`class_to_module_map`) with a mapping of
271271
the class name to its module. If the `_module` key exists in `_schema_payload`
272272
(which was introduced in version 4 of openMINDS), its value is used as the module.
273273
Otherwise, the module is derived from the second-to-last component of the `_type`
274274
field in `_schema_payload`.
275275
276276
Args:
277-
class_module_dict (dict): A dictionary where keys are class names and values
277+
class_to_module_map (dict): A dictionary where keys are class names and values
278278
are their corresponding modules.
279279
280280
Returns:
@@ -287,6 +287,6 @@ def get_module_dict(self,class_module_dict):
287287
else:
288288
module=schema_type.split("/")[-2]
289289

290-
class_module_dict[class_name]=module
290+
class_to_module_map[class_name]=module
291291

292-
return class_module_dict
292+
return class_to_module_map

0 commit comments

Comments
 (0)