Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Let’s Make Graph Databases Fun Again with Java [DEV6043]

144 vues

Publié le

It’s a fact: today NoSQL databases are very popular in several areas of the software industry. They have many different uses cases, including graphs. The graph database has a structure that’s pretty different from relational technology and has a lot of successful use cases such as recommendation systems on Facebook and LinkedIn. This session covers what a graph database is and how to use it with Java. With a useful and practical live demo of career recommendation with Neo4J, you will learn how easy it could be to build your next successful application. Today!

Publié dans : Technologie
  • Soyez le premier à commenter

Let’s Make Graph Databases Fun Again with Java [DEV6043]

  1. 1. Stark Rogers Romanoff Banners Berlin São Paulo Moscow San Francisco Medellin
  2. 2. Stark Rogers Romanoff Banners Berlin São Paulo Moscow San Francisco MedellinBusiness Fun
  3. 3. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13.
  4. 4. name Tony Stark nationality American hero Iron man power rich when 2011 why Save the world who flying type Fun name San Francisco country USA State California Founded 1776
  5. 5. NoSQL ● Database ● Doesn't use ● ● BASE ● Five different types
  6. 6. SQL Key-value Column Document Graph Table Bucket Column Family Collection Row Key/value pair Column Document Vertex Column Key/value pair Key/value pair Vertex and Edge property Relationship Link Edge
  7. 7. S c a l a b i l i t y Complexity key-value Column Document Graph
  8. 8. Graph ● Neo4j ● InfoGrid ● Sones ● HyperGraphDB Apollo Ares Kratoswas killed by was killed by Is brother killed killed
  9. 9. 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
  10. 10. Radioactive label Person id marie_curie name Marie Curie occupation scientist Marie Curie label nature id radioactive name Radioactive discovers when 1867 where Europe
  11. 11. 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. Grace Hopper Ada Lovelace Knows grace.addEdge("knows", ada);
  13. 13. Out -> In <- Both
  14. 14. ● ● ●
  15. 15. Id name Occupation Salary age gender ... ... ... ... ... ... SELECT * FROM Person WHERE occupation = "Engineer" AND salary > 3000 and age BETWEEN 20 AND 25
  16. 16. Grace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25));
  17. 17. Id name Occupation Salary age gender ... ... ... ... ... ... SELECT name FROM Person WHERE occupation = "Engineer" AND salary > 3000 and age BETWEEN 20 AND 25
  18. 18. Grace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25)) .values("name");
  19. 19. Id name Occupation Salary age gender ... ... ... ... ... ... SELECT count(*) FROM Person WHERE occupation = "Engineer" AND salary > 3000 and age BETWEEN 20 AND 25
  20. 20. Grace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25)) .count();
  21. 21. Grace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25)) .groupCount() .by(“city”);
  22. 22. Id name Occupation Salary age gender ... ... ... ... ... ... SELECT * FROM Person WHERE occupation = "Engineer" AND salary > 3000 and age BETWEEN 20 AND 25//...joins Id know ... ...
  23. 23. Grace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25)) .out("knows");
  24. 24. Id 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 ... ...
  25. 25. Grace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25)) .outE("knows") .has("feel", "love") .bothV();
  26. 26. g.V().repeat(out("eats")) .times(3); g.V().repeat(out("eats")) .until(has("name", "grass")); //path().by("name");
  27. 27. ● Mapping API ● Communication API ● No lock-in ● Divide and conquer DAO Mapping Communication Document Key Column Graph DIANA ARTEMIS Data Tier
  28. 28. ● CDI Based ● Diana Based ● Annotation Based ● Events to insert, delete, update ● Supports to Bean Validation ● Configurable and Extensible ● Query Method
  29. 29. Poliana label Book age 2007 name The Shack The Shack label Person name Poliana age 25 reads where Brazil
  30. 30. Person poliana = graphTemplate.insert(Person.builder() .withName("Poliana").withAge(25).build()); Book shack = graphTemplate.insert(Book.builder().withAge(2007) .withName("The Shack").build()); EdgeEntity reads = graphTemplate.edge(poliana, "reads", shack); reads.add("where", "Brazil");
  31. 31. ● ● ●
  32. 32. List<Person> developers = graph.getTraversalVertex() .has("salary", gte(3_000D)) .has("age", between(20, 25)) .has("occupation", "Developer") .<Person>stream().collect(toList());
  33. 33. List<Person> result = graph.getTraversalVertex() .has("salary", gte(3_000D)) .has("age", between(20, 25)) .has("occupation", "Developer") .out("knows")
  34. 34. List<Person> love = graph.getTraversalVertex() .has("salary", gte(3_000D)) .has("age", between(20, 25)) .has("occupation", "Developer") .outE("knows") .has("feel", "love") .bothV() .<Person>stream() .distinct() .collect(toList());

×