Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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