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.
Neo4j Browser can run only one query at time. You are trying to run 3:
Query 1:
Query 2
Query 3:
You must copy, paste and run these 3 queries separately.
Here is an open issue in the Neo4j Browser Github Repo about supporting multiple Cypher statements at a time in the browser, but this is specifically for statements that don't return any data.