Match existence queries exactly by default, and add an existence_match option - #152
Merged
apdavison merged 1 commit intoSep 29, 2026
Merged
Conversation
…h option The existence query used by exists() and save() filtered string properties with the KG's CONTAINS operator, so a new Dataset called FOO was identified with an existing one called FOO-BAR and silently overwrote it (#149). Existence queries now use EQUALS, which the KG applies case-insensitively but not whitespace-insensitively, so a stored name with a trailing space is no longer found by a local name without one. exists() and save() take a new existence_match argument, either "equals" (the default, matching name_matching.MATCH_TYPES) or "contains" to restore the old behaviour; save() passes it on to child objects. The save cache holds a match found with "contains" under a separate key, so that it is not later returned for an "equals" lookup. Collection.upload() does not expose the option and always matches exactly. The exact match is implemented by a new Equals filter value, the counterpart of Regex, which selects the EQUALS operator in place of CONTAINS. It is exported from fairgraph and documented in the API reference and the queries guide. A list of Equals values is not supported and falls back to CONTAINS, as for Regex (#150). MockKGClient in test/utils.py gained matching case-insensitive EQUALS handling.
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 #149