Last active
August 29, 2015 14:10
-
-
Save bkimble/eec1992851991ea2e9c8 to your computer and use it in GitHub Desktop.
Revisions
-
bkimble revised this gist
Nov 20, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ LIMIT 1 MERGE (u:User {id: 3}) // this is the part I am not sure how to do (IF c1 WAS NOT FOUND) CREATE (c:Contact) (END) -
bkimble revised this gist
Nov 20, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,7 @@ LIMIT 1 // Create or make user based on ID MERGE (u:User {id: 3}) // this is the part I am not sure how to do (IF NOT FOUND) CREATE (c:Contact) (END) -
bkimble created this gist
Nov 20, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ // Try to find a contact that is connected to a node // with an email addrss of bob@google.com or jerk@hello.com // Pick the first one (there should never be multiple contacts with the same emails) // but just in case, pick the first found) MATCH (e1:Email)-[:EMAIL]-(c1:Contact) WHERE (e1.address IN ['[email protected]','[email protected]']) WITH e1,c1 LIMIT 1 // Create or make user based on ID MERGE (u:User {id: 3}) (IF NOT FOUND) CREATE (c:Contact) (END) CREATE (u)-[:KNOWS]->(c) FOREACH(email in ["[email protected]",'[email protected]'] | MERGE (e:Email {address:email}) MERGE (c)-[:EMAIL]-(e) ) MERGE (a:Alias {name: "Jack"}) MERGE (c)-[:ALIAS]-(a);