Hands on Neo4j 2.0

294
-1

Published on

Neo4j is the world's leading graph database, and with the advent of the new, shiny 2.0.x releases it's time to get into it.

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

  • Be the first to like this

No Downloads
Views
Total Views
294
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Hands on Neo4j 2.0

  1. 1. Hands on Neo4j 2.0 Dr. Jim Webber! Chief Scientist, Neo Technology! @jimwebber
  2. 2. roadmap • where we are (mostly) • imprisoned data • a little history • labeled property graph model • connected data • using a whiteboard http://flickr.com/photos/23465812@N00/7898643042 by davecito, CC BY
  3. 3. Neo Technology, Inc Confidential Drupal8 Schema - Copyright drupal.org
  4. 4. Neo Technology, Inc Confidential TABLES? ARGGHHH
  5. 5. Neo Technology, Inc Confidentialhttp://flickr.com/photos/keepingtime_ca/8490224742 by keepingtime_ca, CC BY
  6. 6. Neo Technology, Inc ConfidentialBy AgnosticPreachersKid (Own work) [CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons
  7. 7. Neo Technology, Inc Confidential http://flickr.com/photos/rueful/5917659410/ by Kiran Foster, CC BY
  8. 8. “There is a significant downside - the whole approach works really well when data access is aligned with the aggregates, but what if you want to look at the data in a different way? Order entry naturally stores orders as aggregates, but analyzing product sales cuts across the aggregate structure. The advantage of not using an aggregate structure in the database is that it allows you to slice and dice your data different ways for different audiences. ! This is why aggregate-oriented stores talk so much about map-reduce.” – Martin Fowler, http://martinfowler.com/bliki/AggregateOrientedDatabase.html
  9. 9. Neo Technology, Inc Confidentialhttp://flickr.com/photos/wwworks/5319295174 by woodleywonderworks, CC BY
  10. 10. Neo Technology, Inc Confidential Copyright TFL (Transport For London)
  11. 11. Leonhard Euler (1707 - 1783) Image by Jakob Emanuel Handmann [Public domain], via Wikimedia Commons
  12. 12. Neo Technology, Inc Confidential Image is US Public Domain A B D C
  13. 13. A B D C
  14. 14. http://flickr.com/photos/samchurchill/8022804713 by Sam Churchill, CC BY
  15. 15. Copyright Facebook
  16. 16. [CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons
  17. 17. By Euan Richard (Own work) [CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons
  18. 18. % of People Who Hate Michael Jackson by Date 0 25 50 75 100 June 25, 2009 June 26,2009 Not a Graph
  19. 19. Customers AccountsCustomer_Accounts 143 Alice 143 326 143 725 143 981 326 $100 725 $632 981 $212
  20. 20. name: Alice bal: $100 bal: $632 bal: $212 Nodes Relationships owns owns owns Customer Account Account Account
  21. 21. Labeled Property Graph Model • Nodes with optional labels and optional properties • Named, directed Relationships with optional properties
 (Relationships have exactly one start and one end node, which may be the same node)
  22. 22. modeling start with a whiteboard
  23. 23. Flight_Delay id flight_id delay_time reason_id Airport id name city_id City id name Flight id date flight_number origin_airport_id destination_airport_id scheduled_departure scheduled_arrival Reason id name Flight_Diversion id flight_id airport_id
  24. 24. SELECT r.name as reason, count(*) as result_count FROM Flight f INNER JOIN Airport o ON Airport.id = Flight.origin_airport_id, INNER JOIN Airport d ON Airport.id = Flight.destination_airport_id, INNER JOIN Flight_Delay fd ON Airport.id = Flight_Delay.flight_id INNER JOIN Reason r ON Flight_Delay.reason_id = Reason.id WHERE o.name = "SFO" AND d.name = "JFK" GROUP BY r.name ORDER BY result_count DESC Fail
  25. 25. (o)<-[:ORIGIN]-(f) (f)-[:DESTINATION]->(d) (f)-[:CANCELLED_BY]->(r)
  26. 26. (o)<-[:ORIGIN]-(f) (f)-[:DESTINATION]->(d) (f)-[:CANCELLED_BY]->(r) MATCH , , WHERE o.code = "SFO" AND d.code = "JFK" RETURN r.name AS reason, count(*) AS count ORDER BY count DESC
  27. 27. MATCH (o)<-[:ORIGIN]-(f)-[:DESTINATION]->(d), (f)-[:CANCELLED_BY]->(r) WHERE o.code = "SFO" AND d.code = "JFK" RETURN r.name AS reason, count(*) AS count ORDER BY count DESC
  28. 28. MATCH  (customer)-­‐[:BOUGHT]-­‐>()-­‐[:IN*]-­‐>(:Category  {name:'Baby'}),              (customer)-­‐[:BOUGHT]-­‐>()-­‐[:IN*]-­‐>(:Category  {name:'Beer'})   WHERE  NOT  (customer)-­‐[:BOUGHT]-­‐>()-­‐[:IN*]-­‐>(:Category  {name:'Console'})   RETURN  customer
  29. 29. A Demo? Using Neo4j 2.0.3 for Retail Analytics in minutes
  30. 30. What’s Neo4j good for? • Recommendations • Social networks • Content Management • MDM / System-of-Record • Product Catalogue • Financial Audit / Modeling • Business intelligence • Data centre management • Supply chain/provenance • Routing • Web of things • Time series/event data • Web analytics, user journeys • Scientific computing • Spatial • Geo/Seismic/Meteorological • Bio/Pharma • And much, much more…
  31. 31. Aviation Finance Accenture AerospaceEnergy Software Financial Telecoms Health Web / Social Media Education, Logistics, Government Network &
 Data Center MDM / System
 Of Record Social Geo Recommendations Identity &
 Access Control Content
 Management Business Intel.,
 Audit, CRM
  32. 32. Resources • Graph Databases Book (O’Reilly) • Full, free eBook version available:
 http://graphdatabases.com • New, free online training: • http://www.neo4j.org/learn/ online_course
  33. 33. @jimwebber jim@neotechnolgy.com Questions? And big thanks to eSynergy for hosting!

×