Skip to content

Represent "contains" filters explicitly, with a Contains class - #182

Merged
apdavison merged 1 commit into
HumanBrainProject:masterfrom
apdavison:explicit-contains-filter
Oct 20, 2026
Merged

apdavison merged 1 commit into
HumanBrainProject:masterfrom
apdavison:explicit-contains-filter

Conversation

@apdavison

Copy link
Copy Markdown
Member

Currently, a filter on a text property can be given as an Equals (the KG's EQUALS operator) or a Regex (REGEX), but the default, CONTAINS, has no class of its own: it is what a plain string does. The documentation therefore describes Equals and Regex each in terms of "a plain string", rather than presenting the three ways of matching text together.

With this PR, there is a Contains class alongside Equals and Regex (exported from fairgraph), and a plain string given as the filter value for a text property is converted to a Contains, so every text filter is explicit internally. The existence query uses Contains with existence_match="contains", as it already uses Equals with "equals". Values for other properties (ids of linked nodes, IRIs, dates, numbers) are left as they are.

A plain string means the same as before, so nothing changes for existing code: the golden query tests pass unchanged. The user guide now introduces the three filter classes together.

Add a Contains class alongside Equals and Regex, so that all three ways of matching text in a filter can be written explicitly, and convert a plain string given as the filter value for a text property into a Contains. A plain string means the same as before, so no generated query changes.
@apdavison apdavison added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 20, 2026
@apdavison apdavison added this to the 0.16 milestone Oct 20, 2026
@apdavison
apdavison merged commit 00e2735 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 explicit-contains-filter branch October 20, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

1 participant