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
- Compose
CALL { ... }into production Cypher pipelines. - Combine graph traversal with time-aware and semi-structured payload processing.
- Stabilize or transform row sets before later analytics or mutation work.
Real Limitations And Tradeoffs
- Abstractions depend on the surrounding pipeline and current implementation, not on assumptions from another Cypher dialect.
- Some statement forms are introspection or planning tools rather than row-centric data access tools.
- Verify edge behavior against the parser, planner, and spec tests when changing semantics.