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.
Artem  Chebotko  
Solution  Architect
Traversing  Graphs  with  Gremlin
1 Introduction  to  Graphs
2 Modeling  Data  as  Property  Graphs
3 Graph  Traversal  Language  “Gremlin”
4 Gremlin  Trave...
Why  Graph?
• Everything  is  connected  to  everything  else  
• Connections  or  relationships  are  important
©  DataSt...
Graph  Use  Cases
©  DataStax,  All  Rights  Reserved. 4
Customer  360
Internet  of  Things
Asset  
management
Recommendat...
Graph  Technology
• Graph  Databases
• Graph  Processors
©  DataStax,  All  Rights  Reserved. 5
Graph  Data  Models
• Property  Graph
• RDF  Graph
• Other
©  DataStax,  All  Rights  Reserved. 6
Graph  Query  Languages
• Gremlin
• SPARQL
• Other
©  DataStax,  All  Rights  Reserved. 7
Apache  TinkerPopTM
Graph  computing  framework
©  DataStax,  All  Rights  Reserved. 8
tinkerpop.apache.org
Apache  TinkerPopTM
Designing  TinkerPop-­enabled  graph  systems
©  DataStax,  All  Rights  Reserved. 9
tinkerpop.apache....
Apache  TinkerPopTM
Designing  TinkerPop-­enabled  graph  systems
©  DataStax,  All  Rights  Reserved. 10
tinkerpop.apache...
Apache  TinkerPopTM
Designing  TinkerPop-­enabled  graph  systems
©  DataStax,  All  Rights  Reserved. 11
tinkerpop.apache...
1 Introduction  to  Graphs
2 Modeling  Data  as  Property  Graphs
3 Graph  Traversal  Language  “Gremlin”
4 Gremlin  Trave...
Vertices
©  DataStax,  All  Rights  Reserved. 13
movie
user
user
genremovie
person
Vertices
©  DataStax,  All  Rights  Reserved. 14
Vertex m1 = graph.addVertex("movie")
Vertex m2 = graph.addVertex("movie")...
Edges
©  DataStax,  All  Rights  Reserved. 15
movie
user
rated rated
user
knows
genre
belongsTo belongsTo
actor
movie
pers...
Edges
©  DataStax,  All  Rights  Reserved. 16
Edge r1 = u1.addEdge("rated",m1)
Edge r2 = u1.addEdge("rated",m2)
u2.addEdge...
Properties
©  DataStax,  All  Rights  Reserved. 17
movieId: m267
title: Alice in Wonderland
year: 2010
duration: 108
count...
Properties
©  DataStax,  All  Rights  Reserved. 18
m1.property("movieId","m267")
m1.property("title","Alice in Wonderland"...
Multi-­ and  Meta-­Properties
©  DataStax,  All  Rights  Reserved. 19
movieId: m267
title: Alice in Wonderland
year: 2010
...
Multi-­ and  Meta-­Properties
©  DataStax,  All  Rights  Reserved. 20
m1.property(list,"production","Tim Burton Animation ...
Generalizing  
Graph  Data  Model
©  DataStax,  All  Rights  Reserved. 21
movieId :text
title :text
year :int
duration :in...
1 Introduction  to  Graphs
2 Modeling  Data  as  Property  Graphs
3 Graph  Traversal  Language  “Gremlin”
4 Gremlin  Trave...
Gremlin  Graph  Traversal  Language
• Gremlin  is  defined  in  Apache  TinkerPop™
• Expressive  language  to  define  tra...
Gremlin  Traversal
• Traversal  source
• Traversal  steps
• Traverser
©  DataStax,  All  Rights  Reserved. 24
g.V().has("t...
Graph  Traversal  Steps
©  DataStax,  All  Rights  Reserved. 25
Simple  Traversal  Steps
©  DataStax,  All  Rights  Reserved. 26
Simple  Traversal  Steps
©  DataStax,  All  Rights  Reserved. 27
Gremlin  Traversal  Execution
©  DataStax,  All  Rights  Reserved. 28
g.V().has("title",
"Alice in Wonderland")
.has("year...
movie
personId: p8153
name: Tim Burton
actor
persondirector
movieId: m267
title: Alice in Wonderland
year: 2010
...
person...
1 Introduction  to  Graphs
2 Modeling  Data  as  Property  Graphs
3 Graph  Traversal  Language  “Gremlin”
4 Gremlin  Trave...
Demo  Setup
• Real-­time  Graph  DBMS
• Superior  scalability
• High  throughput
• Search  and  analytics  
capabilities
©...
How  DSE  Graph  Works
©  DataStax,  All  Rights  Reserved. 32
Graph  Applications
DSE  Graph
DSE  Graph
Property  Graph  and  Gremlin
DSE  schema  API
How  DSE  Graph  Works
©  DataStax,  All  Rights  Reserved. 33
G...
DSE  Graph
Property  Graph  and  Gremlin
DSE  schema  API
How  DSE  Graph  Works
©  DataStax,  All  Rights  Reserved. 34
F...
Property  Graph  and  Gremlin
DSE  schema  API
DSE  Graph
How  DSE  Graph  Works
©  DataStax,  All  Rights  Reserved. 35
S...
DSE  Graph  vs.  Other  Graph  Databases
©  DataStax,  All  Rights  Reserved. 36
DSE  
Graph
Neo4j Titan
(with C*)
Titan  ...
DSE  Graph  vs.  Other  Graph  Databases  (cont’d)
©  DataStax,  All  Rights  Reserved. 37
DSE  
Graph
Neo4j Titan
(with C...
Demo  Agenda
• Performing  statistical  analysis
• Navigating  the  graph
• Extracting  vertex  neighborhoods
• Finding  p...
©  DataStax,  All  Rights  Reserved. 39
Thank  You
©  DataStax,  All  Rights  Reserved. 40
Artem Chebotko
achebotko@datastax.com
www.linkedin.com/in/artemchebotko
Upcoming SlideShare
Loading in …5
×

Traversing Graphs with Gremlin

472 views

Published on

Traversing Graphs with Gremlin

Published in: Technology
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD FULL eBOOK INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF eBook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB eBook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. doc eBook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF eBook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB eBook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. doc eBook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookeBOOK Crime, eeBOOK Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Traversing Graphs with Gremlin

  1. 1. Artem  Chebotko   Solution  Architect Traversing  Graphs  with  Gremlin
  2. 2. 1 Introduction  to  Graphs 2 Modeling  Data  as  Property  Graphs 3 Graph  Traversal  Language  “Gremlin” 4 Gremlin  Traversals  – Live  Demo 5 Q&A 2©  DataStax,  All  Rights  Reserved.
  3. 3. Why  Graph? • Everything  is  connected  to  everything  else   • Connections  or  relationships  are  important ©  DataStax,  All  Rights  Reserved. 3 k v k v Data  Complexity  and  Value  in  Relationships Key-­Value          Tabular              Document        Relation          Graph v v
  4. 4. Graph  Use  Cases ©  DataStax,  All  Rights  Reserved. 4 Customer  360 Internet  of  Things Asset   management Recommendations Fraud  detection Social  networks Communication networks Genomics Epidemiology Web Semantic Web Data  integration
  5. 5. Graph  Technology • Graph  Databases • Graph  Processors ©  DataStax,  All  Rights  Reserved. 5
  6. 6. Graph  Data  Models • Property  Graph • RDF  Graph • Other ©  DataStax,  All  Rights  Reserved. 6
  7. 7. Graph  Query  Languages • Gremlin • SPARQL • Other ©  DataStax,  All  Rights  Reserved. 7
  8. 8. Apache  TinkerPopTM Graph  computing  framework ©  DataStax,  All  Rights  Reserved. 8 tinkerpop.apache.org
  9. 9. Apache  TinkerPopTM Designing  TinkerPop-­enabled  graph  systems ©  DataStax,  All  Rights  Reserved. 9 tinkerpop.apache.org SparkGraphComputer GiraphGraphComputer
  10. 10. Apache  TinkerPopTM Designing  TinkerPop-­enabled  graph  systems ©  DataStax,  All  Rights  Reserved. 10 tinkerpop.apache.org SparkGraphComputer GiraphGraphComputer
  11. 11. Apache  TinkerPopTM Designing  TinkerPop-­enabled  graph  systems ©  DataStax,  All  Rights  Reserved. 11 tinkerpop.apache.org SparkGraphComputer GiraphGraphComputer
  12. 12. 1 Introduction  to  Graphs 2 Modeling  Data  as  Property  Graphs 3 Graph  Traversal  Language  “Gremlin” 4 Gremlin  Traversals  – Live  Demo 5 Q&A 12©  DataStax,  All  Rights  Reserved.
  13. 13. Vertices ©  DataStax,  All  Rights  Reserved. 13 movie user user genremovie person
  14. 14. Vertices ©  DataStax,  All  Rights  Reserved. 14 Vertex m1 = graph.addVertex("movie") Vertex m2 = graph.addVertex("movie") Vertex u1 = graph.addVertex("user") Vertex u2 = graph.addVertex("user") Vertex p = graph.addVertex("person") Vertex g = graph.addVertex("genre")
  15. 15. Edges ©  DataStax,  All  Rights  Reserved. 15 movie user rated rated user knows genre belongsTo belongsTo actor movie person
  16. 16. Edges ©  DataStax,  All  Rights  Reserved. 16 Edge r1 = u1.addEdge("rated",m1) Edge r2 = u1.addEdge("rated",m2) u2.addEdge("knows",u1) m1.addEdge("actor",p) m1.addEdge("belongsTo",g) m2.addEdge("belongsTo",g)
  17. 17. Properties ©  DataStax,  All  Rights  Reserved. 17 movieId: m267 title: Alice in Wonderland year: 2010 duration: 108 country: United States rating: 6rating: 5 genreId: g2 name: Adventure userId: u75 age: 17 gender: F movieId: m16 title: Alice in Wonderland year: 1951 duration: 75 country: United States userId: u185 age: 12 gender: M movie user rated rated user knows genrebelongsTo belongsTo actor movie personId: p4361 name: Johnny Depp person
  18. 18. Properties ©  DataStax,  All  Rights  Reserved. 18 m1.property("movieId","m267") m1.property("title","Alice in Wonderland") m1.property("year",2010) m1.property("duration",108) m1.property("country","United States") r1.property("rating",5)
  19. 19. Multi-­ and  Meta-­Properties ©  DataStax,  All  Rights  Reserved. 19 movieId: m267 title: Alice in Wonderland year: 2010 duration: 108 country: United States production: [Tim Burton Animation Co., Walt Disney Productions] budget: [$150M, $200M] m267 movie source: Bloomberg Businessweek date: March 5, 2010 source: Los Angeles Times date: March 7, 2010
  20. 20. Multi-­ and  Meta-­Properties ©  DataStax,  All  Rights  Reserved. 20 m1.property(list,"production","Tim Burton Animation Co.") m1.property(list,"production","Walt Disney Productions") Property b1 = m1.property(list,"budget","$150M") b1.property("source","Bloomberg Businessweek") b1.property("date",Date.parse("yyyy-MM-dd", "2010-03-05")) Property b2 = m1.property(list,"budget","$200M") b2.property("source","Los Angeles Times") b2.property("date",Date.parse("yyyy-MM-dd", "2010-03-07"))
  21. 21. Generalizing   Graph  Data  Model ©  DataStax,  All  Rights  Reserved. 21 movieId :text title :text year :int duration :int country :text production :text* personId:text name :text genreId :text name :text userId :text age :int gender :text rating :int genrebelongsTomovieuser rated person cinematographer actor director composer screenwriter knows
  22. 22. 1 Introduction  to  Graphs 2 Modeling  Data  as  Property  Graphs 3 Graph  Traversal  Language  “Gremlin” 4 Gremlin  Traversals  – Live  Demo 5 Q&A 22©  DataStax,  All  Rights  Reserved.
  23. 23. Gremlin  Graph  Traversal  Language • Gremlin  is  defined  in  Apache  TinkerPop™ • Expressive  language  to  define  traversals • Functional  language  with  a  fluent  syntax • Bindings  in  Groovy,  Java8,  Scala,  Clojure,  and  more ©  DataStax,  All  Rights  Reserved. 23
  24. 24. Gremlin  Traversal • Traversal  source • Traversal  steps • Traverser ©  DataStax,  All  Rights  Reserved. 24 g.V().has("title","Alice in Wonderland") .has("year",2010) .out("director") .values("name") g = graph.traversal()
  25. 25. Graph  Traversal  Steps ©  DataStax,  All  Rights  Reserved. 25
  26. 26. Simple  Traversal  Steps ©  DataStax,  All  Rights  Reserved. 26
  27. 27. Simple  Traversal  Steps ©  DataStax,  All  Rights  Reserved. 27
  28. 28. Gremlin  Traversal  Execution ©  DataStax,  All  Rights  Reserved. 28 g.V().has("title", "Alice in Wonderland") .has("year",2010) .out("director") .values("name") movie personId: p8153 name: Tim Burton actor persondirector movieId: m267 title: Alice in Wonderland year: 2010 ... personId: p4361 name: Johnny Depp person screenwriter personId: p5206 name: Linda Woolverton person
  29. 29. movie personId: p8153 name: Tim Burton actor persondirector movieId: m267 title: Alice in Wonderland year: 2010 ... personId: p4361 name: Johnny Depp person screenwriter personId: p5206 name: Linda Woolverton person Gremlin  Traversal  Execution  (cont.) ©  DataStax,  All  Rights  Reserved. 29 g.V().has("title", "Alice in Wonderland") .has("year",2010) .out("director", "screenwriter") .values("name")
  30. 30. 1 Introduction  to  Graphs 2 Modeling  Data  as  Property  Graphs 3 Graph  Traversal  Language  “Gremlin” 4 Gremlin  Traversals  – Live  Demo 5 Q&A 30©  DataStax,  All  Rights  Reserved.
  31. 31. Demo  Setup • Real-­time  Graph  DBMS • Superior  scalability • High  throughput • Search  and  analytics   capabilities ©  DataStax,  All  Rights  Reserved. 31
  32. 32. How  DSE  Graph  Works ©  DataStax,  All  Rights  Reserved. 32 Graph  Applications DSE  Graph
  33. 33. DSE  Graph Property  Graph  and  Gremlin DSE  schema  API How  DSE  Graph  Works ©  DataStax,  All  Rights  Reserved. 33 Graph  Applications
  34. 34. DSE  Graph Property  Graph  and  Gremlin DSE  schema  API How  DSE  Graph  Works ©  DataStax,  All  Rights  Reserved. 34 Fully  integrated backend  technologies Graph  Applications
  35. 35. Property  Graph  and  Gremlin DSE  schema  API DSE  Graph How  DSE  Graph  Works ©  DataStax,  All  Rights  Reserved. 35 Schema,  data,  and  query  mappings OLTP  and  OLAP  engines Fully  integrated backend  technologies Graph  Applications
  36. 36. DSE  Graph  vs.  Other  Graph  Databases ©  DataStax,  All  Rights  Reserved. 36 DSE   Graph Neo4j Titan (with C*) Titan   (other) Open  development  language Yes Yes Yes Yes Architecture Masterless Master Masterless Master Consistency  Model Tunable Tunable Tunable Non-­tunable Scaling  Method Scale  out   read/write Scale  up Scale  out   read/write Scale  out   for  reads Read,  Write,  Active-­ Anywhere Yes No Yes No Auto  Multi-­Data Center  and   Cloud  Zone  Support Yes No Yes No
  37. 37. DSE  Graph  vs.  Other  Graph  Databases  (cont’d) ©  DataStax,  All  Rights  Reserved. 37 DSE   Graph Neo4j Titan (with C*) Titan   (other) Advanced  Security  Features Yes No No No Integrated  Analytics Yes No No No Integrated  Search Yes No No No Automatic  workload   management  and  ETL  not   needed  between  OLTP,   OLAP,  and  Search  systems Yes No No No Integrated  Multi-­Model Platform Yes No No No
  38. 38. Demo  Agenda • Performing  statistical  analysis • Navigating  the  graph • Extracting  vertex  neighborhoods • Finding  paths  between  vertices • Estimating  degrees  of  separation • Finding  top  10  movies • Profiling  traversals ©  DataStax,  All  Rights  Reserved. 38
  39. 39. ©  DataStax,  All  Rights  Reserved. 39
  40. 40. Thank  You ©  DataStax,  All  Rights  Reserved. 40 Artem Chebotko achebotko@datastax.com www.linkedin.com/in/artemchebotko

×