Created
August 9, 2013 06:16
-
-
Save rvanbruggen/6191508 to your computer and use it in GitHub Desktop.
Example queries to interactively query a linkedin-based neo4j database.
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
// Find Shortest paths between two contacts | |
START | |
n=node:node_auto_index(name='Emil Eifrem'), | |
m=node:node_auto_index(name='Steven Noels') | |
MATCH | |
p = AllShortestPaths(n-[*]-m) | |
RETURN p; | |
// Find all the relationships between two "first degree" contacts of RVB | |
START | |
rik=node:node_auto_index(name="Rik Van Bruggen") | |
MATCH | |
rik-[:CONNECTED_TO]-firstdegree-[r:CONNECTED_TO]-otherfirstdegree-[:CONNECTED_TO]-rik | |
RETURN distinct firstdegree.name, r, otherfirstdegree.name; | |
// Find all the shared contacts between Rik and Lars | |
START | |
rik=node:node_auto_index(name="Rik Van Bruggen"), | |
lars=node:node_auto_index(name="Lars Nordwall") | |
MATCH | |
rik-[:CONNECTED_TO]-rixsharedcontacts-[:CONNECTED_TO]-lars | |
RETURN distinct rixsharedcontacts.name as SharedContacts; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment