Created
November 4, 2020 13:08
-
-
Save moxious/9924090e05be42a59820825f1c91252e to your computer and use it in GitHub Desktop.
Ghengis Khan's Family Tree in Neo4j
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WITH 'https://storage.googleapis.com/meetup-data/ghengis-khan-family-tree.csv' as data | |
| LOAD CSV WITH HEADERS FROM data AS line | |
| MERGE (p:Person { id: line.id }) | |
| SET | |
| p.name = line.name, | |
| p.born = coalesce(line.born, 'Unknown'), | |
| p.died = coalesce(line.died, 'Unknown') | |
| WITH p, line | |
| MERGE (father:Person { id: coalesce(line.father_id, apoc.create.uuid()) }) | |
| MERGE (mother:Person { id: coalesce(line.mother_id, apoc.create.uuid()) }) | |
| MERGE (p)-[:FATHER]->(father) | |
| MERGE (p)-[:MOTHER]->(mother); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment