Skip to content

Instantly share code, notes, and snippets.

@geleeroyale
Last active May 21, 2019 14:53
Show Gist options
  • Save geleeroyale/97271da400da9febabb70eba37181a6d to your computer and use it in GitHub Desktop.
Save geleeroyale/97271da400da9febabb70eba37181a6d to your computer and use it in GitHub Desktop.
Mapping the Giveth Community with neo4j
CREATE CONSTRAINT ON (id:Role) ASSERT id.id IS UNIQUE;
CREATE CONSTRAINT ON (id:Circle) ASSERT id.id IS UNIQUE;
CREATE CONSTRAINT ON (id:Soul) ASSERT id.id IS UNIQUE;
LOAD CSV WITH HEADERS FROM "https://docs.google.com/spreadsheets/d/1qm9Oxmr2C6kblVwDAVUaf_WQc0pi-rKCeRh0UlkcHnU/export?format=csv&id=1qm9Oxmr2C6kblVwDAVUaf_WQc0pi-rKCeRh0UlkcHnU&gid=0" AS line WITH line
CREATE (:Role {id: line.id, role: line.Role, circle: line.Circle, soul: line.Soul, purpose: line.Purpose})
RETURN line
LOAD CSV WITH HEADERS FROM "https://docs.google.com/spreadsheets/d/1qm9Oxmr2C6kblVwDAVUaf_WQc0pi-rKCeRh0UlkcHnU/export?format=csv&id=1qm9Oxmr2C6kblVwDAVUaf_WQc0pi-rKCeRh0UlkcHnU&gid=749010575" AS line WITH line
CREATE (:Circle {id: line.id, circle: line.Circle, mission: line.Mission})
RETURN line
LOAD CSV WITH HEADERS FROM "https://docs.google.com/spreadsheets/d/1qm9Oxmr2C6kblVwDAVUaf_WQc0pi-rKCeRh0UlkcHnU/export?format=csv&id=1qm9Oxmr2C6kblVwDAVUaf_WQc0pi-rKCeRh0UlkcHnU&gid=1634076525" AS line WITH line
CREATE (:Soul {id: line.id, soul: line.soul})
MATCH (role:Role)
MERGE (circle:Circle {circle: role.circle})
MERGE (role)-[rel:PART_OF]->(circle)
RETURN role
MATCH (node:Role)
MERGE (soul:Soul {soul: node.soul})
MERGE (node) -[rel:FILLED_BY]->(soul)
RETURN node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment