Skip to main content
Guide
sub() starts an inline traversal that consumes the current stream. Use it for branching operations; use g() only for a top-level traversal entry.

Branching operations

Retain row-local values

Combine branches with bindings to keep one stable row shape across alternative paths. Bind the starting service, use optional and union sub-traversals to bind each candidate workload path, then project with projectDistinctBindings and coalesce. See Project correlated bindings.

Gate later entries

A batch condition runs an entry only when an earlier entry’s result meets a test. Add the entry with varAsIf / var_as_if instead of varAs. This request returns a user’s posts only when the user exists:
The condition serializes inside the named entry, not as a separate step. Other conditions test for an empty result (varEmpty), a minimum size (varMinSize), or the previous entry (prevNotEmpty). The first entry in a batch cannot depend on a previous result.

Bound recursive work

Recursive and fan-out operations must have application-level bounds. Prefer explicit depth, candidate, and response limits. A response limit does not necessarily bound all work performed before that operation.

Next steps

Projection and bindings

Emit stable rows from correlated paths.

Parameters

Bind values and bounds at request time.