List Comprehensions and Pattern Comprehensions

`[x IN list WHERE pred | expr]` and `[(n)-[:R]->(m) | m.name]` — Cypher's two functional power-tools.

0/3 done

Overview

List Comprehensions and Pattern Comprehensions

[x IN list WHERE pred | expr] and [(n)-[:R]->(m) | m.name] — Cypher's two functional power-tools.

Why it matters

Pattern comprehensions let you 'project a pattern' inline, no extra MATCH needed — perfect for shaping nested JSON.

Make it stick

Use the prompts below to anchor list comprehensions and pattern comprehensions to a real graph you own.

  • Pick a graph workload you've shipped — where would *list comprehensions and pattern comprehensions* have changed the design?
  • What's the smallest version of this pattern you could prototype on a real dataset next sprint?
  • What is the most likely *misuse* of this idea, and how would you catch it in a model or query review?

Reading in progress · 0 of 3 activities done