Skip to content

Instantly share code, notes, and snippets.

@laracabrera
Last active May 24, 2018 10:11
Show Gist options
  • Save laracabrera/58d8bca9d7b71cf522b7eacc9ed57d96 to your computer and use it in GitHub Desktop.
Save laracabrera/58d8bca9d7b71cf522b7eacc9ed57d96 to your computer and use it in GitHub Desktop.
Neo4j grafo a partir de CSV
LOAD CSV WITH HEADERS FROM '[URL_FROM]' AS line
MERGE (u:User {screen_name: line.username})
ON CREATE SET
u.name = line.name ,
u.description = line.description ,
u.location = line.location ,
u.followers_count = toInteger(line.followers) ,
u.statuses_count = toInteger(line.numberstatuses) ,
u.active = (CASE line.active WHEN 1 THEN true ELSE false END) ,
u.id = toInteger(line.id) ,
u.last_updated = apoc.date.parse(line.last_updated,'s','dd/MM/yyyy HH:mm')
CREATE (u)<-[:POSTED_BY {date:apoc.date.parse(line.time,'s','dd/MM/yyyy HH:mm')}]-(:Tweet {text:line.tweets, created_at: line.time})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment