Github in a Graph      with Neo4jAndreas Kollegger@akollegger#neo4j                    1
1
How well get the Octocat into the Graph   1.Intro to Graphs, Socially   2.Graph Database Essentials   3.Github as a Graph ...
Graphs...            3
Meet Emil...
Meet Emil...               Emil
Meet Emil...๏ from: Sweden                 Emil
Meet Emil...๏ from: Sweden๏ appearance: blonde and handsome                        Emil
Meet Emil...๏ from: Sweden๏ appearance: blonde and handsome๏ personality: super friendly nerd                           Emil
Meet Emil...๏ from: Sweden๏ appearance: blonde and handsome๏ personality: super friendly nerd๏ interests: piano, pickled h...
Emil has some friends                 Emil
Emil has some friends๏ Kerstin: his sister                        Emil                               Kerstin
Emil has some friends๏ Kerstin: his sister๏ Peter: his buddy                     Peter   Emil                             ...
Emil has some friends๏ Kerstin: his sister๏ Peter: his buddy๏ Andreas: me!                        Peter   Emil            ...
His friends introduced more friends                  Peter   Emil        Andreas                                 Kerstin
His friends introduced more friends๏ Michael: master hacker        Michael             Peter   Emil                  Andre...
His friends introduced more friends๏ Michael: master hacker๏ Johan: technology sage        Michael                        ...
His friends introduced more friends๏ Michael: master hacker๏ Johan: technology sage๏ Madelene: polyglot journalist        ...
His friends introduced more friends๏ Michael: master hacker๏ Johan: technology sage๏ Madelene: polyglot journalist๏ Alliso...
So, we have a bunch of people                                                                 Allison     Michael         ...
So, we have a bunch of people๏ how do we know they are friends?                                                           ...
So, we have a bunch of people๏ how do we know they are friends?๏ either ask each pair: are you friends?                   ...
So, we have a bunch of people๏ how do we know they are friends?๏ either ask each pair: are you friends?๏ or, we can add ex...
So, we have a bunch of people๏ how do we know they are friends?๏ either ask each pair: are you friends?๏ or, we can add ex...
Theres a problem here                                                                 Allison     Michael                 ...
Theres a problem here๏ Emil is awesome                                                                    Allison        M...
Theres a problem here๏ Emil is awesome๏ What about other relationships?                                                   ...
Theres a problem here๏ Emil is awesome๏ What about other relationships?๏ We mentioned "introductions" so there mustve    b...
Theres a problem here๏ Emil is awesome๏ What about other relationships?๏ We mentioned "introductions" so there mustve    b...
This can continue...                                                                 Allison     Michael                  ...
This can continue...                                                                   Allison       Michael              ...
This can continue...๏ this is how social networks grow                                                                    ...
This can continue...๏ this is how social networks grow๏ either meet people directly                                       ...
This can continue...๏ this is how social networks grow๏ either meet people directly๏ or be introduced                     ...
This can be useful                                                                   Allison       Michael                ...
This can be useful๏ professional recommendation (LinkedIn)                                                                ...
This can be useful๏ professional recommendation (LinkedIn)๏ product recommendation (Amazon)                               ...
This can be useful๏ professional recommendation (LinkedIn)๏ product recommendation (Amazon)๏ restaurant recommendations (Y...
This can be useful๏ professional recommendation (LinkedIn)๏ product recommendation (Amazon)๏ restaurant recommendations (Y...
This is really just data                                                                   Allison       Michael          ...
This is really just data๏ its just a graph                                                                     Allison    ...
12
A graph?           12
Yes, a graph...                  13
Yes, a graph...๏ you know the common data structures                                        13
Yes, a graph...๏ you know the common data structures  •linked lists, trees, object "graphs"                               ...
Yes, a graph...๏ you know the common data structures   •linked lists, trees, object "graphs"๏ a graph is the general purpo...
Yes, a graph...๏ you know the common data structures   •linked lists, trees, object "graphs"๏ a graph is the general purpo...
Yes, a graph...๏ you know the common data structures   •linked lists, trees, object "graphs"๏ a graph is the general purpo...
Yes, a graph...๏ you know the common data structures   •linked lists, trees, object "graphs"๏ a graph is the general purpo...
Yes, a graph...๏ you know the common data structures   •linked lists, trees, object "graphs"๏ a graph is the general purpo...
Yes, a graph...๏ you know the common data structures   •linked lists, trees, object "graphs"๏ a graph is the general purpo...
14
Everyone is talking about graphs...                                      14
Everyone is talking about graphs...Facebook Open Graph                                        14
Everyone is talking about graphs...Facebook Open Graph                                        14
Emils Graph
Emils Graph     Emil
Emils Graph     Peter                    Kerstin             EmilAndreas
Emils Graph          Peter             Johan                                        KerstinMichael            Emil        ...
Emils Graph          Peter             Johan                                                  star                        ...
Emils Graph          Peter             Johan                                                  star                        ...
Emils Graph          Peter             Johan                                                             star             ...
Emils Graph          Peter             Johan                                                             star             ...
Emils Graph                    Peter             Johandiamond                                                             ...
Emils Graph                     Peter             Johandiamond                                                            ...
Emils Graph                            Peter             Johan       diamond                                              ...
16
Well known named graphs                          16
Well known named graphs    star                          16
Well known named graphs    star     butterfly                          16
Well known named graphs    star     butterfly     diamond                                    16
Well known named graphs    star     butterfly     diamond   bull                                           16
Well known named graphs    star      butterfly    diamond   bull   franklin                                           16
Well known named graphs    star       butterfly   diamond   bull   franklin   robertson                                    ...
Well known named graphs    star       butterfly   diamond   bull   franklin   robertson   horton                           ...
Well known named graphs    star       butterfly   diamond        bull   franklin   robertson   horton    hall-janko        ...
16
Text       17
The best known of all possible graphs...                      Text                                           17
18
How can you use this?With a Graph Database                    18
A graph database...                      19
A graph database...๏ optimized for the connections between records                                                  19
A graph database...๏ optimized for the connections between records๏ really, really fast at querying across records        ...
A graph database...๏ optimized for the connections between records๏ really, really fast at querying across records๏ a data...
A graph database...๏ optimized for the connections between records๏ really, really fast at querying across records๏ a data...
20
You know relational                      20
You know relational                      20
You know relational         foo                      20
You know relational         foo          bar                            20
You know relational         foo   foo_bar   bar                               20
You know relational         foo   foo_bar   bar                               20
You know relational         foo   foo_bar   bar                               20
You know relational         foo   foo_bar   bar                               20
You know relationalnow consider relationships...                                20
You know relationalnow consider relationships...                                20
You know relationalnow consider relationships...                                20
You know relationalnow consider relationships...                                20
You know relationalnow consider relationships...                                20
You know relationalnow consider relationships...                                20
20
21
Were talking about aProperty Graph                        21
Were talking about aProperty Graph    Nodes                        21
Were talking about aProperty Graph    Nodes     Relationships                        21
Were talking about aProperty Graph                                            Em                                       Joh...
21
22
And, but, so how do youquery this "graph" database?                         22
23
Cypher - a graph query language๏ a pattern-matching query language๏ declarative grammar with clauses (like SQL)๏ aggregati...
Cypher - a graph query language๏ a pattern-matching query language๏ declarative grammar with clauses (like SQL)๏ aggregati...
Cypher - pattern matching                            24
Cypher - pattern matching                            24
Cypher - pattern matching                            24
Cypher - pattern matching                            24
Cypher - pattern matching                            24
Cypher - pattern matching                            24
Cypher - pattern matching                            24
Cypher - pattern matching syntax                                   25
Cypher - pattern matching syntax                                   25
Cypher - pattern matching syntax       () --> ()                                   25
Cypher - pattern matching syntax                                   26
Cypher - pattern matching syntax         A               B                                   26
Cypher - pattern matching syntax         A               B     (A) --> (B)                                   26
Cypher - pattern matching syntax                                   27
Cypher - pattern matching syntax         A               B                                   27
Cypher - pattern matching syntax         A               B      (A) -- (B)                                   27
Cypher - pattern matching syntax                                   28
Cypher - pattern matching syntax               LOVES         A               B                                   28
Cypher - pattern matching syntax               LOVES         A               B       A -[:LOVES]-> B                      ...
Cypher - pattern matching syntax                                   29
Cypher - pattern matching syntax   A             B             C                                   29
Cypher - pattern matching syntax   A             B             C  A --> B --> C                                   29
Cypher - pattern matching syntax                                   30
Cypher - pattern matching syntax                 A             B        C                                   30
Cypher - pattern matching syntax                 A             B        C  A --> B --> C, A --> C                         ...
Cypher - pattern matching syntax                 A             B        C  A --> B --> C, A --> C   A --> B --> C <-- A   ...
31
Cypher - read clauses                        31
Cypher - read clauses  // get node 1, traverse 2 steps away  START a=node(1) MATCH (a)--()--(c) RETURN c  // get node from...
Cypher - CREATE a node         A                         32
Cypher - CREATE a node          A  // create a person named Andreas  CREATE (a {name:Andreas})                            ...
Cypher - CREATE relationships                                33
Cypher - CREATE relationships                LOVES         A                 B                                33
Cypher - CREATE relationships                LOVES         A                 B       A -[:LOVES]-> B                      ...
Cypher - CREATE relationships                  LOVES          A                    B       A -[:LOVES]-> B  // create love...
Cypher - CREATE UNIQUE data                              34
Cypher - CREATE UNIQUE data              LOVES        A               B                              34
Cypher - CREATE UNIQUE data              LOVES        A               B      A -[:LOVES]-> B                              34
Cypher - CREATE UNIQUE data                  LOVES          A                    B       A -[:LOVES]-> B  // create love b...
Cypher - CREATE full path                            35
Cypher - CREATE full path                LOVES         A                  B                                35
Cypher - CREATE full path                LOVES         A                  B       A -[:LOVES]-> B                         ...
Cypher - CREATE full path                   LOVES           A                    B        A -[:LOVES]-> B   // create an e...
Cypher - update a Node         A                         36
Cypher - update a Node          A  // update the nerdiness of Andreas  START a=node:people(name=Andreas)  SET a.nerdiness ...
Cypher - DELETE data                       37
Cypher - DELETE data               LOVES         A             B                           37
Cypher - DELETE data               LOVES         A             B       A -[:LOVES]-> B                           37
Cypher - DELETE data                  LOVES          A                    B       A -[:LOVES]-> B  // Goodbye Anna! remove...
Github as a Graph                    38
Github - collaborative coding๏ Hosting of git repositories๏ Prominent social aspect   • follow other coders   • collaborat...
Github User Graph - simple                                 User   login: "octocat"   id: 1   avatar_url: "https://github.c...
Github User Graph - complete                                       akollegger    follows   jakewins                       ...
Github User Graph - complete                           akollegger    follows   jakewins                             follow...
Github User Graph - complete                                                               heroku                         ...
Github User Graph - complete                                                                                    heroku    ...
Github User Graph - complete                                                                                    heroku    ...
Github User Graph - complete                                                                                    heroku    ...
Github User Graph - complete                                                                                    heroku    ...
Github User Graph - complete                                                                                    heroku    ...
Workshop           42
Preparations๏Get on Github๏Get Neo4j                      43
What would you like to do?A.Data ImportB.Cypher Query ChallengeC.Graph Visualization                              44
Ready to Start? Go here...๏http://graphhub-east.github.com๏http://graphhub-west.github.com                                ...
46
and, Thanks :)                 46
Github in a Graph
Upcoming SlideShare
Loading in …5
×

Github in a Graph

818 views
730 views

Published on

A guide to graphs, using Github as an example data source.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
818
On SlideShare
0
From Embeds
0
Number of Embeds
13
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Github in a Graph

    1. 1. Github in a Graph with Neo4jAndreas Kollegger@akollegger#neo4j 1
    2. 2. 1
    3. 3. How well get the Octocat into the Graph 1.Intro to Graphs, Socially 2.Graph Database Essentials 3.Github as a Graph 4.Workshop! 2
    4. 4. Graphs... 3
    5. 5. Meet Emil...
    6. 6. Meet Emil... Emil
    7. 7. Meet Emil...๏ from: Sweden Emil
    8. 8. Meet Emil...๏ from: Sweden๏ appearance: blonde and handsome Emil
    9. 9. Meet Emil...๏ from: Sweden๏ appearance: blonde and handsome๏ personality: super friendly nerd Emil
    10. 10. Meet Emil...๏ from: Sweden๏ appearance: blonde and handsome๏ personality: super friendly nerd๏ interests: piano, pickled herring Emil
    11. 11. Emil has some friends Emil
    12. 12. Emil has some friends๏ Kerstin: his sister Emil Kerstin
    13. 13. Emil has some friends๏ Kerstin: his sister๏ Peter: his buddy Peter Emil Kerstin
    14. 14. Emil has some friends๏ Kerstin: his sister๏ Peter: his buddy๏ Andreas: me! Peter Emil Andreas Kerstin
    15. 15. His friends introduced more friends Peter Emil Andreas Kerstin
    16. 16. His friends introduced more friends๏ Michael: master hacker Michael Peter Emil Andreas Kerstin
    17. 17. His friends introduced more friends๏ Michael: master hacker๏ Johan: technology sage Michael Johan Peter Emil Andreas Kerstin
    18. 18. His friends introduced more friends๏ Michael: master hacker๏ Johan: technology sage๏ Madelene: polyglot journalist Michael Johan Peter Emil Andreas Madelene Kerstin
    19. 19. His friends introduced more friends๏ Michael: master hacker๏ Johan: technology sage๏ Madelene: polyglot journalist๏ Allison: marketing maven Allison Michael Johan Peter Emil Andreas Madelene Kerstin
    20. 20. So, we have a bunch of people Allison Michael Johan Peter Emil Andreas Madelene Kerstin
    21. 21. So, we have a bunch of people๏ how do we know they are friends? Allison Michael Johan Peter Emil Andreas Madelene Kerstin
    22. 22. So, we have a bunch of people๏ how do we know they are friends?๏ either ask each pair: are you friends? Allison Michael Johan Peter Emil Andreas Madelene Kerstin
    23. 23. So, we have a bunch of people๏ how do we know they are friends?๏ either ask each pair: are you friends?๏ or, we can add explicit connections Allison Michael Johan Peter Emil Andreas Madelene Kerstin
    24. 24. So, we have a bunch of people๏ how do we know they are friends?๏ either ask each pair: are you friends?๏ or, we can add explicit connections Allison Michael Johan Peter Emil Andreas Madelene Kerstin
    25. 25. Theres a problem here Allison Michael Johan Peter Emil Andreas Madelene Kerstin
    26. 26. Theres a problem here๏ Emil is awesome Allison Michael Johan Peter Emil Andreas Madelene Kerstin
    27. 27. Theres a problem here๏ Emil is awesome๏ What about other relationships? Allison Michael Johan Peter Emil Andreas Madelene Kerstin
    28. 28. Theres a problem here๏ Emil is awesome๏ What about other relationships?๏ We mentioned "introductions" so there mustve been at least some pre-existing connections Allison Michael Johan Peter Emil Andreas Madelene Kerstin
    29. 29. Theres a problem here๏ Emil is awesome๏ What about other relationships?๏ We mentioned "introductions" so there mustve been at least some pre-existing connections Allison Michael Johan Peter Emil Andreas Madelene Kerstin
    30. 30. This can continue... Allison Michael Johan Peter Emil Andreas Madelene Kerstin
    31. 31. This can continue... Allison Michael Johan Peter EmilAnna Andreas Adam Madelene Kerstin
    32. 32. This can continue...๏ this is how social networks grow Allison Michael Johan Peter Emil Anna Andreas Adam Madelene Kerstin
    33. 33. This can continue...๏ this is how social networks grow๏ either meet people directly Allison Michael Johan Peter Emil Anna Andreas Adam Madelene Kerstin
    34. 34. This can continue...๏ this is how social networks grow๏ either meet people directly๏ or be introduced Allison Michael Johan Peter Emil Anna Andreas Adam Madelene Kerstin
    35. 35. This can be useful Allison Michael Johan Peter EmilAnna Andreas Adam Madelene Kerstin
    36. 36. This can be useful๏ professional recommendation (LinkedIn) Allison Michael Johan Peter Emil Anna Andreas Adam Madelene Kerstin
    37. 37. This can be useful๏ professional recommendation (LinkedIn)๏ product recommendation (Amazon) Allison Michael Johan Peter Emil Anna Andreas Adam Madelene Kerstin
    38. 38. This can be useful๏ professional recommendation (LinkedIn)๏ product recommendation (Amazon)๏ restaurant recommendations (Yelp) Allison Michael Johan Peter Emil Anna Andreas Adam Madelene Kerstin
    39. 39. This can be useful๏ professional recommendation (LinkedIn)๏ product recommendation (Amazon)๏ restaurant recommendations (Yelp)๏ same domain, or reaching across domains Allison Michael Johan Peter Emil Anna Andreas Adam Madelene Kerstin
    40. 40. This is really just data Allison Michael Johan Peter EmilAnna Andreas Adam Madelene Kerstin
    41. 41. This is really just data๏ its just a graph Allison Michael Johan Peter Emil Anna Andreas Adam Madelene Kerstin
    42. 42. 12
    43. 43. A graph? 12
    44. 44. Yes, a graph... 13
    45. 45. Yes, a graph...๏ you know the common data structures 13
    46. 46. Yes, a graph...๏ you know the common data structures •linked lists, trees, object "graphs" 13
    47. 47. Yes, a graph...๏ you know the common data structures •linked lists, trees, object "graphs"๏ a graph is the general purpose data structure 13
    48. 48. Yes, a graph...๏ you know the common data structures •linked lists, trees, object "graphs"๏ a graph is the general purpose data structure •suitable for any connected data 13
    49. 49. Yes, a graph...๏ you know the common data structures •linked lists, trees, object "graphs"๏ a graph is the general purpose data structure •suitable for any connected data๏ well-understood patterns and algorithms 13
    50. 50. Yes, a graph...๏ you know the common data structures •linked lists, trees, object "graphs"๏ a graph is the general purpose data structure •suitable for any connected data๏ well-understood patterns and algorithms •studied since Leonard Eulers 7 Bridges (1736) 13
    51. 51. Yes, a graph...๏ you know the common data structures •linked lists, trees, object "graphs"๏ a graph is the general purpose data structure •suitable for any connected data๏ well-understood patterns and algorithms •studied since Leonard Eulers 7 Bridges (1736) •Codds Relational Model (1970) 13
    52. 52. Yes, a graph...๏ you know the common data structures •linked lists, trees, object "graphs"๏ a graph is the general purpose data structure •suitable for any connected data๏ well-understood patterns and algorithms •studied since Leonard Eulers 7 Bridges (1736) •Codds Relational Model (1970) •not a new idea, just an idea whos time is now 13
    53. 53. 14
    54. 54. Everyone is talking about graphs... 14
    55. 55. Everyone is talking about graphs...Facebook Open Graph 14
    56. 56. Everyone is talking about graphs...Facebook Open Graph 14
    57. 57. Emils Graph
    58. 58. Emils Graph Emil
    59. 59. Emils Graph Peter Kerstin EmilAndreas
    60. 60. Emils Graph Peter Johan KerstinMichael Emil Madelene Andreas Allison
    61. 61. Emils Graph Peter Johan star KerstinMichael Emil Madelene Andreas Allison
    62. 62. Emils Graph Peter Johan star KerstinMichael Emil Madelene Andreas Allison
    63. 63. Emils Graph Peter Johan star KerstinMichael Emil Madelene Andreas Allison butterfly
    64. 64. Emils Graph Peter Johan star KerstinMichael Emil Madelene Andreas Allison butterfly
    65. 65. Emils Graph Peter Johandiamond star Kerstin Michael Emil Madelene Andreas Allison butterfly
    66. 66. Emils Graph Peter Johandiamond star Kerstin Michael Emil Madelene Andreas Allison Anna butterfly Adam
    67. 67. Emils Graph Peter Johan diamond star Kerstin Michael Emil Madelene Andreas Allison Anna butterflybull Adam
    68. 68. 16
    69. 69. Well known named graphs 16
    70. 70. Well known named graphs star 16
    71. 71. Well known named graphs star butterfly 16
    72. 72. Well known named graphs star butterfly diamond 16
    73. 73. Well known named graphs star butterfly diamond bull 16
    74. 74. Well known named graphs star butterfly diamond bull franklin 16
    75. 75. Well known named graphs star butterfly diamond bull franklin robertson 16
    76. 76. Well known named graphs star butterfly diamond bull franklin robertson horton 16
    77. 77. Well known named graphs star butterfly diamond bull franklin robertson horton hall-janko 16
    78. 78. 16
    79. 79. Text 17
    80. 80. The best known of all possible graphs... Text 17
    81. 81. 18
    82. 82. How can you use this?With a Graph Database 18
    83. 83. A graph database... 19
    84. 84. A graph database...๏ optimized for the connections between records 19
    85. 85. A graph database...๏ optimized for the connections between records๏ really, really fast at querying across records 19
    86. 86. A graph database...๏ optimized for the connections between records๏ really, really fast at querying across records๏ a database: transactional with the usual operations 19
    87. 87. A graph database...๏ optimized for the connections between records๏ really, really fast at querying across records๏ a database: transactional with the usual operations๏ “A relational database may tell you the average age of everyone at this workshop, but a graph database will tell you who is most likely to buy you a beer.” 19
    88. 88. 20
    89. 89. You know relational 20
    90. 90. You know relational 20
    91. 91. You know relational foo 20
    92. 92. You know relational foo bar 20
    93. 93. You know relational foo foo_bar bar 20
    94. 94. You know relational foo foo_bar bar 20
    95. 95. You know relational foo foo_bar bar 20
    96. 96. You know relational foo foo_bar bar 20
    97. 97. You know relationalnow consider relationships... 20
    98. 98. You know relationalnow consider relationships... 20
    99. 99. You know relationalnow consider relationships... 20
    100. 100. You know relationalnow consider relationships... 20
    101. 101. You know relationalnow consider relationships... 20
    102. 102. You know relationalnow consider relationships... 20
    103. 103. 20
    104. 104. 21
    105. 105. Were talking about aProperty Graph 21
    106. 106. Were talking about aProperty Graph Nodes 21
    107. 107. Were talking about aProperty Graph Nodes Relationships 21
    108. 108. Were talking about aProperty Graph Em Joh il a n knows knows Alli Tob Lar Nodes son ias knows s knows And And knows knows rea rés s knows knows knows Pet Miic Mc knows Ian er knows a a knows knows De Mic lia h ael Relationships Properties (each a key+value) + Indexes (for easy look-ups) 21
    109. 109. 21
    110. 110. 22
    111. 111. And, but, so how do youquery this "graph" database? 22
    112. 112. 23
    113. 113. Cypher - a graph query language๏ a pattern-matching query language๏ declarative grammar with clauses (like SQL)๏ aggregation, ordering, limits๏ create, read, update, delete 23
    114. 114. Cypher - a graph query language๏ a pattern-matching query language๏ declarative grammar with clauses (like SQL)๏ aggregation, ordering, limits๏ create, read, update, delete // get node 1, traverse 2 steps away start a=node(1) match (a)--()--(c) return c // create a node with a name property CREATE (me {name: Andreas}) return me๏ more on this later... 23
    115. 115. Cypher - pattern matching 24
    116. 116. Cypher - pattern matching 24
    117. 117. Cypher - pattern matching 24
    118. 118. Cypher - pattern matching 24
    119. 119. Cypher - pattern matching 24
    120. 120. Cypher - pattern matching 24
    121. 121. Cypher - pattern matching 24
    122. 122. Cypher - pattern matching syntax 25
    123. 123. Cypher - pattern matching syntax 25
    124. 124. Cypher - pattern matching syntax () --> () 25
    125. 125. Cypher - pattern matching syntax 26
    126. 126. Cypher - pattern matching syntax A B 26
    127. 127. Cypher - pattern matching syntax A B (A) --> (B) 26
    128. 128. Cypher - pattern matching syntax 27
    129. 129. Cypher - pattern matching syntax A B 27
    130. 130. Cypher - pattern matching syntax A B (A) -- (B) 27
    131. 131. Cypher - pattern matching syntax 28
    132. 132. Cypher - pattern matching syntax LOVES A B 28
    133. 133. Cypher - pattern matching syntax LOVES A B A -[:LOVES]-> B 28
    134. 134. Cypher - pattern matching syntax 29
    135. 135. Cypher - pattern matching syntax A B C 29
    136. 136. Cypher - pattern matching syntax A B C A --> B --> C 29
    137. 137. Cypher - pattern matching syntax 30
    138. 138. Cypher - pattern matching syntax A B C 30
    139. 139. Cypher - pattern matching syntax A B C A --> B --> C, A --> C 30
    140. 140. Cypher - pattern matching syntax A B C A --> B --> C, A --> C A --> B --> C <-- A 30
    141. 141. 31
    142. 142. Cypher - read clauses 31
    143. 143. Cypher - read clauses // get node 1, traverse 2 steps away START a=node(1) MATCH (a)--()--(c) RETURN c // get node from an index, return it START a=node:users(login=akollegger) RETURN a // get node from an index, match, filter // with where, then return results START a=node:users(login=akollegger) MATCH (a)-[r]-(b) WHERE b.login=jakewins RETURN r,b 31
    144. 144. Cypher - CREATE a node A 32
    145. 145. Cypher - CREATE a node A // create a person named Andreas CREATE (a {name:Andreas}) 32
    146. 146. Cypher - CREATE relationships 33
    147. 147. Cypher - CREATE relationships LOVES A B 33
    148. 148. Cypher - CREATE relationships LOVES A B A -[:LOVES]-> B 33
    149. 149. Cypher - CREATE relationships LOVES A B A -[:LOVES]-> B // create love between two people START a=node:people(name=Andreas), b=node:people(name=Anna) CREATE a-[:LOVES]->(b) 33
    150. 150. Cypher - CREATE UNIQUE data 34
    151. 151. Cypher - CREATE UNIQUE data LOVES A B 34
    152. 152. Cypher - CREATE UNIQUE data LOVES A B A -[:LOVES]-> B 34
    153. 153. Cypher - CREATE UNIQUE data LOVES A B A -[:LOVES]-> B // create love between two people START a=node:people(name=Andreas), b=node:people(name=Anna) CREATE UNIQUE a-[:LOVES]->(b) 34
    154. 154. Cypher - CREATE full path 35
    155. 155. Cypher - CREATE full path LOVES A B 35
    156. 156. Cypher - CREATE full path LOVES A B A -[:LOVES]-> B 35
    157. 157. Cypher - CREATE full path LOVES A B A -[:LOVES]-> B // create an entire path at once CREATE p=(a {name:Andreas})-[:LOVES]-> (b {name:Anna}) return p 35
    158. 158. Cypher - update a Node A 36
    159. 159. Cypher - update a Node A // update the nerdiness of Andreas START a=node:people(name=Andreas) SET a.nerdiness = 10 36
    160. 160. Cypher - DELETE data 37
    161. 161. Cypher - DELETE data LOVES A B 37
    162. 162. Cypher - DELETE data LOVES A B A -[:LOVES]-> B 37
    163. 163. Cypher - DELETE data LOVES A B A -[:LOVES]-> B // Goodbye Anna! remove relationships START a=node:people(name=Anna) MATCH a-[r]-(b) DELETE a,r 37
    164. 164. Github as a Graph 38
    165. 165. Github - collaborative coding๏ Hosting of git repositories๏ Prominent social aspect • follow other coders • collaborate with other coders • branches and forks • watch repositories • star repositories 39
    166. 166. Github User Graph - simple User login: "octocat" id: 1 avatar_url: "https://github.com/images/error/octocat_happy.gif" gravatar_id: "somehexcode" url: "https://api.github.com/users/octocat" akollegger follows jakewins name: "monalisa octocat" company: "GitHub" blog: "https://github.com/blog" location: "San Francisco" email: "octocat@github.com" follows hireable: false follows bio: "There once was..." public_repos: 2 nawroth public_gists: 1 followers: 20 following: 0 html_url: "https://github.com/octocat" created_at: "2008-01-14T04:33:35Z" type: "User"details: http://developer.github.com 40
    167. 167. Github User Graph - complete akollegger follows jakewins follows follows nawrothdetails: http://developer.github.com 41
    168. 168. Github User Graph - complete akollegger follows jakewins follows follows nawrothdetails: http://developer.github.com 41
    169. 169. Github User Graph - complete heroku member of neo4j mattt follows member of akollegger follows jakewins owns follows follows FEC_GRAPH nawroth follows collaborates on jexpdetails: http://developer.github.com 41
    170. 170. Github User Graph - complete heroku member of neo4j mattt follows member of akollegger follows jakewins owns follows follows FEC_GRAPH nawroth follows collaborates on jexpdetails: http://developer.github.com 41
    171. 171. Github User Graph - complete heroku member of(user)-[:follows]->(users) neo4j mattt follows member of akollegger follows jakewins owns follows follows FEC_GRAPH nawroth follows collaborates on jexpdetails: http://developer.github.com 41
    172. 172. Github User Graph - complete heroku member of(user)-[:follows]->(users) neo4j mattt(user)-[:member_of]->(org) follows member of akollegger follows jakewins owns follows follows FEC_GRAPH nawroth follows collaborates on jexpdetails: http://developer.github.com 41
    173. 173. Github User Graph - complete heroku member of(user)-[:follows]->(users) neo4j mattt(user)-[:member_of]->(org)(user)-[:owns]->(repository) member of follows akollegger follows jakewins owns follows follows FEC_GRAPH nawroth follows collaborates on jexpdetails: http://developer.github.com 41
    174. 174. Github User Graph - complete heroku member of(user)-[:follows]->(users) neo4j mattt(user)-[:member_of]->(org)(user)-[:owns]->(repository) member of follows(user)-[:collaborates_on]->(repos) akollegger follows jakewins owns follows follows FEC_GRAPH nawroth follows collaborates on jexpdetails: http://developer.github.com 41
    175. 175. Workshop 42
    176. 176. Preparations๏Get on Github๏Get Neo4j 43
    177. 177. What would you like to do?A.Data ImportB.Cypher Query ChallengeC.Graph Visualization 44
    178. 178. Ready to Start? Go here...๏http://graphhub-east.github.com๏http://graphhub-west.github.com 45
    179. 179. 46
    180. 180. and, Thanks :) 46

    ×