Skip to content

Instantly share code, notes, and snippets.

@jexp
Created February 4, 2020 11:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jexp/6b4deaa83821f02df547e2cc5be7ffe7 to your computer and use it in GitHub Desktop.
Save jexp/6b4deaa83821f02df547e2cc5be7ffe7 to your computer and use it in GitHub Desktop.
Luanda Leaks Load Script for Neo4j
create constraint on (j:Jurisdiction) assert j.name is unique;
create constraint on (i:Industry) assert i.name is unique;
create constraint on (c:Company) assert c.id is unique;
create constraint on (c:Company) assert c.name is unique;
call apoc.load.csv('https://bit.ly/luanda-data') yield map as row
with apoc.map.clean(row,[],['N/A','Still active','?','Unknown']) as row
create (c:Company {id:row.`ICIJ company #`})
set c.name = row.`Company name`,
c.nameChangeDate=row.`Date of Company name change (MM/DD/YYYY)`,
c.industry2=row.`Industry Level 2 (=ICB sector)`,
c.dissolutionDate=row.`Dissolution date (MM/DD/YYYY)`,
c.stakeExitDate=row.`Stake exit date (MM/DD/YYYY)`,
c.industry1 = row.`Industry Level 1 (=ICB Industry)`,
c.incorporationDate = row.`Incorporation date (MM/DD/YYYY)`,
c.jurisdiction = row.Jurisdiction,
c.createdByIds = row.`IdS created? (Y/N)` = 'Y',
c.stakesHeldBy = row.`Shares held by IdS or SD?`,
c.formerCompanyName = row.`Former company name`;
match (c:Company)
where c.industry1 is not null and c.industry2 is not null
merge (i:Industry {name:c.industry1})
merge (i2:Industry {name:c.industry2})
merge (i)<-[:SECTOR]-(i2)
merge (c)-[:IN_INDUSTRY]->(i2);
match (c:Company)
where c.jurisdiction is not null
merge (i:Jurisdiction {name:c.jurisdiction})
merge (c)-[:IN_JURISDICTION]->(i);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment