Skip to main content
Traverse a graph session object using a structured query AST.

POST /revisions/:id/data/query (Command: query_session_graph)

Request Body

ParameterTypeRequiredDescription
enginestringYesMust be workflow_blobhub.
commandstringYesMust be query_session_graph.
session_idstringYesThe ID of the session that owns the graph envelope.
aliasstringYesAlias of the graph session object.
queryobjectYesTraversal query AST. See structure below.

Query AST

The query object has two fields:
FieldTypeRequiredDescription
startarrayYesSelects the initial working set.
stepsarray of arraysNoOrdered 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 nameArgumentsDescription
outtype? (string)Follow outgoing edges; optionally filter by edge label.
intype? (string)Follow incoming edges; optionally filter by edge label.
bothtype? (string)Follow edges in both directions; optionally filter by edge label.
outEtype? (string)Move to outgoing edge elements (instead of neighbor vertices).
inEtype? (string)Move to incoming edge elements.
bothEtype? (string)Move to edge elements in both directions.
inVFrom edge elements, resolve the to_id vertex.
outVFrom edge elements, resolve the from_id vertex.
hasLabellabel (string)Retain elements whose labels array contains the given label.
haskey, op, valueRetain elements where props[key] <op> value. op is one of eq, neq, lt, lte, gt, gte.
valueskey (string)Extract props[key] for each element (terminal — result becomes a list of scalars).
propertiesExtract the full props object for each element (terminal).
projectkeys (string[])Extract a subset of props keys for each element (terminal).
pathReturn the traversal path (list of element_ids) for each walker (terminal).
limitn (integer)Keep at most n elements from the current working set.
dedupRemove duplicate elements (by element_id) from the working set.
countReturn the count of elements in the working set (terminal — result is an integer).
Terminal steps (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:
CapDescription
max_depthMaximum number of steps allowed in a single query.
max_fanoutMaximum elements expanded by a single adjacency hop.
max_resultsMaximum size of the working set / final result.
max_elementsMaximum cumulative element fetches across all steps.
Exceeding any cap returns graph_traversal_limit_exceeded.

Response

ParameterTypeDescription
resultarray of object, array, or integerTraversal 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 its value.type is 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

{
  "engine": "workflow_blobhub",
  "command": "query_session_graph",
  "session_id": "sess_001",
  "alias": "task_graph",
  "query": {
    "start": ["V"],
    "steps": [
      ["hasLabel", "task"],
      ["has", "status", "eq", "open"],
      ["out", "depends_on"],
      ["limit", 10]
    ]
  }
}

See also