Skip to content

Instantly share code, notes, and snippets.

@tareqabedrabbo
Created May 1, 2013 23:47
Show Gist options
  • Save tareqabedrabbo/5499253 to your computer and use it in GitHub Desktop.
Save tareqabedrabbo/5499253 to your computer and use it in GitHub Desktop.
Neo4j Labels and Schema Indexes
match p:Person, l:Location
where p.first_name! = {first_name} and l.location = {location}
create p-[:LIVES_IN]->l
curl http://localhost:7474/db/data/cypher?profile=true -X POST -H "Accept: application/json" -H "Content-type: application/json" -d '{"query" : "match p:Person where p.first_name! = \"George\" return p.first_name, p.last_name"}'
create index on :Person(first_name)
create index on :Person(last_name)
create (n:Person {first_name : "Peppa", last_name : "Pig"})
create (n:Person {first_name : "George", last_name : "Pig"})
create (n:Person {first_name : "Mummy", last_name : "Pig"})
create (n:Person {first_name : "Daddy", last_name : "Pig"})
create (n:Location {location : "The Pigs house"})
create (n:Person {name : "Bob the bat"})
match p:Person
where p.first_name = "George"
return p.first_name, p.last_name
match p:Person
where p.first_name! = "George"
return p.first_name, p.last_name
match p:Person
where p.last_name = "Pig" and p.first_name = "Peppa"
return p.first_name
match p:Person
using index p:Person(first_name)
where p.last_name = "Pig" and p.first_name = "Peppa"
return p.first_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment