Skip to content

[Query] Dataflow Lens

github-actions[bot] edited this page Jul 21, 2026 · 1 revision

This document was generated from 'src/documentation/wiki-query.ts' on 2026-07-20, 13:05:03 UTC presenting an overview of flowR's query API (v2.12.3). Please do not edit this file/wiki page directly.

Dataflow Lens Query [overview]

Returns a simplified view on the dataflow graph, reduced to definitions, uses, and calls.
This query is requested with the type dataflow-lens.

The Dataflow Query hands you the complete dataflow graph, which is precise but quickly grows too large to read. The dataflow lens returns a reduced view of that same graph, keeping only what is usually interesting when looking at it by hand:

  • only vertices tagged as a use, a variable definition, a function definition, or a function call (value vertices are dropped),
  • without the environment captured at each vertex (control dependencies are kept),
  • and without the vertices for plain operators and keywords (<-, =, +, |>, if, function, ...).

Edges survive only if both of their endpoints do. The query takes no further arguments.

f <- function(a) a + 1
x <- 1
y <- f(x)
print(y)
[
  {
    "type": "dataflow-lens"
  }
]

(This can be shortened to @dataflow-lens when used with the REPL command :query).

Results (prettified and summarized):

Query: dataflow-lens failed: Invalid regular expression: /<-|<<-|->|->>|=|+|-|*|/|\|>|function|repeat|if|next|break/: Nothing to repeat
All queries together required ≈4 ms (1ms accuracy, total 5 ms)

Show Detailed Results as Json

The analysis required 4.8 ms (including parsing and normalization and the query) within the generation environment.

In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR. Please consult the Interface wiki page for more information on how to get those.

{
  "dataflow-lens": {
    ".meta": {
      "timing": 0
    },
    "error": "Invalid regular expression: /<-|<<-|->|->>|=|+|-|*|/|\\|>|function|repeat|if|next|break/: Nothing to repeat"
  },
  ".meta": {
    "timing": 4
  }
}

Note

This is a presentation aid, not a semantic one: the reduced graph is not a sound basis for slicing. Use the Dataflow Query if you need the complete graph, or the Dataflow Cluster Query if you want the graph partitioned instead of shrunk.

Implementation Details

Responsible for the execution of the Dataflow Lens Query query is executeDataflowLensQuery in ./src/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.ts.

Clone this wiki locally