1

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.

Capture from the query window in the tutorial website

But when I tried to run it in my own Neo4j browser, it only the table view as in the following picture:

Capture of my returned Table View

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!

user1885868
  • 1,063
  • 3
  • 17
  • 31

2 Answers2

4

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
JohnMark13
  • 3,709
  • 1
  • 15
  • 26
  • Thanks @JohnMark13. Could you elaborate why does graph display work in the tutorial though? Is there a configuration missing? – Manav Kataria Sep 22 '15 at 03:43
  • Hi @ManavKataria the reason is that the original query is not returning any nodes, it is returning fields, which are just text and therefore display in a tabular manner. The browser that is being used in the tutorial is not the same as that which is bundled with the software, hence the display difference. You can see the actual query result in the table to the right in the original question. – JohnMark13 Sep 22 '15 at 15:48
1

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.

František Hartman
  • 14,436
  • 2
  • 40
  • 60