-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph_creation.cypher
28 lines (23 loc) · 1.23 KB
/
graph_creation.cypher
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// create applications
LOAD CSV WITH HEADERS FROM 'file:///app_reduced.csv' AS app
MERGE (application:App {name : app.app, price : app.price, rating : app.rating})
// create categories
LOAD CSV WITH HEADERS FROM 'file:///categories.csv' AS categories
MERGE (:Category {name:categories.category})
// link apps and categories
LOAD CSV WITH HEADERS FROM 'file:///categories.csv' AS categories
MATCH (app:App {name : categories.app}), (cat:Category {name : categories.category})
MERGE (app)-[:hasCategory]->(cat)
// create relationships between apps
LOAD CSV WITH HEADERS FROM 'file:///related.csv' AS relations
MATCH (app:App {name : relations.app}), (related:App {name : relations.related})
MERGE (app)-[:related{kind : relations.kind}]->(related)
// create reviews and reviewers
LOAD CSV WITH HEADERS FROM 'file:///reviews.csv' AS reviews
MERGE (review:Review {id : reviews.reviewID, overall : reviews.overall, review : reviews.review})
MERGE (reviewer:Reviewer {id : reviews.reviewerID, name : reviews.reviewerName})
MERGE (reviewer)-[:writeReview]->(review)
// link reviews and apps
LOAD CSV WITH HEADERS FROM 'file:///reviews.csv' AS reviews
MATCH (app:App {name : reviews.app}), (review:Review {id : reviews.reviewID})
MERGE (app)<-[:review]-(review)