1 / 32

Square Pegs and Round Holes on the NOSQL World

Square Pegs and Round Holes on the NOSQL World. Jim Webber Chief Scientist, Neo Technology @ jimwebber. Koans A free tutorial that gets you up to speed with Neo4j through hacking. http:// bit.ly /neo4j-koan https:// github.com / jimwebber /neo4j-tutorial. N ot O nly S QL.

jaegar
Download Presentation

Square Pegs and Round Holes on the NOSQL World

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Square Pegs and Round Holes on the NOSQL World Jim Webber Chief Scientist, Neo Technology @jimwebber

  2. KoansA free tutorial that gets you up to speed with Neo4j through hacking http://bit.ly/neo4j-koan https://github.com/jimwebber/neo4j-tutorial

  3. Not OnlySQL Remember that NOSQL means

  4. http://www.flickr.com/photos/crazyneighborlady/355232758/

  5. http://gallery.nen.gov.uk/image82582-.html

  6. http://www.xtranormal.com/watch/6995033/mongo-db-is-web-scalehttp://www.xtranormal.com/watch/6995033/mongo-db-is-web-scale

  7. http://www.orangesmile.com/destinations/img/berlin-map-metro-big.gifhttp://www.orangesmile.com/destinations/img/berlin-map-metro-big.gif

  8. Creating Nodes GraphDatabaseServicedb = new EmbeddedGraphDatabase("/tmp/neo"); Transaction tx = db.beginTx(); try { Node theDoctor = db.createNode(); theDoctor.setProperty("name", "the Doctor"); tx.success(); } finally { tx.finish(); }

  9. Creating Relationships Transaction tx = db.beginTx(); try { Node theDoctor= db.createNode(); theDoctor.setProperty("name", "The Doctor"); Node susan= db.createNode(); susan.setProperty("firstname", "Susan"); susan.setProperty("lastname", "Campbell"); susan.createRelationshipTo(theDoctor, DynamicRelationshipType.withName("COMPANION_OF")); tx.success(); } finally { tx.finish(); }

  10. http://malden-dsme.co.uk/public/hcj.html

  11. http://easystreetdiscount.auctivacommerce.com/Nirvana-Smiley-Face-Music-Band-Decal-Sticker-P188162.aspxhttp://easystreetdiscount.auctivacommerce.com/Nirvana-Smiley-Face-Music-Band-Decal-Sticker-P188162.aspx

  12. http://www.tolkienlibrary.com/press/922-Isildur_Poker_Champion.phphttp://www.tolkienlibrary.com/press/922-Isildur_Poker_Champion.php

  13. http://www.vaccinetimes.com/wp-content/uploads/2010/12/microscope.jpghttp://www.vaccinetimes.com/wp-content/uploads/2010/12/microscope.jpg

  14. Document Database username: Jeff1986 age: 25 friend : SallyDJ friend : Gazza username: SallyDJ age: 28 friend : Jeff1986 friend: FunkySam username: FunkySam age: 24 friend : SallyDJ username: Gazza age: 32 friend : Jeff1986

  15. Application Layer username: SallyDJ age: 28 username: Jeff1986 age: 25 username: FunkySam age: 24 username: Gazza age: 32 Reify Document Database username: Jeff1986 age: 25 friend : SallyDJ friend : Gazza username: SallyDJ age: 28 friend : Jeff1986 friend: FunkySam username: FunkySam age: 24 friend : SallyDJ username: Gazza age: 32 friend : Jeff1986

  16. Graph Database username: SallyDJ age: 28 FRIEND FRIEND username: Jeff1986 age: 25 username: FunkySam age: 24 FRIEND username: Gazza age: 32

  17. http://www.freewebs.com/fictionfrek101/han.jpg

  18. Graph Database username: Gazza age: 32 username: SallyDJ age: 28 PURCHASED PURCHASED PURCHASED product: SuperCans manufacturer : Acme price : 150 product: CoolDecks manufacturer : Acme price : 599 Document Database product: SuperCans manufacturer : Acme price : 150 product: CoolDecks manufacturer : Acme price : 599 username: SallyDJ age: 28 purchased : CoolDecks purchased : SuperCans username: Gazza age: 32 purchased : SuperCans

  19. http://xkcd.com/653/

  20. Graph Database username: Jeff1986 age: 25 username: FunkySam age: 24 FRIEND username: Gazza age: 32 FRIEND FRIEND username: SallyDJ age: 28 PURCHASED PURCHASED PURCHASED product: SuperCans manufacturer : Acme price : 150 product: CoolDecks manufacturer : Acme price : 599

  21. http://void.iddqd.cz/comic-book-guy-pc.jpg

  22. Graph Algorithms What’s the shortest path between the Doctor and the Master? Node theMaster = … Node theDoctor = … intmaxDepth = 5; PathFinder<Path> shortestPathFinder = GraphAlgoFactory.shortestPath(Traversal.expanderForAllTypes(), maxDepth); Path shortestPath= shortestPathFinder.findSinglePath(theDoctor, theMaster);

  23. Path finding Find all the episodes where Rose Tyler fought the Daleks

  24. Path finder code algo Node rose = ... Node daleks = ... PathFinder<Path> pathFinder = GraphAlgoFactory.pathsWithLength(Traversal.expanderForTypes(DoctorWhoUniverse.APPEARED_IN, Direction.BOTH), 2); Iterable<Path> paths = pathFinder.findAllPaths(rose, daleks); constraints fixed path length

  25. !PURCHASED product: CoolDecks manufacturer : Acme age: < 40 PURCHASED product: SuperCans manufacturer : Acme

  26. Why graph matching? • It’s super-powerful for looking for patterns in a data set • TW has done retail analytics PoCs (and hopefully projects) with this stuff • Higher-level abstraction than raw traversers • Uses PatternNode and PatternRelationship types to describe graph patterns • The “unbound” parts of the graph

  27. In which episodes did the Doctor battle the Cybermen?

  28. Setting up and matching a pattern final PatternNodetheDoctor = new PatternNode(); theDoctor.setAssociation(universe.theDoctor()); final PatternNodeanEpisode = new PatternNode(); anEpisode.addPropertyConstraint("title", CommonValueMatchers.has()); anEpisode.addPropertyConstraint("episode", CommonValueMatchers.has()); final PatternNodeaDoctorActor = new PatternNode(); aDoctorActor.createRelationshipTo(theDoctor, DoctorWhoUniverse.PLAYED); aDoctorActor.createRelationshipTo(anEpisode, DoctorWhoUniverse.APPEARED_IN); aDoctorActor.addPropertyConstraint("actor", CommonValueMatchers.has()); final PatternNodetheCybermen = new PatternNode(); theCybermen.setAssociation(universe.speciesIndex.get("species", "Cyberman").getSingle()); theCybermen.createRelationshipTo(anEpisode, DoctorWhoUniverse.APPEARED_IN); theCybermen.createRelationshipTo(theDoctor, DoctorWhoUniverse.ENEMY_OF); PatternMatchermatcher = PatternMatcher.getMatcher(); final Iterable<PatternMatch> matches = matcher.match(theDoctor, universe.theDoctor());

  29. http://male-ejaculation.net/

  30. http://www.561studios.com/blog/wp-content/uploads/2010/07/commonsense.jpghttp://www.561studios.com/blog/wp-content/uploads/2010/07/commonsense.jpg

  31. Questions? Community: http://neo4j.org Koans: https://github.com/jimwebber/neo4j-tutorial Me: @jimwebber, jim@neotechnology.com

More Related