Skip to content

Instantly share code, notes, and snippets.

@kbastani
Last active August 29, 2015 14:04
Show Gist options
  • Save kbastani/1f278795b122cff09fd2 to your computer and use it in GitHub Desktop.
Save kbastani/1f278795b122cff09fd2 to your computer and use it in GitHub Desktop.
graphgist-sharaton
= Neo4j GraphDays =
:neo4j-version: 2.0.1
:author: Kenny Bastani
:twitter: @kennybastani
== Create sample dataset
//setup
//hide
[source,cypher]
----
MERGE (p1:Person { name: "PV" })
MERGE (p2:Person { name: "SUJ" })
MERGE (p3:Person { name: "Dave" })
MERGE (p4:Person { name: "GA" })
MERGE (t1:Table { name: "Table 1" })
MERGE (p1)-[:AT_TABLE]->(t1)
MERGE (p2)-[:AT_TABLE]->(t1)
MERGE (p3)-[:AT_TABLE]->(t1)
MERGE (p4)-[:AT_TABLE]->(t1)
----
//graph
Get the first 2 people at table 1
[source,cypher]
----
MATCH (p:Person)-[:AT_TABLE]->(t1:Table)
RETURN t1.name as name, collect(p.name) as people
----
//table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment