Slide 1

Slide 1 text

- Sarah Masud, Red Hat Gremlin The universal graph language

Slide 2

Slide 2 text

Nodes: M-Member c - City C - Country XYZ- Organization Edges: D - Director F - Founder B - BoD W- Works at 50K+ -Members 60 -Cities 20 -Countries

Slide 3

Slide 3 text

Agenda 1. What is a graph database? 2. What about our dear RDBMS 3. What the hell is gremlin? 4. Features and use cases of gremlin 5. Demo Women Who Code

Slide 4

Slide 4 text

What is Graph DB? ❖A graph is a collection of vertices and edge. G=(V,E) ❖A graph DB is a system that helps us store, retrieve and consume data in a graph structured format ❖USP- Relationship Women Who Code Vertex 2 [properties] Vertex 1 [properties] Edge [properties]

Slide 5

Slide 5 text

Examples Women Who Code

Slide 6

Slide 6 text

WWC Graph - A Dummy ❖ Entities ➢ People ➢ Cities, Countries ➢ Organizations ❖ Relations ➢ Person -- founder---WWC ➢ Person -- BOD---WWC ➢ Person---Director---City ➢ Person--Member---City ➢ Person--Knows--Person Women Who Code

Slide 7

Slide 7 text

Why not our dear RDBMS :/ Women Who Code Name Founder A Yes B Yes C D E F G 1. In order to find the founders, must have a column with most rows empty 2. In order to map names to cities, perform costly join operations 3. RDBMS is useful for transactional data 4. How to map real time relations between person A and person B?

Slide 8

Slide 8 text

So… What the hell is Gremlin?? Framework: TinkerPop DSL: Gremlin Wrapper: Gremlin-python Driver: SQL-Gremlin

Slide 9

Slide 9 text

Features of Gremlin ● Provides backend transparency BECAUSE ● Does NOT provide schema management queries ● Based on functional programming ● Returns the result as an iterator ● Default- Edges are directional ● Support all primitive Java data types out of the box ● +Many more!

Slide 10

Slide 10 text

The Universality of Gremlin

Slide 11

Slide 11 text

Use Cases for TinkerPop-Gremlin 1. Experiment with different graph stores without affecting your query logic 2. Switch context between OLAP and OLTP 3. Support from open source + enterprise

Slide 12

Slide 12 text

Pros and Cons with Gremlin Pros ❖ Open source! ❖ Vendor agnostic ❖ Wrapper and driver support for many languages ❖ Intuitive Cons ❖ Just a DSL not a programming language ❖ No out of box support for schema and indexing ❖ Wrappers are slow

Slide 13

Slide 13 text

Example Query 1 Who are the founders and Board of directors of WWC? Step 1: Go to the WWC org node Step 2 : Find out those people who are connected with the WWC org Step 3: Filter out those people who have an edge with label founder or BOD g.V().hasLabel(‘Org).has(‘name’,’WWC’).inE(‘founder_of’,bod_at’).outV().values(‘name’)

Slide 14

Slide 14 text

Nodes: M-Member c - City C - Country XYZ- Organization Edges: D - Director F - Founder B - BoD W- Works at

Slide 15

Slide 15 text

Example Query 2 WWC Directors who are less than 30 years old Step 1: Find all the people who are WWC directors Step2: Filter them by property age<30 g.V().hasLabel(‘Person’).outE(‘director_of’).inV().has(‘age’,lt(30)).values(‘name’)

Slide 16

Slide 16 text

Nodes: M-Member c - City C - Country XYZ- Organization Edges: D - Director F - Founder B - BoD W- Works at

Slide 17

Slide 17 text

How can Gremlin help WWC? 1. Suggest friends on social media to members of same chapter 2. page Rank the most influential people in WWC network 3. Track growth of chapters 4. Personalize job recommendation 5. Mentor-Mentee opportunity Awesome WWC

Slide 18

Slide 18 text

References 1. TinkerPop 2. Tinkerpop -Gremlin Getting started 3. Gremlin-Titan-Dynamo Setup 4. Gremlin -Python 5. Demo Source Code

Slide 19

Slide 19 text

Q/A THANK YOU