Geekout Tallinn - Neo4j for the rescue!

2,757 views

Published on

Presentation by Peter Neubauer for http://geekout.ee/

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

No Downloads
Views
Total views
2,757
On SlideShare
0
From Embeds
0
Number of Embeds
101
Actions
Shares
0
Downloads
53
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • We have key-value stores, typically very highly available and scalable for simple key-value data\n
  • Column stores naturally-indexed value stores\n\nContrary to common belief – Google’s big table isn’t the world’s most famous column store\n\nBritish museum London is: it’s got columns and it’s where we stored all the stuff we nicked from the British Empire!\n
  • Document DB’s support for large-scale document storage, indexing documents, and processing them with batch-oriented frameworks.\n
  • We have graph databases that are well suited to complex, interconnected data\n\nSide note: Graph DB’s are unique in the NOSQL world, that they’re the only class of store that has a more expressive data model than RDBMS – all the others have gone for simpler data models to achieve scale/availability/throughput\n
  • Each database pulls various levers to achieve its aims:\n\nDurable -> ordered writes -> take your chances\nSharded -> replicated -> take your chances\nConsistent -> eventually consistent -> take your chances\n\nNeo4j takes the ACID always approach\n
  • We should be in data-Nirvana\n\nWe have a range of data models to choose from\nWe have a range of products to select that support those models\nWe have a range of tuning that we can apply to those products \n\nWe should be able to craft exactly the right platform for our data needs\n
  • And then we fall back on old habits: trying to find the one true Database to rule them all. \n*sigh*\n\nKV stores pushing up against Document stores\nColumn stores pushing up against KV stores\nDocument stores wading into graphs\n\nAnd all the time all four NOSQL models are being poorly grafted onto our deal old RDMBS’es!\n
  • Let’s take a closer look at the damage we’re doing\n
  • We can encode shallow graph-like data in document stores if we like (or even RDBMS like twitter)\n\nIt starts off looking nice and easy!\n
  • At runtime the application code sucks in the data and reifies a graph.\n\nOK, so that’s code you have to test and write, but the datamodel is just documents, so that’s OK right?\n
  • Compared to a graph database, it’s actually hard work\n\nA graph DB stores data naturally in graphs so you don’t have to deal with that concern in your code – you deal with true application concerns \n\n-> index free traversal of big data FAST\n
  • I’ve got a bad feeling about this…\n
  • Imagine we want to sell things to our little social network\n\nIn a graph it’s easy to record purchase history as relationships between buyers and products (and it doesn’t slow down as buyers and products grow in number unlike joins in a relational DB)\n\nIn a document DB, the structure is implicit, and it’s up to our application code to make sense of it.\nWhat do we do here? Put buyers in the product documents? Products in the people documents? Create purchase documents that join the two?\n\nWhat about a product recall, or social selling (example later on)?\nIn a graph DB it’s O(1) search operation to find out who bought a product.\nIn a document DB it’s an O(N) compute job to figure this out\n
  • EE\n
  • EE\n
  • EE\n
  • Lightweight and embedded: single jar of ~500k [demo]\n
  • Fully transactional: ie complete ACID, supports JTA/JTS, 2PC, deadlock detection, transaction recovery and all the rest [demo]\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Graphs over 1M nodes\nNetwork Management\nMaster Data Management\nSocial\nFinance\nSpatial\nOther\nBioinformatics\nRDF\nRouting, Logistics\n\n
  • Storage:\nplugable – dataset, layer, encoder\nSearch:\nIndexing is currently an R-Tree, but it is possible to plug in any custom mechanism conforming to the interface.\nMulti-dimensional index\nSpatial indices (quad-tree, R-tree, kn-tree, SFCs)\nComposite indices and dynamic indices\nLucene\n
  • EE\n
  • • includes high performance graph algorithms\n• routes with live changing data \n• integrates easily with any domain graph\n
  • We have graph databases that are well suited to complex, interconnected data\n\nSide note: Graph DB’s are unique in the NOSQL world, that they’re the only class of store that has a more expressive data model than RDBMS – all the others have gone for simpler data models to achieve scale/availability/throughput\n
  • • traverses millions of friends per second\n• maps directly to friend-of-a-friend\n• quickly performs deep recommendations\n
  • • explores what-if failures\n• reveals root cause\n• determines actual operating cost\n
  • • explores what-if failures\n• reveals root cause\n• determines actual operating cost\n
  • • can handle billions of ad-hoc relationships \n• traverses millions of nodes per second\n• maps directly to your MDM domain\n
  • • can handle billions of ad-hoc relationships \n• traverses millions of nodes per second\n• maps directly to your MDM domain\n
  • • can handle billions of ad-hoc relationships \n• traverses millions of nodes per second\n• maps directly to your MDM domain\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Storage:\nplugable – dataset, layer, encoder\nSearch:\nIndexing is currently an R-Tree, but it is possible to plug in any custom mechanism conforming to the interface.\nMulti-dimensional index\nSpatial indices (quad-tree, R-tree, kn-tree, SFCs)\nComposite indices and dynamic indices\nLucene\n
  • \n
  • \n
  • Geekout Tallinn - Neo4j for the rescue!

    1. 1. GeekOut Tallinn Estonia! #neo4jPeter Neubauer @peterneubauerNeo Technology peter@neotechnology.com
    2. 2. First, a recap: NOSQL data models Key-value stores Data size Column Family Document databases Graph databases We are here Data complexity
    3. 3. h"p://www.flickr.com/photos/crazyneighborlady/355232758/
    4. 4. h"p://gallery.nen.gov.uk/image82582‐.html
    5. 5. h"p://www.xtranormal.com/watch/6995033/mongo‐db‐is‐web‐scale
    6. 6. h"p://www.orangesmile.com/desFnaFons/img/berlin‐map‐metro‐big.gif
    7. 7. h"p://malden‐dsme.co.uk/public/hcj.html
    8. 8. h"p://easystreetdiscount.aucFvacommerce.com/Nirvana‐Smiley‐Face‐Music‐Band‐Decal‐SFcker‐P188162.aspx
    9. 9. h"p://www.tolkienlibrary.com/press/922‐Isildur_Poker_Champion.php
    10. 10. h"p://www.vaccineFmes.com/wp‐content/uploads/2010/12/microscope.jpg
    11. 11. username: Jeff1986 username: SallyDJ username: FunkySam username: Gazza age: 25 age: 28 age: 24 age: 32 friend : SallyDJ friend : Jeff1986 friend : SallyDJ friend : Jeff1986 friend : Gazza friend: FunkySam Document
