• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Geekout Tallinn - Neo4j for the rescue!
 

Geekout Tallinn - Neo4j for the rescue!

on

  • 2,564 views

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

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

Statistics

Views

Total Views
2,564
Views on SlideShare
2,472
Embed Views
92

Actions

Likes
1
Downloads
46
Comments
0

7 Embeds 92

http://geekout.ee 81
http://www.linkedin.com 3
http://twitter.com 2
http://paper.li 2
http://geekoutevent.wordpress.com 2
http://a0.twimg.com 1
https://www.linkedin.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \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! Geekout Tallinn - Neo4j for the rescue! Presentation Transcript

  • GeekOut Tallinn Estonia! #neo4jPeter Neubauer @peterneubauerNeo Technology peter@neotechnology.com
  • First, a recap: NOSQL data models Key-value stores Data size Column Family Document databases Graph databases We are here Data complexity
  • h"p://www.flickr.com/photos/crazyneighborlady/355232758/
  • h"p://gallery.nen.gov.uk/image82582‐.html
  • h"p://www.xtranormal.com/watch/6995033/mongo‐db‐is‐web‐scale
  • h"p://www.orangesmile.com/desFnaFons/img/berlin‐map‐metro‐big.gif
  • h"p://malden‐dsme.co.uk/public/hcj.html
  • h"p://easystreetdiscount.aucFvacommerce.com/Nirvana‐Smiley‐Face‐Music‐Band‐Decal‐SFcker‐P188162.aspx
  • h"p://www.tolkienlibrary.com/press/922‐Isildur_Poker_Champion.php
  • h"p://www.vaccineFmes.com/wp‐content/uploads/2010/12/microscope.jpg
  • 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
  • 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
  • username: SallyDJ age: 28 FRI FRIEND END FRIENDusername: Gazza username: Jeff1986 username: FunkySam age: 32 age: 25 age: 24 Graph
Database
  • h"p://www.freewebs.com/ficFonfrek101/han.jpg
  • 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
  • The Neo4j model: Property Graph
  • The Neo4j model: Property Graph 1 2 3
  • The Neo4j model: Property Graph 1 2 3
  • 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”
  • Building a node space (core API)
  • 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
  • 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();
  • We want answers!
  • // Instantiate a traverser that returns Mr Andersons friends
  • // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse(
  • // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST,
  • // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH,
  • // Instantiate a traverser that returns Mr Andersons friendsTraverser friendsTraverser = mrAnderson.traverse( Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE,
  • // 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,
  • // 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 );
  • // 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
  • // 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:" );
  • // 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 )
  • // 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 ){
  • // 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",
  • // 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(),
  • // 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" ) );
  • // 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" ) );}
  • gem install neo4j
  • gem install neo4jrequire ”rubygems”
  • gem install neo4jrequire ”rubygems”require neo4j
  • gem install neo4jrequire ”rubygems”require neo4jclass Person
  • gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin
  • gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation
  • gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name
  • gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name has_n :friends
  • gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name has_n :friendsend
  • gem install neo4jrequire ”rubygems”require neo4jclass Person include Neo4j::NodeMixin property :name, :age, :occupation index :name has_n :friendsendNeo4j::Transactoin.run do
  • 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
  • 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
  • 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
  • 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
  • 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|...}
  • Cypher - Pattern Matcing für alle
  • Cypher - Pattern Matcing für alle//All nodes related to n
  • Cypher - Pattern Matcing für alle//All nodes related to nstart n=(3) match (n)--(x) return x
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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)
  • 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)
  • 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
  • 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
  • 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
  • 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
  • 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”)
  • 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)
  • 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
  • g = new Neo4jGraph(/tmp/neo4j)
  • g = new Neo4jGraph(/tmp/neo4j)// calculate basic collaborative filtering for vertex1
  • g = new Neo4jGraph(/tmp/neo4j)// calculate basic collaborative filtering for vertex1m = [:]
  • g = new Neo4jGraph(/tmp/neo4j)// calculate basic collaborative filtering for vertex1m = [:]g.v(1).out(likes).in(likes).out(likes).groupCount(m)
  • 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}
  • So - what do I use this for?
  • 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 = ...
  • Routing
  • h"p://www.transportdublin.ie/
‐
Paddy
Fitzgerald
on
Neo4j
  • Social graphs Recommendations Location based services Influencers Shortest path
  • Impact Analytics, CMDB, NetworkManagement, Provisioning
  • Impact Analytics, CMDB, NetworkManagement, Provisioning
  • Master Data Management
  • Master Data Management
  • Master Data Management
  • Multiple indexes - GIS
  • Neo4j dynamic layers Geometry Layer1 Encoder Dynamic Query Layer2 Dynamic Styles Layer3 Dynamic Meta-InfConnected domain data Neo4j Spatial GIS and Spatial stacks
  • OpenStreetMap
  • Cell network analysis
  • Text Texthttp://test.eeni.tbm.tudelft.nl/~alfredas/d13n-graph.png
  • Demo time! Image credit: lost again! Sorry :(
  • “Linking Open Data cloud diagram, by Richard Cyganiak and Anja Jentzsch. http://lod-cloud.net/”
  • http://neotechnology.com 43