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 Java EE EE4J
Otávio Santana
@otaviojava
osantana@tomitribe.com
otaviojava@apache.org...
Evolution
Goods
● Land
● Gold
● Oil
● Information
Machines
The information is
not enough
Big Data
Web 3.0
Web Semantic
Next?
Recommendation
JCP
Ajax
Search
Collecting
Filtering
Stark
Rogers
Romanoff
Banners
Berlin
São Paulo
Moscow
San
Francisco
Medellin
Travel
Stark
Rogers
Romanoff
Banners
New York
São Paulo
Moscow
San
Francisco
Medellin
Travel
Business
Fun
Reasons why
travel
1. Fun
2. Conferences
3. Music
4. Geek Conf
5. Family
6. History
7. Language
8. Honeymoon
9. Work
10. M...
More Information
name Tony Stark
nationality American
hero Iron man
power rich
when 2011
why Save the world
who flying
typ...
NoSQL
● Database
● Doesn't use structure
● Not Transaction
● BASE
● Types
Graph
● Neo4j
● InfoGrid
● Sones
● HyperGraphDB
Apollo Ares
Kratoswas killed by was killed by
Is brother
killed killed
SQL Key-value Column Document Graph
Table Bucket Column
Family
Collection
Row Key/value
pair
Column Document Vertex
Column...
Scalability vs Complexity
S
c
a
l
a
b
i
l
i
t
y
Complexity
key-value
Column
Document
Graph
Graph
Grace Hopper
label Person
id ada
name Ada Lovelace
occupation scientist
Ada Lovelace
label Person
id grace
name Grac...
Graph Database
TinkerPop
http://tinkerpop.apache.org/
TinkerPop
Grace Hopper
label Person
id grace
name Grace Hopper
occupation scientist
Vertex
grace = graph.addVertex(
T.labe...
TinkerPop
Grace
Hopper
Ada
Lovelace
Knows
grace.addEdge("knows", ada);
Edges
Out ->
In <-
Both
Marketing
Campaign
● Engineer
● Salary 3000
● Age between 20 and 25 years
SQLId name Occupation Salary age gender
... ... ... ... ... ...
SELECT * FROM Person WHERE
occupation = "Engineer" AND
sal...
TinkerPopGrace
Hopper
Ada
Lovelace
Knows
g.V().has("occupation","Engineer")
.has("salary", gt(3000))
.has("age", between(2...
Their Friends
SQLId name Occupation Salary age gender
... ... ... ... ... ...
SELECT * FROM Person WHERE
occupation = "Engineer" AND
sal...
TinkerPopGrace
Hopper
Ada
Lovelace
Knows
g.V().has("occupation","Engineer")
.has("salary", gt(3000))
.has("age", between(2...
Falling in love
SQLId name Occupation Salary age gender
... ... ... ... ... ...
SELECT * FROM Person WHERE
occupation = "Engineer" AND
sal...
TinkerPopGrace
Hopper
Ada
Lovelace
Knows
g.V().has("occupation","Engineer")
.has("salary", gt(3000))
.has("age", between(2...
JNoSQL
● Mapping API
● Communication API
● No lock-in
● Divide and conquer
DAO
Mapping
Communication
Document
Key
Column
G...
Artemis● CDI Based
● Diana Based
● Annotation Based
● Events to insert, delete, update
● Supports to Bean Validation
● Con...
Graph Database
Graph
Poliana
label Book
age 2007
name The Shack
The Shack
label Person
name Poliana
age 25
reads
where Brazil
Graph
Person poliana = graphTemplate.insert(Person.builder()
.withName("Poliana").withAge(25).build());
Book shack =
graph...
Marketing
Campaign
● Engineer
● Salary 3000
● Age between 20 and 25 years
Developers
List<Person> developers = graph.getTraversalVertex()
.has("salary", gte(3_000D))
.has("age", between(20, 25))
....
Their Friends
People who developer knows
List<Person> result = graph.getTraversalVertex()
.has("salary", gte(3_000D))
.has("age", betwee...
Falling in love
People who developer loves
List<Person> love = graph.getTraversalVertex()
.has("salary", gte(3_000D))
.has("age", between(...
Book Recommendation
Software
Romance
NoSQL
Java
Micro Services
Effective Java
The Shack
Migrating to
Microservice
Database...
Software Categories
List<String> result = graph.getTraversalVertex()
.hasLabel("Category")
.has("name", "Software")
.in("i...
Query Method
interface PersonRepository extends Repository<Person, Long> {
List<Person> findByAddress(String address);
Str...
Demo
JNoSQL
Configuration
CDI 2.0 with Java SE
Neo4J + Docker
Thank You
Otávio Santana
@otaviojava
osantana@tomitribe.com
otaviojava@apache.org
Hilmer Chona
@hchona
hilac@msn.com
Building a Recommendation Engine with Java EE
Building a Recommendation Engine with Java EE
Building a Recommendation Engine with Java EE
Building a Recommendation Engine with Java EE
Upcoming SlideShare
Loading in …5
×

Building a Recommendation Engine with Java EE

747 views

Published on

Recommender systems have become increasingly popular in recent years and are utilized in a variety of areas, including movies, music, news, books, research articles, search queries, marketplaces, social tags, and products in general. A platform with a recommender system—such as NetFlix, with movies; dating systems, with relationships; and Amazon, with books—makes the user experience exceptional. This presentation covers how to create a recommendation engine with Java EE to rocket your business.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Building a Recommendation Engine with Java EE

  1. 1. Building a Recommendation Engine with Java EE EE4J Otávio Santana @otaviojava osantana@tomitribe.com otaviojava@apache.org Hilmer Chona @hchona hilac@msn.com MedellinJUG.org
  2. 2. Evolution
  3. 3. Goods ● Land ● Gold ● Oil ● Information
  4. 4. Machines
  5. 5. The information is not enough
  6. 6. Big Data
  7. 7. Web 3.0 Web Semantic
  8. 8. Next?
  9. 9. Recommendation
  10. 10. JCP
  11. 11. Ajax
  12. 12. Search
  13. 13. Collecting
  14. 14. Filtering
  15. 15. Stark Rogers Romanoff Banners Berlin São Paulo Moscow San Francisco Medellin Travel
  16. 16. Stark Rogers Romanoff Banners New York São Paulo Moscow San Francisco Medellin Travel Business Fun
  17. 17. Reasons why travel 1. Fun 2. Conferences 3. Music 4. Geek Conf 5. Family 6. History 7. Language 8. Honeymoon 9. Work 10. Meetings 11. University 12. Shopping 13. Relax
  18. 18. More Information 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 Travels
  19. 19. NoSQL ● Database ● Doesn't use structure ● Not Transaction ● BASE ● Types
  20. 20. Graph ● Neo4j ● InfoGrid ● Sones ● HyperGraphDB Apollo Ares Kratoswas killed by was killed by Is brother killed killed
  21. 21. 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 SQL vs NoSQL
  22. 22. Scalability vs Complexity S c a l a b i l i t y Complexity key-value Column Document Graph
  23. 23. 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
  24. 24. Graph Database
  25. 25. TinkerPop http://tinkerpop.apache.org/
  26. 26. 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");
  27. 27. TinkerPop Grace Hopper Ada Lovelace Knows grace.addEdge("knows", ada);
  28. 28. Edges Out -> In <- Both
  29. 29. Marketing Campaign ● Engineer ● Salary 3000 ● Age between 20 and 25 years
  30. 30. SQLId name Occupation Salary age gender ... ... ... ... ... ... SELECT * FROM Person WHERE occupation = "Engineer" AND salary > 3000 and age BETWEEN 20 AND 25
  31. 31. TinkerPopGrace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25));
  32. 32. Their Friends
  33. 33. SQLId name Occupation Salary age gender ... ... ... ... ... ... SELECT * FROM Person WHERE occupation = "Engineer" AND salary > 3000 and age BETWEEN 20 AND 25//...joins Id know ... ...
  34. 34. TinkerPopGrace Hopper Ada Lovelace Knows g.V().has("occupation","Engineer") .has("salary", gt(3000)) .has("age", between(20, 25)) .out("knows");
  35. 35. Falling in love
  36. 36. 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 ... ...
  37. 37. 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();
  38. 38. JNoSQL ● Mapping API ● Communication API ● No lock-in ● Divide and conquer DAO Mapping Communication Document Key Column Graph DIANA ARTEMIS JNoSQL Data Tier
  39. 39. Artemis● CDI Based ● Diana Based ● Annotation Based ● Events to insert, delete, update ● Supports to Bean Validation ● Configurable and Extensible ● Query Method
  40. 40. Graph Database
  41. 41. Graph Poliana label Book age 2007 name The Shack The Shack label Person name Poliana age 25 reads where Brazil
  42. 42. Graph Person poliana = graphTemplate.insert(Person.builder() .withName("Poliana").withAge(25).build()); Book shack = graphTemplate.insert(Book.builder().withAge(2007) .withName("The Shack").build()); EdgeEntity<Person, Book> reads = graphTemplate.edge(poliana, "reads", shack); reads.add("where", "Brazil");
  43. 43. Marketing Campaign ● Engineer ● Salary 3000 ● Age between 20 and 25 years
  44. 44. Developers List<Person> developers = graph.getTraversalVertex() .has("salary", gte(3_000D)) .has("age", between(20, 25)) .has("occupation", "Developer") .<Person>stream().collect(toList());
  45. 45. Their Friends
  46. 46. People who developer knows List<Person> result = graph.getTraversalVertex() .has("salary", gte(3_000D)) .has("age", between(20, 25)) .has("occupation", "Developer") .out("knows")
  47. 47. Falling in love
  48. 48. People who developer loves 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());
  49. 49. Book Recommendation Software Romance NoSQL Java Micro Services Effective Java The Shack Migrating to Microservice Databases NoSQL Distilled
  50. 50. Software Categories List<String> result = graph.getTraversalVertex() .hasLabel("Category") .has("name", "Software") .in("is") .hasLabel("Category").<Category>stream() .map(Category::getName) .collect(toList());
  51. 51. Query Method interface PersonRepository extends Repository<Person, Long> { List<Person> findByAddress(String address); Stream<Person> findByName(String name); Stream<Person> findByNameAndKnowsOutV(String name); Stream<Person> findByNameAndBothV(String name, String label); Optional<Person> findByNickname(String nickname); void deleteByNickName(String nickname); }
  52. 52. Demo JNoSQL Configuration CDI 2.0 with Java SE Neo4J + Docker
  53. 53. Thank You Otávio Santana @otaviojava osantana@tomitribe.com otaviojava@apache.org Hilmer Chona @hchona hilac@msn.com

×