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
//----------------------- | |
//Import people | |
//----------------------- | |
CREATE CONSTRAINT ON (a:PEOPLE) ASSERT a.id IS UNIQUE; | |
USING PERIODIC COMMIT 2000 | |
LOAD CSV WITH HEADERS FROM "file:c:/my-facebook-network.csv" AS line | |
FIELDTERMINATOR ',' | |
WITH line |
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
//----------------------- | |
//Number of organizations | |
//----------------------- | |
MATCH (a:ORGANIZATION) | |
Return count(a) as total_organizations; | |
//----------------------- | |
//Number of projects | |
//----------------------- | |
MATCH (a:PROJECT) |
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
//----------------------- | |
//Import programs | |
//----------------------- | |
CREATE CONSTRAINT ON (a:PROGRAM) ASSERT a.programmePga IS UNIQUE; | |
USING PERIODIC COMMIT 2000 | |
LOAD CSV WITH HEADERS FROM "file:c:/fp7projects20150303.csv" AS line | |
FIELDTERMINATOR ';' | |
WITH line |
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
//----------------------- | |
//Company whose employees donated the more money | |
//----------------------- | |
MATCH (a:COMPANY)<-[:IS_EMPLOYED]-(b:INDIVIDUAL)-[r:HAS_CONTRIBUTED]->(c:COMMITTEE) | |
RETURN a.EMPLOYER, SUM(r.TRANSACTION_AMT) as total | |
ORDER BY total DESC | |
LIMIT 10 | |
//----------------------- |
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
//----------------------- | |
//Import the committees | |
//----------------------- | |
CREATE CONSTRAINT ON (e:COMMITTEE) ASSERT e.CMTE_ID IS UNIQUE; | |
USING PERIODIC COMMIT 2000 | |
LOAD CSV WITH HEADERS FROM "file:c:/cmv1.csv" AS line | |
FIELDTERMINATOR '|' | |
MERGE (:COMMITTEE { |
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
//----------------------- | |
//Import the contributors | |
//----------------------- | |
CREATE INDEX ON :CONTRIBUTOR(`id`); | |
USING PERIODIC COMMIT 2000 | |
LOAD CSV WITH HEADERS FROM "file:c:/contribution_nodes.csv" AS line | |
FIELDTERMINATOR ';' | |
MERGE (:CONTRIBUTOR { id: line.id, size: line.size, organization_type: line.organization_type, committee_type: line.committee_type, party: line.party, name: line.name}); |
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
//----------------------- | |
//Import the companies | |
//----------------------- | |
CREATE CONSTRAINT ON (e:COMPANY) ASSERT e.id IS UNIQUE; | |
USING PERIODIC COMMIT 2000 | |
LOAD CSV WITH HEADERS FROM "file:c:/companies.csv" AS line | |
MERGE (:COMPANY { id: line.id, company_name: line.company_name, city: line.city, country: line.country, postal_code: line.postal_code, state: line.state, address: line.address}); |
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
CREATE CONSTRAINT ON (e:PERSON) ASSERT e.name IS UNIQUE; | |
CREATE CONSTRAINT ON (e:TYPE) ASSERT e.name IS UNIQUE; | |
CREATE CONSTRAINT ON (e:COUNTRY) ASSERT e.name IS UNIQUE; | |
USING PERIODIC COMMIT 2000 | |
LOAD CSV WITH HEADERS FROM "file:c:/ballon_or.csv" AS line | |
FIELDTERMINATOR ';' | |
MERGE (:PERSON {name: line.Name, type: line.Voter, country: line.Country}) | |
MERGE (:TYPE {name: line.Voter}) | |
MERGE (:COUNTRY {name: line.Country}) |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
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
Voter;Country;Name;Position;Nominee | |
Captain;Afghanistan;Amiri Islam;First_(5pt);Messi Lionel | |
Captain;Afghanistan;Amiri Islam;Second_(3pt);Cristiano Ronaldo | |
Captain;Afghanistan;Amiri Islam;Third_(1pt);Ibrahimovic Zlatan | |
Captain;Albania;Cana Lorik;First_(5pt);Cristiano Ronaldo | |
Captain;Albania;Cana Lorik;Second_(3pt);Robben Arjen | |
Captain;Albania;Cana Lorik;Third_(1pt);Mueller Thomas | |
Captain;Algeria;Bougherra Madjid;First_(5pt);Cristiano Ronaldo | |
Captain;Algeria;Bougherra Madjid;Second_(3pt);Robben Arjen | |
Captain;Algeria;Bougherra Madjid;Third_(1pt);Benzema Karim |
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
ID,FULL_NAME,FIRST_NAME,LAST_NAME,CALLING_NBR,CALLED_NBR,START_DATE,END_DATE,DURATION,CITY,STATE,ADDRESS,CELL_SITE | |
1,RalphJordan,Ralph,Jordan,8-(921)364-8515,3-(230)472-4011,1419197491,1419198397,906,Fair Oaks,CA,27834 Glendale Hill,0080 | |
2,PamelaPowell,Pamela,Powell,2-(270)359-8113,2-(833)444-8281,1416290807,1416292942,2135,West Sacramento,CA,35593 Portage Drive,0051 | |
3,AnnaGibson,Anna,Gibson,3-(307)801-5521,9-(490)378-2330,1417817803,1417820157,2354,Sacramento,CA,1323 El Camino Avenue,0102 | |
4,BeverlyKelly,Beverly,Kelly,7-(423)821-7199,3-(307)801-5521,1417220166,1417223469,3303,Folsom,CA,28473 Hanson Plaza,0081 | |
5,RobertBowman,Robert,Bowman,7-(445)366-2890,2-(833)444-8281,1415288003,1415289004,1001,Sacramento,CA,4 Waubesa Plaza,0032 | |
6,WalterWright,Walter,Wright,9-(375)425-6362,8-(618)141-5320,1414689052,1414691454,2402,Orangevale,CA,97 Briar Crest Plaza,0079 | |
7,WalterWright,Walter,Wright,9-(375)425-6362,3-(812)536-3510,1419461129,1419462362,1233,Sacramento,CA,11746 Moose Crossing,0059 | |
8,AnnaGibson,Anna,Gibson,3-( |