diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a2afcfe..40e9b382 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/LICENSE b/LICENSE index 2d8708d8..c4f0bc0c 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/pipeline/src/base.py b/pipeline/src/base.py index 0d624542..47d4d703 100644 --- a/pipeline/src/base.py +++ b/pipeline/src/base.py @@ -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 diff --git a/pipeline/src/codemeta.json b/pipeline/src/codemeta.json index 3626c93a..1d32f3a8 100644 --- a/pipeline/src/codemeta.json +++ b/pipeline/src/codemeta.json @@ -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" diff --git a/pipeline/src/collection.py b/pipeline/src/collection.py index bed68e67..123d51f8 100644 --- a/pipeline/src/collection.py +++ b/pipeline/src/collection.py @@ -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): """ diff --git a/pipeline/src/properties.py b/pipeline/src/properties.py index 71af6a48..ba432353 100644 --- a/pipeline/src/properties.py +++ b/pipeline/src/properties.py @@ -1,7 +1,7 @@ """ Representations of metadata fields/properties -# Copyright (c) 2023 openMetadataInitiative +# Copyright (c) 2025 openMetadataInitiative """ from datetime import datetime, date @@ -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,): diff --git a/pipeline/tests/test_collections.py b/pipeline/tests/test_collections.py index 0a784945..add5ddd7 100644 --- a/pipeline/tests/test_collections.py +++ b/pipeline/tests/test_collections.py @@ -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