Lunch and Learn         Neo4jAndreas Kollegger@akollegger#neo4j                    1
Lunch and Learn         Neo4jAndreas Kollegger@akollegger#neo4j                    1
Lunch and Learn         Neo4jAndreas Kollegger@akollegger#neo4j                    1
1
Graph DB 101               2
3
You know relational                      3
You know relational                      3
You know relational          foo                      3
You know relational          foo         bar                            3
You know relational          foo   foo_bar   bar                                3
You know relational          foo   foo_bar   bar                                3
You know relational          foo   foo_bar   bar                                3
You know relational          foo   foo_bar   bar                                3
You know relationalnow consider relationships...                                3
You know relationalnow consider relationships...                                3
You know relationalnow consider relationships...                                3
You know relationalnow consider relationships...                                3
You know relationalnow consider relationships...                                3
You know relationalnow consider relationships...                                3
3
4
Were talking about aProperty Graph                        4
Were talking about aProperty Graph    Nodes                        4
Were talking about aProperty Graph    Nodes     Relationships                        4
Were talking about aProperty Graph                                            Em                                       Joh...
4
5
Webadmin           5
6
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...
Neo4j - the Graph Database                        7
With love, from Sweden๏ 2001 - a Swedish media asset project   •CTO Emil prototyped a proper graph interface   •first SQL-b...
Neo4j is a Graph Database                            9
Neo4j is a Graph Database๏ A Graph Database:                            9
Neo4j is a Graph Database๏ A Graph Database:   • a Property Graph with Nodes, Relationships     and Properties on both    ...
Neo4j is a Graph Database๏ A Graph Database:   • a Property Graph with Nodes, Relationships     and Properties on both   •...
Neo4j is a Graph Database๏ A Graph Database:   • a Property Graph with Nodes, Relationships     and Properties on both   •...
Neo4j is a Graph Database๏ A Graph Database:   • a Property Graph with Nodes, Relationships     and Properties on both   •...
Neo4j is a Graph Database๏ A Graph Database:   • a Property Graph with Nodes, Relationships     and Properties on both   •...
Neo4j is a Graph Database๏ A Graph Database:   • a Property Graph with Nodes, Relationships     and Properties on both   •...
Neo4j is a Graph Database๏ A Graph Database:   • a Property Graph with Nodes, Relationships     and Properties on both   •...
the Real World                 10
11
Real World Use Cases:                        11
Real World Use Cases:•   [A] Mmm Pancakes                        11
Real World Use Cases:•[A] Mmm Pancakes• [B] ACL from Hell                        11
Real World Use Cases:•[A] Mmm Pancakes• [B] ACL from Hell• [C] Master of your Domain                              11
[A] Mmm Pancakes
[A] Mmm Pancakes
[A] Mozilla PancakeThis Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was ...
[A] Mozilla Pancake        • Experimental cloud-based browser        • Built to improve how users Discover,               ...
This Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not distributed wit...
Why Neo4J?This Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not distr...
Why Neo4J?        • The internet is a network of pages                  connected to each other. What                  bet...
Cute meta + dataThis Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not...
Cute meta + dataThis Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not...
Neo4J Co-Existence        • Node uuids as refs in external                  ElasticSearch also in internal Lucene        •...
Mozilla Pancake            Available on BitBucket:            https://bitbucket.org/            mozillapancake/pancake    ...
[B] ACL from HellOne of the top 10 telcos worldwide
BackgroundTelenor calculated in 2010 that it´s self-service web solution forcompanies, MinBedrift, would not scale with th...
[B] Telenor BackgroundBackgroundTelenor calculated in 2010 that it´s self-service web solution forcompanies, MinBedrift, w...
[B] Telenor Background• MinBedrif, a self service web  solution for companies     Background• 2010 - calculated that it wo...
Business CaseThe business case is built on the negative consequence of NOTaddressing the problem.                         ...
21
Current ACL Service                      21
Current ACL Service๏ Stored procedure in DB calculating all access   •cached results for up to 24 hours   •minutes to calc...
Example Access Authorization                                                                             UserAccess may be...
23
ACL With Neo4j                 23
ACL With Neo4j๏ Faster than current solution๏ Simpler to understand the logic๏ Avoid large temporary tables๏ Tailored for ...
[C] Master of your Domain
[C] MDM within Ciscomaster data management, sales compensation management, online customer supportDescription             ...
26
Really, once you start              thinking in graphs               its hard to stop          Recommendations       MDM  ...
Really, once you start              thinking in graphs               its hard to stop       What will you MDM        Recom...
27
Neo4jand, Thanks :)                 27
Lunch and learn cypher
Lunch and learn cypher
Lunch and learn cypher
Lunch and learn cypher
Lunch and learn cypher
Upcoming SlideShare
Loading in …5
×

Lunch and learn cypher

800 views
699 views

Published on

Easy introduction to the Neo4j graph database using the Cypher query language.

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

