Reputation: 1093
I am new at Neo4j and I've been trying the queries in the official Neo4j training course (with their "Movies" dummy database example).
I have tried to run this query :
MATCH (actor)-[:ACTED_IN]->(movie)<-[:DIRECTED]-(director)
RETURN actor.name, movie.title, director.name;
It did work fine in the query window they have in their tutorial website.
But when I tried to run it in my own Neo4j browser, it only the table view as in the following picture:
While the graph view didn't show anything except for a Displaying 0 nodes, 0 relationships
message.
What did I do wrong? And How can I fix it?
Thanks!
Upvotes: 1
Views: 1007
Reputation: 3739
In your query you are only returning rows of textual data, rather than the nodes to which they relate. To see the nodes in the graph view, you need to return the nodes and relationships from your query, so your query should be:
MATCH (actor)-[:ACTED_IN]->(movie)<-[:DIRECTED]-(director)
RETURN actor, movie, director
Upvotes: 4
Reputation: 15076
The key thing is your return clause
RETURN actor.name, movie.title, director.name;
You return only values of these properties.
By changing this to
RETURN actor, movie, director;
you will return whole nodes and neo4j browser will also load relationships between these nodes.
Upvotes: 1