CALL { ... }

Generic Description

Inline subquery clause.

Simple example:

CALL { MATCH (p:Person) RETURN count(p) AS c } RETURN c

Consumer-Level Explanation

Use CALL { ... } when part of the query needs its own local scope, aggregation boundary, or staged computation before the result flows back into the outer pipeline.

More Detailed Explanation

CALL subqueries isolate a nested query pipeline. They are useful for scoped aggregation, correlation, modular query composition, and cases where the outer query would become difficult to reason about if every transformation stayed in one linear chain.

Advanced Example

This example keeps CALL { ... } as a real scoped subquery. The outer pipeline binds users, while the inner pipeline computes a reusable document summary with its own aggregation boundary.

CALL {
  MATCH (d:Document)
  WITH d, keys(properties(d.metadata)) AS metadata_keys
  RETURN count(d) AS document_count,
         collect(metadata_keys) AS metadata_profiles
}
RETURN document_count,
       metadata_profiles

Real Use Cases

Real Limitations And Tradeoffs