Reputation: 13
I have a custom CSV with movies data with the following strucuture:
id,title,media_type,original_language,actor
1002185.0,A Million Miles Away,movie,en,Emma Fassler
447332.0,A Quiet Place,movie,en,Noah Jupe
and i want to graph in neo4j the actors (names) that share one or more movies (title) between each other, the code where i load the data:
LOAD CSV WITH HEADERS FROM "file:///movies_neo_graph/part-00000-c5c5507e-5501-4adb-87fc-38be1d908076-c000.csv" AS row
CREATE (m:Movie)
SET m = row,
m.id = toInteger(row.id),
m.title = toString(row.title),
m.language = toString(row.original_language);
LOAD CSV WITH HEADERS FROM "file:///movies_neo_graph/part-00000-c5c5507e-5501-4adb-87fc-38be1d908076-c000.csv" AS row
CREATE (a:Actor)
SET a = row,
a.name = toString(row.actor),
a.movie_id = toInteger(row.id);
Then I setup the relationship between nodes Movie and Actor:
MATCH (a:Actor),(m:Movie)
WHERE a.movie_id = m.id
CREATE (a)-[:ACTED_IN]->(m);
This is my first time in Neo4J and i don't know how to perform the query, i tried with
MATCH (a:Actor)-[:ACTED_IN]->(m:Movie)
RETURN a.name AS actor, COLLECT(DISTINCT m.title) AS movies_acted, COUNT(m.title) AS movies_cnt
ORDER BY movies_cnt DESC
LIMIT 50;
And the result is a table but not a graph:
Any ideas? really appreciate the help
Upvotes: 0
Views: 162
Reputation: 66999
Since your query did not return any nodes, relationships, or paths, no graph visualization is possible.
For example, if you want the Neo4j Browser to display the a
nodes in a graph visualization, your RETURN
clause will also have to include a
as a term (not just a.name
, which is only a string property and not the entire node).
Upvotes: 0