Pro Yearly is on sale from $80 to $50! »

Neo4j and Me

Aac3dafaab7a7c2063d2526ba5936305?s=47 Glenn
July 08, 2015

Neo4j and Me

In this talk, Glenn explains how he got started using graph databases, in particular Neo4j, and how graph databases will be used in the Colleague Locator application at Bankwest. He will also give a brief introduction to Graphs and Graph Databases, a few demos, and some of the pros and cons of Neo4j.

Aac3dafaab7a7c2063d2526ba5936305?s=128

Glenn

July 08, 2015
Tweet

Transcript

  1. Neo4j and Me

  2. Me • 14 years in Desktop Engineering and IT Navy,

    Government, Mining, Finance, Corporate • DevOps advocate • Not a database admin or java expert
  3. Tip #1 Don’t believe what I say. Find out for

    yourselves
  4. Like all good stories, It all started at the pub…

  5. Tip #2 Pub lunches are an untapped learning opportunity

  6. So, what is a graph?

  7. None
  8. None
  9. Tip #3 A whiteboard diagram is a good indicator versus

  10. What then is a graph database?

  11. Graph Document Key-value Column

  12. “In computing, a graph database is a database that uses

    graph structures for semantic queries with nodes, edges, and properties to represent and store data. A graph database is any storage system that provides index-free adjacency” -Wikipedia
  13. AllegroGraph Horton OpenLink Virtuoso SPARQLCity ArangoDB HyperGraphDB OQGRAPH Sqrrl Enterprise

    Bigdata IBM System G Native Store Oracle NoSQL Database Stardog Bitsy InfiniteGraph Oracle Spatial and Graph Teradata Aster BrightstarDB InfoGrid OrientDB Titan Cayley jCoreDB Graph Orly Trinity DEX/Sparksee MapGraph Profium Sense TripleBit Filament Neo4j R2DF VelocityGraph GraphBase OhmDB ROIS VertexDB Graphd Ontotext GraphDB sones GraphDB Weaver Lots to choose from…
  14. Tip #4 Know your use case

  15. What was my use case?

  16. Colleague Locator Find people Find rooms and resources

  17. Finding People User Laptop Switch Port Desk Map Wifi

  18. Tip #5 Graphs are everywhere

  19. Why did I choose Neo4j?

  20. My Requirements • Had to run on Windows • Needed

    a C# client • Needed a REST API for querying
  21. My Requirements • Had to run on Windows • Needed

    different client languages • Needed a REST API for querying
  22. Neo4j Features • Cypher query language • Good community support

    • Community version is free • Easy to install • Schema-less not structure-less • Good training resources
  23. Neo4j Java bonus Features • Java is first class citizen

    • Embedded version as well as standalone
  24. Cypher CRUD Examples

  25. C R U D

  26. MATCH (p) RETURN p

  27. MATCH (p) RETURN p LIMIT 20

  28. MATCH [r] RETURN r LIMIT 20

  29. MATCH (p:Person { name:‘Glenn Sarti’ }) RETURN p

  30. MATCH (fav:Person)-[:FAVOURITE_OF]-> (:Person {name:‘Glenn Sarti’}) RETURN fav

  31. C R U D

  32. CREATE (:Person { name:’Glenn Sarti’, title:’SOE Engineer’ })

  33. MATCH (me:Person {name:’Glenn Sarti’}) MATCH (mgr:Person {name:’Alice’}) CREATE (me)-[:MANAGED_BY]->(mgr)

  34. CREATE (:Person { name:’Glenn Sarti’, title:’SOE Engineer’ })-[:MANAGED_BY]->(:Person { name:’Alice’,

    title:’SOE Manager’ })
  35. C R U D

  36. MATCH (me:Person { name:’Glenn Sarti’ }) SET me += {

    title:‘CEO’, age: 21 }
  37. MATCH (me:Person { name:’Glenn Sarti’ }) SET me = {

    title:‘CEO’, age: 21 }
  38. MATCH (me:Person { name:’Glenn Sarti’ }) SET me:Employee

  39. MERGE (p:Person {name:’Glenn Sarti’}) ON CREATE SET p.created = timestamp()

    ON MATCH SET p.accessTime = timestamp()
  40. C R U D

  41. MATCH (me:Person:Employee { name:’Glenn Sarti }) REMOVE me.title, me:Employee

  42. MATCH (n:Person { name:’Glenn Sarti’ })-[r]-() DELETE n,r

  43. C R+ U D

  44. MATCH path = shortestPath( (:Person { name:‘Glenn Sarti’}) -[:FAVOURITE_OF*..6]-> (:Person

    { title: ‘CEO’}) ) RETURN nodes(path)
  45. MATCH (theirfav:Person) -[:FAVOURITE_OF*2..4]-> (me:Person {name:‘Glenn Sarti’}) WHERE (theirfav <> me)

    AND NOT ( (me)<-[:FAVOURITE_OF]-(theirfav) ) WITH theirfav,COUNT(theirfav) as Popularity RETURN theirfav,Popularity ORDER BY Popularity DESC LIMIT 5
  46. How do you start?

  47. None
  48. Tip #6 Low barrier of entry

  49. Other use cases

  50. JVM Heap Analysis with Neo4j https://speakerdeck.com/npryce

  51. jQAssistant http://jqassistant.org/ http://jexp.de/blog/2014/06/geekout-software-analytics-with-graphs/

  52. Maven repository importer for Neo4j https://github.com/rickardoberg/neomvn

  53. GraphGists http://graphgist.neo4j.com/#!/gists

  54. Tip #7 Try it. You may discover something awesome

  55. Why not Neo4j?

  56. GPL v3 License could be restrictive Community version does not

    include clustering Commercial version can be expensive
  57. Alternatives to Neo4j

  58. None
  59. @GlennSarti https://github.com/GlennSarti https://speakerdeck.com/glennsarti http://en.wikipedia.org/wiki/Graph_database http://neo4j.com http://graphdatabases.com All images are copyright

    of their respective owners