POST /revisions/:id/data/query (Command: query_session_graph)
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
engine | string | Yes | Must be workflow_blobhub. |
command | string | Yes | Must be query_session_graph. |
session_id | string | Yes | The ID of the session that owns the graph envelope. |
alias | string | Yes | Alias of the graph session object. |
query | object | Yes | Traversal query AST. See structure below. |
Query AST
Thequery object has two fields:
| Field | Type | Required | Description |
|---|---|---|---|
start | array | Yes | Selects the initial working set. |
steps | array of arrays | No | Ordered traversal steps. Defaults to []. |
start — a list of one or two elements: ["V"], ["E"], ["V", "<id>"], or ["E", "<id>"].
"V"— start from all vertices in the graph (no id) or a single vertex by id."E"— start from all edges in the graph (no id) or a single edge by id.
steps — each step is a non-empty list where the first element is the step name and the
remaining elements are its arguments:
| Step name | Arguments | Description |
|---|---|---|
out | type? (string) | Follow outgoing edges; optionally filter by edge label. |
in | type? (string) | Follow incoming edges; optionally filter by edge label. |
both | type? (string) | Follow edges in both directions; optionally filter by edge label. |
outE | type? (string) | Move to outgoing edge elements (instead of neighbor vertices). |
inE | type? (string) | Move to incoming edge elements. |
bothE | type? (string) | Move to edge elements in both directions. |
inV | — | From edge elements, resolve the to_id vertex. |
outV | — | From edge elements, resolve the from_id vertex. |
hasLabel | label (string) | Retain elements whose labels array contains the given label. |
has | key, op, value | Retain elements where props[key] <op> value. op is one of eq, neq, lt, lte, gt, gte. |
values | key (string) | Extract props[key] for each element (terminal — result becomes a list of scalars). |
properties | — | Extract the full props object for each element (terminal). |
project | keys (string[]) | Extract a subset of props keys for each element (terminal). |
path | — | Return the traversal path (list of element_ids) for each walker (terminal). |
limit | n (integer) | Keep at most n elements from the current working set. |
dedup | — | Remove duplicate elements (by element_id) from the working set. |
count | — | Return the count of elements in the working set (terminal — result is an integer). |
values, properties, project, path, count) convert the working set to a
non-element result. Only limit, dedup, and count are valid after a terminal step.
Hard Caps
The server enforces four hard caps on every query regardless of the AST:| Cap | Description |
|---|---|
max_depth | Maximum number of steps allowed in a single query. |
max_fanout | Maximum elements expanded by a single adjacency hop. |
max_results | Maximum size of the working set / final result. |
max_elements | Maximum cumulative element fetches across all steps. |
graph_traversal_limit_exceeded.
Response
| Parameter | Type | Description |
|---|---|---|
result | array of object, array, or integer | Traversal result. A list of elements (default), a list of scalars/dicts (after values/properties/project/path), or an integer (after count). |
Errors
invalid_graph_envelope— the alias does not exist or itsvalue.typeis not"graph".invalid_graph_query— the query AST is malformed or contains unsupported step types.graph_traversal_limit_exceeded— the query hit a server-side traversal cap.
Example
See also
- Graph session object — envelope shape and element schema.
- Apply Session Graph Mutations — write vertices and edges.
- List Session Graph Elements — paginate all elements.
- List Session Graph Neighbors — fetch neighbors of a set of vertices.
- Get Session Graph Element — fetch a single element.
- Get Session Graph Elements — fetch multiple elements by id.

