This file contains 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
RES_ENT_ID | DATA_SOURCE | RECORD_ID | |
---|---|---|---|
1 | CUSTOMERS | 1001 | |
1 | REFERENCE | 1001 | |
1 | WATCHLIST | 1001 | |
1 | CUSTOMERS | 1002 | |
1 | REFERENCE | 1002 | |
1 | WATCHLIST | 1002 | |
1 | CUSTOMERS | 1003 | |
1 | REFERENCE | 1003 | |
1 | WATCHLIST | 1003 |
This file contains 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
//Check schema | |
CALL db.schema() | |
//Identify countries with limited # of adresses | |
MATCH (a:Address) | |
WITH a, a.countries as countries | |
RETURN countries, count(a) as score | |
ORDER BY score ASC | |
LIMIT 50 |
This file contains 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
//Creating companies | |
CALL apoc.load.json($url) YIELD value | |
WITH distinct value.home_domain as domain, value.home_name as name | |
merge (b:Business {domain:domain}) ON CREATE SET b.name = name; | |
//Creating more companies | |
call apoc.load.json($url) yield value | |
with distinct value.link_domain as domain, value.link_name as name | |
merge (b:Business {domain:domain}) ON CREATE SET b.name = name; |
This file contains 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 (:OrganizationUnit { name: "OrganizationUnit"}) | |
FOREACH (r IN range(0,3)| | |
CREATE (:ICTObject{ name:"ICTObject" + r})) | |
FOREACH (r IN range(0,3)| | |
CREATE (:BusinessActor{ name:"BusinessActor" + r})) | |
FOREACH (r IN range(0,3)| | |
CREATE (:ApplicationService{ name:"ApplicationService" + r})) | |
FOREACH (r IN range(0,3)| | |
CREATE (:Process{ name:"Process" + r})) |
This file contains 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 (:BillOfMaterial { name: "BoM", cost: 500}) | |
FOREACH (r IN range(0,10)| | |
CREATE (:Retailer { name:"Retailer" + r, cost: round(exp(rand()*3)+20), co2: round(exp(rand()*8)+250), lat: tan(rand())*100, long: tan(rand())*100, time: 1})) | |
FOREACH (r IN range(0,1)| | |
CREATE (:Wholesaler { name:"Wholesaler" + r, cost: round(exp(rand()*3)+20), co2: round(exp(rand()*8)+250), lat: tan(rand())*100, long: tan(rand())*100, time: round(rand()*5)})) | |
; | |
CREATE (:Product { name: "ProductA", lat: tan(rand())*100, long: tan(rand())*100, co2: 200, cost: 100, time: 0 }) | |
FOREACH (r IN range(0,2)| | |
CREATE (:Supplier { name:"SupplierA" + r, cost: round(exp(rand()*3)+20), co2: round(exp(rand()*8)+250), lat: tan(rand())*100, long: tan(rand())*100, time: round(rand()*5)})) |
This file contains 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
// Verifying the CSV file | |
// assert correct line count | |
LOAD CSV FROM "file:/Developer/TGOG/data/person.csv" AS line | |
RETURN count(*); | |
// check first few raw lines | |
LOAD CSV FROM "file:/Developer/TGOG/data/person.csv" AS line WITH line | |
RETURN line | |
LIMIT 1; |
This file contains 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
//Creating unique constraint | |
CREATE CONSTRAINT ON (o:Organization) ASSERT o.name IS UNIQUE; | |
//Importing the organizations and their connections | |
WITH 'https://docs.google.com/spreadsheets/u/1/d/1Z5Vo5pbvxKJ5XpfALZXvCzW26Cl4we3OaN73K9Ae5Ss/export?format=tsv&id=1Z5Vo5pbvxKJ5XpfALZXvCzW26Cl4we3OaN73K9Ae5Ss&gid=634968401' AS url, ['LOAN','LOBBIED','SALE','SUPPLIER','SHAREHOLDER','LICENSES','AFFILIATED','TIES','NEGOTIATION','INVOLVED','PARTNER'] as terms | |
load csv with headers from url as row fieldterminator '\t' | |
MERGE (a:Organization {name:row.`Organization A`}) | |
MERGE (b:Organization {name:row.`Organization B`}) | |
CREATE (a)-[:IS_CONNECTED_TO {type:row.Connection}]->(b); |
This file contains 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
//Creating the companies | |
CREATE CONSTRAINT ON (a:COMPANY) ASSERT a.id IS UNIQUE; | |
USING PERIODIC COMMIT 2000 | |
LOAD CSV WITH HEADERS FROM "file:///companies.csv" AS line | |
FIELDTERMINATOR ',' | |
WITH line | |
MERGE (a:COMPANY {id: line.id}) | |
ON CREATE SET a.description = line.description, | |
a.name = line.name; |
This file contains 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
/* | |
https://linkurio.us/the-crunchbase-graph-data-modelling/ | |
https://linkurio.us/crunchbase-graph-importing-data-neo4j/ | |
https://linkurio.us/crunchbase-graph-analysing-graph/ | |
Check also Neo4j csv and etl guide | |
*/ | |
This file contains 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
//Clean up the db | |
MATCH (n) | |
OPTIONAL MATCH (n)-[r]-() | |
DELETE n,r; | |
//----------------------- | |
//Import persons | |
//----------------------- | |
CREATE CONSTRAINT ON (a:Person) | |
ASSERT a.id IS UNIQUE; |
NewerOlder