Last active
August 29, 2015 14:04
-
-
Save kbastani/1f278795b122cff09fd2 to your computer and use it in GitHub Desktop.
graphgist-sharaton
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= 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