Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ For more detail see #29.

- Update to latest openMINDS schemas and instances
- Internal import statements are now sorted alphabetically

## Release 0.3.0 (2025-04-09)

- Added release candidate for openMINDS v4
- Nodes in a collection are now sorted by ID.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 openMetadataInitiative
Copyright (c) 2025 openMetadataInitiative

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion pipeline/src/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This module contains base classes that define interfaces
and contain code common to sub-classes, to avoid code duplication.

# Copyright (c) 2023 openMetadataInitiative
# Copyright (c) 2025 openMetadataInitiative
"""

from __future__ import annotations
Expand Down
2 changes: 1 addition & 1 deletion pipeline/src/codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"programmingLanguage": ["Python"],
"operatingSystem": ["Linux", "Windows", "macOS"],
"softwareRequirements": [
"Python (version >=3.7)"
"Python (version >=3.8)"
],
"relatedLink": [
"https://openminds-documentation.readthedocs.io"
Expand Down
5 changes: 2 additions & 3 deletions pipeline/src/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ def _get_blank_node_identifier(self):
return fmt.format(identifier=identifier)

def _sort_nodes_by_id(self):
sorted_nodes=dict(sorted(self.nodes.items()))
self.nodes=sorted_nodes

sorted_nodes = dict(sorted(self.nodes.items()))
self.nodes = sorted_nodes

def save(self, path, individual_files=False, include_empty_properties=False):
"""
Expand Down
3 changes: 2 additions & 1 deletion pipeline/src/properties.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Representations of metadata fields/properties

# Copyright (c) 2023 openMetadataInitiative
# Copyright (c) 2025 openMetadataInitiative
"""

from datetime import datetime, date
Expand Down Expand Up @@ -163,6 +163,7 @@ def deserialize(self, data):
Args:
data: the JSON-LD data
"""

# todo: check data type
def deserialize_item(item):
if self.types == (str,):
Expand Down
34 changes: 12 additions & 22 deletions pipeline/tests/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,53 +82,43 @@ def test_collection_sort_by_id():
uni1 = omcore.Organization(full_name="University of This Place", id="_:002")
uni2 = omcore.Organization(full_name="University of That Place", id="_:001")
person.affiliations = [
omcore.Affiliation(member_of = uni1),
omcore.Affiliation(member_of = uni2),
omcore.Affiliation(member_of=uni1),
omcore.Affiliation(member_of=uni2),
]

c = Collection(person,uni1,uni2)
c = Collection(person, uni1, uni2)
output_paths = c.save("test_collection_sort_by_id.jsonld", individual_files=False, include_empty_properties=False)

assert output_paths == ["test_collection_sort_by_id.jsonld"]

with open(output_paths[0]) as fp:
saved_data = json.load(fp)
os.remove("test_collection_sort_by_id.jsonld")

expected_saved_data={
expected_saved_data = {
"@context": {"@vocab": "https://openminds.om-i.org/props/"},
"@graph": [
{
"@id": "_:001",
"@type": "https://openminds.om-i.org/types/Organization",
"fullName": "University of That Place"
"fullName": "University of That Place",
},
{
"@id": "_:002",
"@type": "https://openminds.om-i.org/types/Organization",
"fullName": "University of This Place"
"fullName": "University of This Place",
},
{
"@id": "_:004",
"@type": "https://openminds.om-i.org/types/Person",
"affiliation": [
{
"@type": "https://openminds.om-i.org/types/Affiliation",
"memberOf": {
"@id": "_:002"
}
},
{
"@type": "https://openminds.om-i.org/types/Affiliation",
"memberOf": {
"@id": "_:001"
}
}
{"@type": "https://openminds.om-i.org/types/Affiliation", "memberOf": {"@id": "_:002"}},
{"@type": "https://openminds.om-i.org/types/Affiliation", "memberOf": {"@id": "_:001"}},
],
"familyName": "Professor",
"givenName": "A"
}
]
"givenName": "A",
},
],
}

assert saved_data == expected_saved_data