3.6 Brought sub-graph — parent and children in one fetch
MATCH (p:Person {name:'Ada Lovelace'})-[:HAS_HUBSPOT_CONTACT]->(c:HubSpotContact)-[:HAS_COMMENT]->(note:HubSpotComment)RETURN c.company, note.textMeans: “Ada’s HubSpot contact and the notes on it.”
How it executes:
- Probe + fetch Ada’s contact as in §3.1 — but the contact record already embeds its comments
(
{ email, company, comments: [ {id, text}, … ] }). - Materialize the brought sub-graph. The engine extracts the embedded
comments[*], makes a transient(:HubSpotComment:Virtual)per comment, and links(c)-[:HAS_COMMENT]->(note)— all from the single fetch. No second call. - Run / roll back.
Declared: a brings: entry on the contact join naming the child type, edge, the JSONPath to
the embedded list ($.comments[*]), and the child’s identity property.
Why
bringsnot a second join. When the source already returns the children inline (anexpand/include/sideload param), declaring them asbrings:fetches the whole sub-graph in one call. A separate join would re-probe and re-fetch — slower, and it would need the children’s own anchor key. Pairbringswith the endpoint’s sideload params so the children arrive together.

