I'm doing a Neo4j hands-on exercise, following along to a UCSD video. I'm cutting and pasting the script provided for the exercises. I've just run into a problem with the provided script for a graph not containing the immediate neighborhood of a specified node:
match (d {Name:'D'})-[:TO]-(b)
with collect(distinct b.Name) as neighbors
match (n)-[r:TO]->(m)
where
not (n.Name in (neighbors+'D'))
and
not (m.Name in (neighbors+'D'))
return n, r, m;
match (d {Name:'D'})-[:TO]-(b)-[:TO]->(leaf)
where not((leaf)-->())
return (leaf);
match (d {Name:'D'})-[:TO]-(b)<-[:TO]-(root)
where not((root)<--())
return (root)
This returns:
Expected exactly one statement per query but got: 3
When I run the first 8 lines, Neo4j returns the graph, with expected nodes and edges. But when I add the subsequent queries, the error msgs start popping up.