Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Building a recommendation engine with tinker pop

535 views

Published on

Building a recommendation engine with tinker pop

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Building a recommendation engine with tinker pop

  1. 1. Building a recommendation engine with TinkerPop Otávio Santana @otaviojava osantana@tomitribe.com otaviojava@apache.org
  2. 2. NoSQL ● Database ● Doesn't use structure ● Not Transaction ● BASE ● Types
  3. 3. Graph ● Neo4j ● InfoGrid ● Sones ● HyperGraphDB Apollo Ares Kratoswas killed by was killed by Is brother killed killed
  4. 4. SQL Key-value Document Column Graph Table Bucket Collection Column Family Vertex and Edge Row Key/value pair Document Column Vertex Column Key/value pair Key/value pair Vertex and Edge property Relationship Link Edge
  5. 5. Scalability vs Complexity S c a l a b i l i t y Complexity
  6. 6. Scalability vs Complexity S c a l a b i l i t y Complexity key-value Column Document Graph
  7. 7. Graph Grace Hopper label Person id ada name Ada Lovelace occupation scientist Ada Lovelace label Person id grace name Grace Hopper occupation scientist Knows Vertex Vertex Edge
  8. 8. Graph Radioactive label Person id marie_curie name Marie Curie occupation scientist Marie Curie label nature id radioactive name Radioactive discovers when 1867 where Europe
  9. 9. Graph Database
  10. 10. TinkerPop
  11. 11. TinkerPop Grace Hopper label Person id grace name Grace Hopper occupation scientist Vertex grace = graph.addVertex( T.label, "person", "id", "grace", "name", "Grace Hopper", "occupation", "scientist");
  12. 12. TinkerPop Grace Hopper Ada Lovelace Knows grace.addEdge("knows", ada);
  13. 13. Edges Out -> In <- Both
  14. 14. Marketing Campaign ● Engineer ● Salary 3000 ● Age between 20 and 25 years ● Man
  15. 15. SQLId name Occupation Salary age gender ... ... ... ... ... ... SELECT * FROM Person WHERE occupation = "Engineer" AND salary > 3000 and age BETWEEN 20 AND 25
  16. 16. TinkerPopGrace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25));
  17. 17. SQLId name Occupation Salary age gender ... ... ... ... ... ... SELECT name FROM Person WHERE occupation = "Engineer" AND salary > 3000 and age BETWEEN 20 AND 25
  18. 18. TinkerPopGrace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25)) .values("name");
  19. 19. SQLId name Occupation Salary age gender ... ... ... ... ... ... SELECT count(*) FROM Person WHERE occupation = "Engineer" AND salary > 3000 and age BETWEEN 20 AND 25
  20. 20. TinkerPopGrace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25)) .count();
  21. 21. TinkerPopGrace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25)) .groupCount() .by(“city”);
  22. 22. Their Friends
  23. 23. SQLId name Occupation Salary age gender ... ... ... ... ... ... SELECT * FROM Person WHERE occupation = "Engineer" AND salary > 3000 and age BETWEEN 20 AND 25//...joins Id know ... ...
  24. 24. TinkerPopGrace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25)) .out("knows");
  25. 25. Falling in love
  26. 26. SQLId name Occupation Salary age gender ... ... ... ... ... ... SELECT * FROM Person WHERE occupation = "Engineer" AND salary > 3000 and age BETWEEN 20 AND 25//...joins Id know ... ... Id love ... ...
  27. 27. TinkerPopGrace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25)) .outE("knows") .has("feel", "love") .bothV();
  28. 28. g.V().repeat(out("eats")) .times(3); g.V().repeat(out("eats")) .until(has("name", "grass")); //path().by("name");
  29. 29. TinkerPop
  30. 30. Our database is too slow and not big enough! We need NoSql!
  31. 31. Thank You Otávio Santana @otaviojava osantana@tomitribe.com otaviojava@apache.org

×