Last active
November 20, 2018 10:25
-
-
Save ajason08/a92a0aebdc9359032709b31ea7a1cae1 to your computer and use it in GitHub Desktop.
Neo4J notebook
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
// get node | |
MATCH (b:label1 { name: "bn:00706957n"}) return b | |
// get rel | |
match (n)-[r:rel {name:"0"}]-(p) return count (r) | |
// create toy graph | |
---PLAN | |
1 > 2 >3 > 4 | |
4 > 2 | |
look for 3>2 | |
look for 3>1 | |
---EXECUTION | |
CREATE (a:label1 { name: "_1"}) | |
CREATE (a:label1 { name: "_2"}) | |
CREATE (a:label1 { name: "_3"}) | |
CREATE (a:label1 { name: "_4"}) | |
MATCH (a:label1 { name: "_1"}) | |
MATCH (b:label1 { name: "_2" }) | |
// reading CSV | |
// batch reading for mem issues | |
USING PERIODIC COMMIT 20000 | |
LOAD CSV WITH HEADERS FROM "file:///Users/tyler/graph/friends_edges.csv" AS edges | |
//win format | |
file:c:/path/to/data.csv | |
// split by | |
FIELDTERMINATOR ' ' | |
LOAD CSV WITH HEADERS FROM "https://gist.githubusercontent.com/jexp/d788e117129c3730a042/raw/a147631215456d86a77edc7ec08c128b9ef05e3b/people_leading_empty.csv" | |
AS line | |
WITH line LIMIT 5 | |
RETURN line.PersonName, line.Company, line.company, line.`Company Name` | |
// splited data | |
MATCH (a:label1 { name: line[0]}) | |
// head and break | |
WITH line LIMIT 4 | |
RETURN line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment