diff --git a/CHANGELOG.md b/CHANGELOG.md index 14557c2..10d0b85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 5.5.1 (2026-03-10) + +## Improvements + +- Ensure uniform annotation structures when records are stored. + + # 5.5.0 (2026-02-19) ## New features diff --git a/dump_things_service/store/model_store.py b/dump_things_service/store/model_store.py index 2af9c86..2242abc 100644 --- a/dump_things_service/store/model_store.py +++ b/dump_things_service/store/model_store.py @@ -98,13 +98,19 @@ class _ModelStore: submitter: str, ) -> None: """Add submitter IRI to the record annotations, use CURIE if possible""" - if 'annotations' not in json_object: - json_object['annotations'] = {} + json_object['annotations'] = self.homogenize_annotations(json_object) submitter_curie_or_iri = self.get_curie(self.tags['id']) time_curie_or_iri = self.get_curie(self.tags['time']) json_object['annotations'][submitter_curie_or_iri] = submitter json_object['annotations'][time_curie_or_iri] = datetime.now().isoformat() + @staticmethod + def homogenize_annotations(json_object) -> dict: + return { + k: v['annotation_value'] if isinstance(v, dict) else v + for k, v in json_object.get('annotations', {}).items() + } + def get_curie( self, curie_or_iri: str, diff --git a/pyproject.toml b/pyproject.toml index 1d5d155..f852c96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ dependencies = [ "fastapi[standard]", "fastapi-pagination", "fsspec", - "linkml", + "linkml>=1.10.0", "pydantic", "PyYAML", "rdflib",