Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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