Skip to content

Instantly share code, notes, and snippets.

@rvanbruggen
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rvanbruggen/b938fbdaf7a67458e031 to your computer and use it in GitHub Desktop.
Save rvanbruggen/b938fbdaf7a67458e031 to your computer and use it in GitHub Desktop.
Querying Dem Bones
//DEM BONES queries
// show dem bones
match (n:BONES) return n;
//condition of the bones
match (n:BONES) return distinct n.condition
//where is the lord?
match (n {name:"Lord"}) return n
//find the connected bones?
match (n)-[r:CONNECTED_TO]->(m)
return count(r) as NrOfConnections;
//what does the lord do?
match (n {name:"Lord"})-->(m) return n,m
//find the foot bone
match (n {name:"foot bone"}) return n;
//what is the foot bone connected to?
match (n {name:"foot bone"})-[r:CONNECTED_TO]->() return n,r;
//what is the foot bone connected to 3 hops further on?
match (n {name:"foot bone"})-[r:CONNECTED_TO*..3]->() return n,r;
//what is the foot bone connected 5 hops to further on?
match (n {name:"foot bone"})-[r:CONNECTED_TO*..5]->() return n,r;
//back bone connected to the head bone?
match (n {name:"back bone"}), (m {name:"head bone"}), p=allshortestpaths((n)-[:CONNECTED_TO]->(m))
return p;
//what is the head bone connected to?
match (n {name:"head bone"})<-[r:CONNECTED_TO]-(:BONES) return n,r;
//where is the Word of the Lord?
match p=((n {name:"Lord"})-[r*2..2]->(m)) return p
//Bones are gonne what?
match (n:BONES)--(m:ACTIVITY) return n,m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment