Repository navigation
Conversation
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.
…dopts-stored-values # Conflicts: # test/test_openminds_core.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 (withexistence_match="contains"), the local object keeps its own value.modified_data()then reports the difference as a modification, andsave()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 andsave()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()orsave(), it is listed in the release notes under "Changes in behaviour".