No Downloads
Views
Total views
800
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
47
Comments
0
Likes
2
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
  • Much richer data than flat history\nCan replay a user’s browsing session step-by-step\nExperimental features examples: recommendations, which pages to omit, etc.\n
  • Much richer data than flat history\nCan replay a user’s browsing session step-by-step\nExperimental features examples: recommendations, which pages to omit, etc.\n
  • Visualization done with GraphViz\nA user will have many such “stacks”\n
  • Search ranking weighs inbound and outbound node connections as part of search score calculation\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
  • Lunch and learn cypher

    1. 1. Lunch and Learn Neo4jAndreas Kollegger@akollegger#neo4j 1
    2. 2. Lunch and Learn Neo4jAndreas Kollegger@akollegger#neo4j 1
    3. 3. Lunch and Learn Neo4jAndreas Kollegger@akollegger#neo4j 1
    4. 4. 1
    5. 5. Graph DB 101 2
    6. 6. 3
    7. 7. You know relational 3
    8. 8. You know relational 3
    9. 9. You know relational foo 3
    10. 10. You know relational foo bar 3
    11. 11. You know relational foo foo_bar bar 3
    12. 12. You know relational foo foo_bar bar 3
    13. 13. You know relational foo foo_bar bar 3
    14. 14. You know relational foo foo_bar bar 3
    15. 15. You know relationalnow consider relationships... 3
    16. 16. You know relationalnow consider relationships... 3
    17. 17. You know relationalnow consider relationships... 3
    18. 18. You know relationalnow consider relationships... 3
    19. 19. You know relationalnow consider relationships... 3
    20. 20. You know relationalnow consider relationships... 3
    21. 21. 3
    22. 22. 4
    23. 23. Were talking about aProperty Graph 4
    24. 24. Were talking about aProperty Graph Nodes 4
    25. 25. Were talking about aProperty Graph Nodes Relationships 4
    26. 26. 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) 4
    27. 27. 4
    28. 28. 5
    29. 29. Webadmin 5
    30. 30. 6
    31. 31. Cypher - a graph query language๏ a pattern-matching query language๏ declarative grammar with clauses (like SQL)๏ aggregation, ordering, limits๏ create, read, update, delete 6
    32. 32. 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 with id 0 start a=node(0) return a // traverse from node 1 start a=node(1) match (a)-->(b) return b // return friends of friends start a=node(1) match (a)--()--(c) return c 6
    33. 33. Neo4j - the Graph Database 7
    34. 34. With love, from Sweden๏ 2001 - a Swedish media asset project •CTO Emil prototyped a proper graph interface •first SQL-backed, then revised down to bare metal •(just like Amazon->Dynamo, Facebook->Cassandra, Google-> Big Table, Sweden->Neo4j)๏ 2003 Neo4j went into 24/7 production๏ 2006-2007 - Neo4j was spun off as an open source project๏ 2009 seed funding for the company๏ 2010 Neo4j Server was created (previously only an embedded DB)๏ 2011 Series-A Funding, Top-Tier customers (gratuitous name dropping) 8
    35. 35. Neo4j is a Graph Database 9
    36. 36. Neo4j is a Graph Database๏ A Graph Database: 9
    37. 37. Neo4j is a Graph Database๏ A Graph Database: • a Property Graph with Nodes, Relationships and Properties on both 9
    38. 38. Neo4j is a Graph Database๏ A Graph Database: • a Property Graph with Nodes, Relationships and Properties on both • perfect for complex, highly connected data 9
    39. 39. Neo4j is a Graph Database๏ A Graph Database: • a Property Graph with Nodes, Relationships and Properties on both • perfect for complex, highly connected data๏ A Graph Database: 9
    40. 40. Neo4j is a Graph Database๏ A Graph Database: • a Property Graph with Nodes, Relationships and Properties on both • perfect for complex, highly connected data๏ A Graph Database: • reliable with real ACID Transactions 9
    41. 41. Neo4j is a Graph Database๏ A Graph Database: • a Property Graph with Nodes, Relationships and Properties on both • perfect for complex, highly connected data๏ A Graph Database: • reliable with real ACID Transactions • scalable: 32 Billion Nodes, 32 Billion Relationships, 64 Billion Properties 9
    42. 42. Neo4j is a Graph Database๏ A Graph Database: • a Property Graph with Nodes, Relationships and Properties on both • perfect for complex, highly connected data๏ A Graph Database: • reliable with real ACID Transactions • scalable: 32 Billion Nodes, 32 Billion Relationships, 64 Billion Properties • Server with REST API, or Embeddable on the JVM 9
    43. 43. Neo4j is a Graph Database๏ A Graph Database: • a Property Graph with Nodes, Relationships and Properties on both • perfect for complex, highly connected data๏ A Graph Database: • reliable with real ACID Transactions • scalable: 32 Billion Nodes, 32 Billion Relationships, 64 Billion Properties • Server with REST API, or Embeddable on the JVM • high-performance with High-Availability (read scaling) 9
    44. 44. the Real World 10
    45. 45. 11
    46. 46. Real World Use Cases: 11
    47. 47. Real World Use Cases:• [A] Mmm Pancakes 11
    48. 48. Real World Use Cases:•[A] Mmm Pancakes• [B] ACL from Hell 11
    49. 49. Real World Use Cases:•[A] Mmm Pancakes• [B] ACL from Hell• [C] Master of your Domain 11
    50. 50. [A] Mmm Pancakes
    51. 51. [A] Mmm Pancakes
    52. 52. [A] Mozilla PancakeThis Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/
    53. 53. [A] Mozilla Pancake • Experimental cloud-based browser • Built to improve how users Discover, Collect, Share & Organize things on the web • Goal: help users better access & curate information on the net, on any deviceThis Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/
    54. 54. This Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/
    55. 55. Why Neo4J?This Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/
    56. 56. Why Neo4J? • The internet is a network of pages connected to each other. What better way to model that than in graphs? • No time lost fighting with less expressive datastores • Easy to implement experimental featuresThis Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/
    57. 57. Cute meta + dataThis Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/
    58. 58. Cute meta + dataThis Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/
    59. 59. Neo4J Co-Existence • Node uuids as refs in external ElasticSearch also in internal Lucene • Custom search ranking for user history based on node relationship data • MySQL for user data, Redis for metricsThis Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/
    60. 60. Mozilla Pancake Available on BitBucket: https://bitbucket.org/ mozillapancake/pancake Questions? Olivier Yiptong: oyiptong@mozilla.comThis Material is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of theMPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/
    61. 61. [B] ACL from HellOne of the top 10 telcos worldwide
    62. 62. BackgroundTelenor calculated in 2010 that it´s self-service web solution forcompanies, MinBedrift, would not scale with the projectedcustomer and subscription growth beyond 2012. Limit th G row ted jec Pro 2010 2015
    63. 63. [B] Telenor BackgroundBackgroundTelenor calculated in 2010 that it´s self-service web solution forcompanies, MinBedrift, would not scale with the projectedcustomer and subscription growth beyond 2012. Limit th G row ted jec Pro 2010 2015
    64. 64. [B] Telenor Background• MinBedrif, a self service web solution for companies Background• 2010 - calculated that it would not Telenor calculated in 2010 that it´s self-service web solution for scale with projected growth companies, MinBedrift, would not scale with the projected customer and subscription growth beyond 2012. Limit th G row ted jec Pro 2010 2015
    65. 65. Business CaseThe business case is built on the negative consequence of NOTaddressing the problem. Loss of customers (income) Reduced sales transactions (income) Increased manual support (expenses) Other
    66. 66. 21
    67. 67. Current ACL Service 21
    68. 68. Current ACL Service๏ Stored procedure in DB calculating all access •cached results for up to 24 hours •minutes to calculate for large customers •extremely complex to understand (1500 lines) •depends on temporary tables •joins across multiple tables 21
    69. 69. Example Access Authorization UserAccess may be given directly or by inheritance Customer Account U Subscription U Inherit = true Inherit = false In C he rit =C C C tru e A A A A A S S S S S S S S S S
    70. 70. 23
    71. 71. ACL With Neo4j 23
    72. 72. ACL With Neo4j๏ Faster than current solution๏ Simpler to understand the logic๏ Avoid large temporary tables๏ Tailored for service (resource authorization) 23
    73. 73. [C] Master of your Domain
    74. 74. [C] MDM within Ciscomaster data management, sales compensation management, online customer supportDescription BenefitsReal-time conflict detection in sales compensation management. Performance : “Minutes to Milliseconds”Business-critical “P1” system. Neo4j allows Cisco to model complex Outperforms Oracle RAC, serving complex queries in real timealgorithms, which still maintaining high performance over a large Flexibilitydataset. Allows for Cisco to model interconnected data and complex queries with easeBackground RobustnessNeo4j replaces Oracle RAC, which was not performant enough for the With 9+ years of production experience, Neo4j brings a solid product.use case.Architecture3-node Enterprise cluster with mirroreddisaster recovery clusterDedicated hardware in own datacenterEmbedded in custom webappSizing35 million nodes50 million relationships600 million properties
    75. 75. 26
    76. 76. Really, once you start thinking in graphs its hard to stop Recommendations MDM Business intelligence Geospatial catalogs Systems access control Social computingManagement your brain Biotechnology routing genealogylinguistics Making Sense of all that compensation data market vectors 26
    77. 77. Really, once you start thinking in graphs its hard to stop What will you MDM Recommendations build? Business intelligence Geospatial catalogs Systems access control Social computingManagement your brain Biotechnology routing genealogylinguistics Making Sense of all that compensation data market vectors 26
    78. 78. 27
    79. 79. Neo4jand, Thanks :) 27

    ×