Skip to content

feat(query): add typed bounded-reachability capability #193

Description

@ds1sqe

Summary

The typed query API can express fixed-hop relation chains, but not a
path with an explicit minimum and maximum depth. Selecting every
entity reachable through a recursive relation (e.g. all descendants
below one root through Composition(parent, child)) within a
caller-declared depth bound currently forces consumers into
client-side fallbacks: one request per hop, client-side joins, or
looping until no new nodes appear.

Proposed change

Add a bounded-path expression to the typed query API: bind a start
variable, an end variable, a relation type, ordered endpoint roles,
min_depth, and a finite max_depth, without degrading the inferred
Query[T] result type.

Acceptance criteria

  • Path identity, cycle handling, zero-length behavior,
    duplicate-path versus selected-row distinctness, subtype
    matching, and stable ordering are specified and covered by
    tests.
  • Invalid bounds fail at query construction, before any
    database I/O.
  • A test fixture schema with nested membership (depth >= 2,
    shared subtrees, and at least one cycle) verifies the distinct
    selected result set at each depth bound.
  • The Python bindings infer the exact typed result without Any,
    casts, or ignore directives.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions