Skip to content

Instantly share code, notes, and snippets.

@onegrx
Last active January 11, 2017 12:49
Show Gist options
  • Save onegrx/64de5ccc75ee85f362a0288935147f5e to your computer and use it in GitHub Desktop.
Save onegrx/64de5ccc75ee85f362a0288935147f5e to your computer and use it in GitHub Desktop.
Neo4j examples
MATCH (movie:Movie)
WHERE movie.year = 2016
RETURN movie.title AS title
ORDER BY title ASC LIMIT 25
MATCH (m:Movie {title: "Star Wars"})<-[:DIRECTED]-(p:Person {})
RETURN p.name, m.title
MATCH (a:Person {name: "Emma Watson II"})-[:ACTED_IN]-(m)<-[:ACTED_IN]-(coActors)
RETURN coActors.name
MATCH (a:Person {name: "Emma Watson II"})-[:ACTED_IN]-(m)<-[:ACTED_IN]-(coActors)
WITH coActors.name as name, count(m) as movies
WHERE movies > 2
RETURN name
MATCH (a:Person {name: "Emma Watson II"})-[:ACTED_IN]-(m)<-[:ACTED_IN]-(coActors)
WITH coActors, count(m) as movies
WHERE movies > 2
RETURN coActors
MATCH (bacon:Person {
name:"Kevin Bacon I"})-[*1..2]-(hollywood)
RETURN DISTINCT hollywood, bacon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment