Skip to content

[Subtask] Introduce query builder for composable graph filtering #221

@oxy86

Description

@oxy86

Overview

Introduce a query builder system that allows users to define complex filtering conditions using a structured interface instead of isolated dialogs.

This is the long-term UI and UX layer for the filtering system introduced in #215.


Motivation

Current filtering mechanisms are:

  • dialog-based
  • single-condition
  • not composable

Users need to express richer queries such as:

(type = "investor") AND (degree > 5) AND (weight ≥ 10)

This requires a unified and extensible query system.


Prerequisite: Arbitrary chip removal in the filter bar (#219)

The filter bar (#219) currently only allows ×-close on the most recently applied chip, because the snapshot/restore stack stores full visibility snapshots without recording which filter produced each entry. Closing an arbitrary chip would require replaying filters.

To fix this, the snapshot stack must associate a filter descriptor with each entry:

  • Extend GraphVisibilitySnapshot to store the FilterCondition (or a generic descriptor) that produced the snapshot.
  • When arbitrary chip removal is requested: pop all snapshots above the target, then re-apply the remaining filters in order using the stored descriptors.
  • This enables the filter bar to support true per-chip removal regardless of order.

This is a prerequisite for meaningful AND/OR logical composition.


Scope

Phase 0 — Arbitrary chip removal (prerequisite)

  • Extend GraphVisibilitySnapshot with a filter descriptor field
  • Implement replay-based removal: pop to target, re-apply remainder
  • Enable × on all filter bar chips (not just the most recent)

Phase 1 — Visual Query Builder (no-code)

  • UI to define conditions:
    • attribute / metric selector
    • operator (=, >, <, etc.)
    • value input
  • Support logical operators:
    • AND
    • OR

Phase 2 — Internal Query Representation

  • Define a query model (tree or expression-based)
  • Reusable across:
    • filtering
    • subgraph extraction
    • future features

Phase 3 — Optional DSL (advanced)

  • Simple textual query language

Example:

degree > 5 AND type = "investor"


Behavior

  • Queries act on:
    • nodes
    • edges
  • Results update graph visibility (non-destructive)

UI Suggestions

  • Dedicated "Filter / Query Panel"
  • Ability to:
    • add/remove conditions
    • group conditions
    • preview results

Implementation Notes


Edge Cases

  • Invalid queries
  • Type mismatches (string vs numeric)
  • Empty results

Relation to Feature

Part of:
#215 Graph filtering, querying & subgraph extraction

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions