Skip to content

Adopt the stored value when an existence query matches inexactly - #181

Merged
apdavison merged 2 commits into
HumanBrainProject:masterfrom
apdavison:existence-match-adopts-stored-values
Oct 20, 2026
Merged

apdavison merged 2 commits into
HumanBrainProject:masterfrom
apdavison:existence-match-adopts-stored-values

Conversation

@apdavison

Copy link
Copy Markdown
Member

Fixes #170.

Currently, when an existence query matches a stored instance inexactly, i.e. the stored value differs from the local one in case (which existence_match="equals" ignores) or merely contains it (with existence_match="contains"), the local object keeps its own value. modified_data() then reports the difference as a modification, and save() writes the search term over the stored name. Only write permissions prevent it, so a curator, or a user whose match is in their own space, would rename the stored instance.

With this PR, after an existence match, each property in the existence query whose value is a string takes the stored value when the two differ only in a way the query ignores, so modified_data() is empty and save() does nothing. Other properties are not changed. This applies both when the KG is queried and when the match is found in the client's existence cache.

The KG's "contains" filter ignores case, as checked against pre-production. The mock KG used in the tests did not, and now does.

As this changes the object's attributes after exists() or save(), it is listed in the release notes under "Changes in behaviour".

When an existence query matches an object with a stored instance whose value differs from the local one only in case, or, with existence_match="contains", contains it, take the stored value. Previously, the local value counted as a modification, so save() wrote the search term over the stored name. Also make the mock KG's "contains" ignore case, as the real KG does.
@apdavison apdavison added the bug Something isn't working label Oct 20, 2026
@apdavison apdavison added this to the 0.16 milestone Oct 20, 2026
…dopts-stored-values

# Conflicts:
#	test/test_openminds_core.py
@apdavison
apdavison merged commit 368d2bd into HumanBrainProject:master Oct 20, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in fairgraph development Oct 20, 2026
@apdavison
apdavison deleted the existence-match-adopts-stored-values branch October 20, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Development

Successfully merging this pull request may close these issues.

save() overwrites a stored name with the search term when the existence query matches it inexactly

1 participant