Prathamesh1420 commited on
Commit
e7addce
1 Parent(s): 3b5cb60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -13
app.py CHANGED
@@ -20,20 +20,18 @@ graph = Neo4jGraph(url=NEO4J_URI, username=NEO4J_USERNAME, password=NEO4J_PASSWO
20
  # Load movie dataset into Neo4j
21
  moview_query = """
22
  LOAD CSV WITH HEADERS FROM
23
- 'https://raw.githubusercontent.com/tomasonjo/blog-datasets/main/movies/movies_small.csv' as row
24
- MERGE(m:Movie{id:row.movieId})
25
- SET m.released = date(row.released),
26
- m.title = row.title,
27
- m.imdbRating = toFloat(row.imdbRating)
28
- FOREACH (director in split(row.director, '|') |
29
- MERGE (p:Person {name:trim(director)})
30
- MERGE (p)-[:DIRECTED]->(m))
31
- FOREACH (actor in split(row.actors, '|') |
32
- MERGE (p:Person {name:trim(actor)})
33
- MERGE (p)-[:ACTED_IN]->(m))
34
- FOREACH (genre in split(row.genres, '|') |
35
- MERGE (g:Genre {name:trim(genre)})
36
  MERGE (m)-[:IN_GENRE]->(g))
 
37
  """
38
  graph.query(moview_query)
39
  graph.refresh_schema()
 
20
  # Load movie dataset into Neo4j
21
  moview_query = """
22
  LOAD CSV WITH HEADERS FROM
23
+ 'https://raw.githubusercontent.com/Pk-Kolhapurkar/graphdb_neo4j/main/indian%20movies.csv' AS row
24
+ MERGE (m:Movie {id: row.ID})
25
+ SET m.year = toInteger(row.Year),
26
+ m.title = row['Movie Name'],
27
+ m.timing = toInteger(row['Timing(min)']),
28
+ m.rating = toFloat(row['Rating(10)']),
29
+ m.votes = toInteger(row.Votes),
30
+ m.language = row.Language
31
+ FOREACH (genre IN split(row.Genre, '|') |
32
+ MERGE (g:Genre {name: trim(genre)})
 
 
 
33
  MERGE (m)-[:IN_GENRE]->(g))
34
+
35
  """
36
  graph.query(moview_query)
37
  graph.refresh_schema()