Reputation: 2766
I'm trying to learn Neo4j and am currently playing around with the movie graph, by opening a neo4j browser, entering
:play movie graph
and following the instructions. The instructions provide like this:
<500 lines of CREATE statements>
WITH TomH as a
MATCH (a)-[:ACTED_IN]->(m)<-[:DIRECTED]-(d) RETURN a,m,d LIMIT 10;
which creates the movie graph database, and displays a small subgraph consisting of 10 movies that Tom Hanks acted in, and their directors. However, when I try to just return this subgraph, i.e. without creating the graph again by simply running the last two lines, I get
Variable `TomH` not defined (line 1, column 6 (offset: 5))
"WITH TomH as a"
Can anybody explain why this is?
Upvotes: 1
Views: 129
Reputation: 2905
The script that generates the Movies graph does a whole bunch of stuff as one big statement and so has already got a notion of who Tom Hanks is and has assigned him to a variable called TomH
. However, outside of that statement none of those variables exist - once it's run, TomH
is meaningless (which is why you're being told it's not defined).
You can see what all node labels, relationships and properties are defined for the graph directly in the browser - clicking on any of them will return a sample of some of the data for that node/relationship:
To recreate the 'world of Tom Hanks' graph:
MATCH (a: Person { name: 'Tom Hanks' })-[:ACTED_IN]->(m)<-[:DIRECTED]-(d) RETURN a,m,d LIMIT 10
Upvotes: 1