Database
    12. 12. username: SallyDJ age: 28 username: Gazza username: Jeff1986 username: FunkySam age: 32 age: 25 age: 24 ApplicaFon
Layer Reifyusername: Jeff1986 username: SallyDJ username: FunkySam username: Gazza age: 25 age: 28 age: 24 age: 32 friend : SallyDJ friend : Jeff1986 friend : SallyDJ friend : Jeff1986 friend : Gazza friend: FunkySam Document
Database
    13. 13. username: SallyDJ age: 28 FRI FRIEND END FRIENDusername: Gazza username: Jeff1986 username: FunkySam age: 32 age: 25 age: 24 Graph
Database
    14. 14. h"p://www.freewebs.com/ficFonfrek101/han.jpg
    15. 15. username: Gazza username: SallyDJ age: 32 age: 28 PURCHASED PURCHASED ED CHAS PUR product: SuperCans product: CoolDecks manufacturer : Acme manufacturer : Acme price : 150 price : 599 Graph
Databaseproduct: SuperCans product: CoolDecks username: SallyDJ username: Gazza age: 28 age: 32manufacturer : Acme manufacturer : Acme purchased : CoolDecks purchased : SuperCans price : 150 price : 599 purchased : SuperCans Document
Database
    16. 16. The Neo4j model: Property Graph
    17. 17. The Neo4j model: Property Graph 1 2 3
    18. 18. The Neo4j model: Property Graph 1 2 3
    19. 19. The Neo4j model: Property Graph name = “Emil” age = 29 sex = “yes” 1 2 type = KNOWS time = 4 years 3 type = car vendor = “SAAB” model = “95 Aero”
    20. 20. Building a node space (core API)
    21. 21. Building a node space (core API)GraphDatabaseService graphDb = ... // Get factory// Create Thomas Neo AndersonNode mrAnderson = graphDb.createNode();mrAnderson.setProperty( "name", "Thomas Anderson" );mrAnderson.setProperty( "age", 29 );// Create MorpheusNode morpheus = graphDb.createNode();morpheus.setProperty( "name", "Morpheus" );morpheus.setProperty( "rank", "Captain" );morpheus.setProperty( "occupation", "Total bad ass" );// Create a relationship representing that they know each othermrAnderson.createRelationshipTo( morpheus, RelTypes.KNOWS );// ...create Trinity, Cypher, Agent Smith, Architect similarly
    22. 22. Building a node spaceGraphDatabaseService graphDb = ... // Get factoryTransaction tx = graphdb.beginTx();// Create Thomas Neo AndersonNode mrAnderson = graphDb.createNode();mrAnderson.setProperty( "name", "Thomas Anderson" );mrAnderson.setProperty( "age", 29 );// Create MorpheusNode morpheus = graphDb.createNode();morpheus.setProperty( "name", "Morpheus" );morpheus.setProperty( "rank", "Captain" );morpheus.setProperty( "occupation", "Total bad ass" );// Create a relationship representing that they know each othermrAnderson.createRelationshipTo( morpheus, RelTypes.KNOWS );// ...create Trinity, Cypher, Agent Smith, Architect similarlytx.commit();
    23. 23. We want answers!
    24. 24. // Instantiate a traverser that returns Mr Andersons friends
    25. 25. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse(
    26. 26. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST,
    27. 27. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH,
    28. 28. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE,
    29. 29. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE, RelTypes.KNOWS,
    30. 30. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE, RelTypes.KNOWS, Direction.OUTGOING );
    31. 31. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE, RelTypes.KNOWS, Direction.OUTGOING );// Traverse the node space and print out the result
    32. 32. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE, RelTypes.KNOWS, Direction.OUTGOING );// Traverse the node space and print out the resultSystem.out.println( "Mr Andersons friends:" );
    33. 33. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE, RelTypes.KNOWS, Direction.OUTGOING );// Traverse the node space and print out the resultSystem.out.println( "Mr Andersons friends:" );for ( Node friend : friendsTraverser )
    34. 34. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE, RelTypes.KNOWS, Direction.OUTGOING );// Traverse the node space and print out the resultSystem.out.println( "Mr Andersons friends:" );for ( Node friend : friendsTraverser ){
    35. 35. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE, RelTypes.KNOWS, Direction.OUTGOING );// Traverse the node space and print out the resultSystem.out.println( "Mr Andersons friends:" );for ( Node friend : friendsTraverser ){ System.out.printf( "At depth %d => %s%n",
    36. 36. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE, RelTypes.KNOWS, Direction.OUTGOING );// Traverse the node space and print out the resultSystem.out.println( "Mr Andersons friends:" );for ( Node friend : friendsTraverser ){ System.out.printf( "At depth %d => %s%n", friendsTraverser.currentPosition().getDepth(),
    37. 37. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE, RelTypes.KNOWS, Direction.OUTGOING );// Traverse the node space and print out the resultSystem.out.println( "Mr Andersons friends:" );for ( Node friend : friendsTraverser ){ System.out.printf( "At depth %d => %s%n", friendsTraverser.currentPosition().getDepth(), friend.getProperty( "name" ) );
    38. 38. // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE, RelTypes.KNOWS, Direction.OUTGOING );// Traverse the node space and print out the resultSystem.out.println( "Mr Andersons friends:" );for ( Node friend : friendsTraverser ){ System.out.printf( "At depth %d => %s%n", friendsTraverser.currentPosition().getDepth(), friend.getProperty( "name" ) );}
    39. 39. gem install neo4j
    40. 40. gem install neo4jrequire ”rubygems”
    41. 41. gem install neo4jrequire ”rubygems”require neo4j
    42. 42. gem install neo4jrequire ”rubygems”require neo4jclass Person
    43. 43. gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin
    44. 44. gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation
    45. 45. gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name
    46. 46. gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name has_n :friends
    47. 47. gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name has_n :friendsend
    48. 48. gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name has_n :friendsendNeo4j::Transactoin.run do
    49. 49. gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name has_n :friendsendNeo4j::Transactoin.run do neo = Person.new :name=>Neo, :age=>29
    50. 50. gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name has_n :friendsendNeo4j::Transactoin.run do neo = Person.new :name=>Neo, :age=>29 morpheus = Person.new :name=>Morpheus, :occupation=>badass
    51. 51. gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name has_n :friendsendNeo4j::Transactoin.run do neo = Person.new :name=>Neo, :age=>29 morpheus = Person.new :name=>Morpheus, :occupation=>badass neo.friends << morpheus
    52. 52. gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name has_n :friendsendNeo4j::Transactoin.run do neo = Person.new :name=>Neo, :age=>29 morpheus = Person.new :name=>Morpheus, :occupation=>badass neo.friends << morpheusend
    53. 53. gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name has_n :friendsendNeo4j::Transactoin.run do neo = Person.new :name=>Neo, :age=>29 morpheus = Person.new :name=>Morpheus, :occupation=>badass neo.friends << morpheusendneo.friends.each {|p|...}
    54. 54. Cypher - Pattern Matcing für alle
    55. 55. Cypher - Pattern Matcing für alle//All nodes related to n
    56. 56. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x
    57. 57. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by A
    58. 58. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x
    59. 59. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x//All BLOCKS relationships outgoing from n
    60. 60. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x//All BLOCKS relationships outgoing from nstart n=(3) match (n)-[r, :BLOCKS]->() return r
    61. 61. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x//All BLOCKS relationships outgoing from nstart n=(3) match (n)-[r, :BLOCKS]->() return r//Diamond shape pattern
    62. 62. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x//All BLOCKS relationships outgoing from nstart n=(3) match (n)-[r, :BLOCKS]->() return r//Diamond shape patternstart a=(3)
    63. 63. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x//All BLOCKS relationships outgoing from nstart n=(3) match (n)-[r, :BLOCKS]->() return r//Diamond shape patternstart a=(3)match (a)-[:KNOWS]->(b)-[:KNOWS]->(c), (a)-[:BLOCKS]-(d)-[:KNOWS]-(c)
    64. 64. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x//All BLOCKS relationships outgoing from nstart n=(3) match (n)-[r, :BLOCKS]->() return r//Diamond shape patternstart a=(3)match (a)-[:KNOWS]->(b)-[:KNOWS]->(c), (a)-[:BLOCKS]-(d)-[:KNOWS]-(c)return a,b,c,d
    65. 65. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x//All BLOCKS relationships outgoing from nstart n=(3) match (n)-[r, :BLOCKS]->() return r//Diamond shape patternstart a=(3)match (a)-[:KNOWS]->(b)-[:KNOWS]->(c), (a)-[:BLOCKS]-(d)-[:KNOWS]-(c)return a,b,c,d//Where RegExp
    66. 66. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x//All BLOCKS relationships outgoing from nstart n=(3) match (n)-[r, :BLOCKS]->() return r//Diamond shape patternstart a=(3)match (a)-[:KNOWS]->(b)-[:KNOWS]->(c), (a)-[:BLOCKS]-(d)-[:KNOWS]-(c)return a,b,c,d//Where RegExpstart n=(2, 1) where n.name =~ /Tob.*/ return n
    67. 67. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x//All BLOCKS relationships outgoing from nstart n=(3) match (n)-[r, :BLOCKS]->() return r//Diamond shape patternstart a=(3)match (a)-[:KNOWS]->(b)-[:KNOWS]->(c), (a)-[:BLOCKS]-(d)-[:KNOWS]-(c)return a,b,c,d//Where RegExpstart n=(2, 1) where n.name =~ /Tob.*/ return n//FOAF
    68. 68. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x//All BLOCKS relationships outgoing from nstart n=(3) match (n)-[r, :BLOCKS]->() return r//Diamond shape patternstart a=(3)match (a)-[:KNOWS]->(b)-[:KNOWS]->(c), (a)-[:BLOCKS]-(d)-[:KNOWS]-(c)return a,b,c,d//Where RegExpstart n=(2, 1) where n.name =~ /Tob.*/ return n//FOAFstart user = (people-index,name,”John”)
    69. 69. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x//All BLOCKS relationships outgoing from nstart n=(3) match (n)-[r, :BLOCKS]->() return r//Diamond shape patternstart a=(3)match (a)-[:KNOWS]->(b)-[:KNOWS]->(c), (a)-[:BLOCKS]-(d)-[:KNOWS]-(c)return a,b,c,d//Where RegExpstart n=(2, 1) where n.name =~ /Tob.*/ return n//FOAFstart user = (people-index,name,”John”)match (user)-[:friend]->()-[:friend]->(foaf)
    70. 70. Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x//All nodes that are BLOCKed by Astart n=(3) match (n)-[:BLOCKS]->(x) return x//All BLOCKS relationships outgoing from nstart n=(3) match (n)-[r, :BLOCKS]->() return r//Diamond shape patternstart a=(3)match (a)-[:KNOWS]->(b)-[:KNOWS]->(c), (a)-[:BLOCKS]-(d)-[:KNOWS]-(c)return a,b,c,d//Where RegExpstart n=(2, 1) where n.name =~ /Tob.*/ return n//FOAFstart user = (people-index,name,”John”)match (user)-[:friend]->()-[:friend]->(foaf)return user, foaf
    71. 71. g = new Neo4jGraph(/tmp/neo4j)
    72. 72. g = new Neo4jGraph(/tmp/neo4j)// calculate basic collaborative filtering for vertex1
    73. 73. g = new Neo4jGraph(/tmp/neo4j)// calculate basic collaborative filtering for vertex1m = [:]
    74. 74. g = new Neo4jGraph(/tmp/neo4j)// calculate basic collaborative filtering for vertex1m = [:]g.v(1).out(likes).in(likes).out(likes).groupCount(m)
    75. 75. g = new Neo4jGraph(/tmp/neo4j)// calculate basic collaborative filtering for vertex1m = [:]g.v(1).out(likes).in(likes).out(likes).groupCount(m)m.sort{a,b -> a.value <=> b.value}
    76. 76. So - what do I use this for?
    77. 77. Financial data – fraud detection name = ... name = “The Tavern” lat = 1295238237name = “Mr Godfather” long = 234823492 W 42karma = veeeery-low D RAcash = more-than-you amount = $1000 H IT W OWNS TRANSFER WIT 1 7 3 HDR AW 13 FER DE name = “Emil” PO cash = always-too-lil TRANS SI T title = “ATM @ Wall St” id = 230918484233 amount = $1000 cash_left = 384204 2 name = ...
    78. 78. Routing
    79. 79. h"p://www.transportdublin.ie/
‐
Paddy
Fitzgerald
on
Neo4j
    80. 80. Social graphs Recommendations Location based services Influencers Shortest path
    81. 81. Impact Analytics, CMDB, NetworkManagement, Provisioning
    82. 82. Impact Analytics, CMDB, NetworkManagement, Provisioning
    83. 83. Master Data Management
    84. 84. Master Data Management
    85. 85. Master Data Management
    86. 86. Multiple indexes - GIS
    87. 87. Neo4j dynamic layers Geometry Layer1 Encoder Dynamic Query Layer2 Dynamic Styles Layer3 Dynamic Meta-InfConnected domain data Neo4j Spatial GIS and Spatial stacks
    88. 88. OpenStreetMap
    89. 89. Cell network analysis
    90. 90. Text Texthttp://test.eeni.tbm.tudelft.nl/~alfredas/d13n-graph.png
    91. 91. Demo time! Image credit: lost again! Sorry :(
    92. 92. “Linking Open Data cloud diagram, by Richard Cyganiak and Anja Jentzsch. http://lod-cloud.net/”
    93. 93. http://neotechnology.com 43

    ×