SlideShare a Scribd company logo
1 of 20
So what are graph
databases pistas
at?
Aneesh Mon N
06-Nov-2019
Chennai
About Mixed-Nuts-at-Pramati
Mixed Nuts is a meetup organized by Pramati Technologies in
Chennai. Meetups and Workshops on a diverse range of tech
topics are hosted here.
Who are we? Website : https://www.pramati.com/
Blog : https://blog.imaginea.com/
About Me
Aneesh has been working with huge data sets and is proficient in
integrating, centralizing and maintaining data using database, ETL
and SOLR skills. Recently he has started exploring Graph
databases, to solve open issues of RDBMS.
LinkedIn: https://www.linkedin.com/in/aneeshmonn
Agenda
1. RDBMS Challenges
2. GraphDB and Why GraphDB?
a. Popular GraphDB’s
b. Popular Query languages for GraphDB
3. Property Graph Model
4. Neo4J
a. Neo4j Cypher & Sandbox
5. IPL Data Analysis GraphDB Vs RDBMS
6. Demo
IPL Data Analysis: GraphDB Schema
RDBMS Challenges
1. RDBMS lacks performance when the data is highly connected
a. cause a lot of joins
b. over 7 self/recursive joins, the RDMS starts to get really slow
2. RDBMS aren’t designed to capture this rich relationship and
lacks flexibility
a. don’t adapt well to change
b. fixed schema
c. addresses known problems
3. Complex Queries
a. query syntax becomes complex and large as the joins increase
GraphDB and Why GraphDB?
● GraphDB
○ designed to treat the relationships between data as equally
important to the data itself
○ intended to hold data without constricting it to a pre-defined
model
○ data is stored like we first draw it out
● Why GraphDB
○ Its connected world! There are no isolated pieces of information
○ stores connections alongside the data
○ graph databases excel at managing highly-connected data
Popular GraphDB’s
● Neo4J
● OrientDB
● Amazon Neptune
● ArangoDB
Popular Query languages for GraphDB
● Cypher: a graph query declarative language for Neo4j that
enables ad hoc and programmatic (SQL-like) access to the
graph
● GraphQL: an open-source data query and manipulation
language for APIs
● Gremlin: a graph programming language that is a part of
Apache TinkerPop open-source project
● AQL (ArangoDB Query Language): a SQL-like query language
used in ArangoDB for both documents and graphs
Property Graph Model
● Nodes
○ entities in the graph
○ can be tagged with labels, representing their different roles in your domain
○ can hold any number of attributes (key-value pairs) called properties
● Relationships
○ provide directed,
named,
semantically-
relevant connections
between two node
entities
○ has a direction, a
type, a start node,
and an end node
Neo4j
● Open-source, NoSQL, native graph database
● Provides full database characteristics, including ACID
transaction compliance
● Implements the property graph model down to the storage
level
● Uses Cypher Query Language
● Constant time traversals
● Flexible property graph schema
● Drivers for popular programming languages
Neo4j Cypher & Sandbox
● Play area for us to understand Neo4J
● https://neo4j.com/sandbox-v2/
IPL Data Analysis: RDBMS Schema
IPL Data Analysis: GraphDB Schema
Demo
Q1. List down all the matches played by
CSK.
Cypher SQL
MATCH p=()<-[:PLAYED]-(team:Team)
where team.abb="CSK"
RETURN p LIMIT 25
SELECT
s.season,
(select team_name from graphdb.teams where id=home_team_id)||' vs
'||(select team_name from graphdb.teams where id=away_team_id)
FROM
graphdb.seasons s
inner join graphdb.matches m on m.season_id=s.id
inner join graphdb.teams on
teams.id=any(ARRAY[home_team_id,away_team_id])
where teams.short_name='CSK'
Q2. Winning percentage for toss winner
season by season
Cypher SQL
match (s:Season)-[:PLAYED_IN]-(m:Match)
with s,count(m) as match_count
match (s)-[:PLAYED_IN]-(m1:Match)-[:TOSS_WON_BY]-(t:Team)
WHERE (m1)-[:WON_BY]-(t)
with s,match_count,count(m1) as win_count
return s.name,round((win_count*1.0/match_count)*100) as game_win_pct,
win_count, match_count
order by game_win_pct desc
SELECT
season as season,
round((toss_winner_winner_cnt / total_matches), 2) * 100 AS
win_percentage,
toss_winner_winner_cnt,
total_matches
FROM (
SELECT
season,
count(DISTINCT m.id) FILTER(WHERE
toss_winner_team_id=match_winner_team_id)::numeric as
toss_winner_winner_cnt,
COUNT(DISTINCT m.id)::numeric as total_matches
FROM graphdb.seasons s inner join graphdb.matches m on
m.season_id=s.id
inner join graphdb.match_win_info mw on mw.match_id=m.id
GROUP BY 1)t
order by 2 desc;
Q3. IPL Highest Partnership for a
season
Cypher SQL
Match(s:Season)<-[r:PLAYED_IN]-(m:Match)<-[b:BELONGS_TO_MATCH]-(i:Innings)-
[i2:IN_INNINGS]-(o:Over)-[b2:BELONGS_TO_OVER]-(b3:Ball)-
[s2:STRIKER|NON_STRIKER]-(p:Player)
where s.name="2013"
WITH s.name as name,m.match_id as match_id,m.name as match_name,i.innings as
innings,b3.number as ball_no,toInteger(b3.runs)+toInteger(b3.extra) as
runs,collect(p.name) as batsmans
UNWIND(batsmans) as player
WITH name,match_id,match_name,innings,ball_no,runs,player
ORDER BY player
WITH name as season,match_id,match_name,innings,ball_no,runs,COLLECT(distinct
player) as batsmans
WITH season,match_id,match_name,innings,batsmans,sum(runs) as partnership_runs
return season,match_name,batsmans,max(partnership_runs) as
max_partnership_runs
order by max_partnership_runs desc
limit 5
select
distinct
season,
partnership,
partnership_runs,
played_by
from
(
select season,
match_id,
(select short_name from graphdb.teams t inner join graphdb.matches m on
m.home_team_id=t.id and m.id=match_id limit 1)||' Vs '||(select short_name from
graphdb.teams t inner join graphdb.matches m on m.away_team_id=t.id and
m.id=match_id limit 1) as played_by,
match_innings,
partnership,
sum(runs) as partnership_runs
from
(
select season as season,mb.match_id,mb.match_innings,array_to_string((select
array_agg(player_name order by player_name) from (select
Q4. Batting Average of a Player in a
season
Cypher SQL
match (p:Player)<-[:STRIKER]-(b:Ball)-[:BELONGS_TO_OVER]->(:Over)-
[:IN_INNINGS]->(:Innings)-[:BELONGS_TO_MATCH]->(m:Match)-
[:PLAYED_IN]->(s:Season)
where s.name='2017' and p.name='V Kohli'
with s.name as season,p.name as player,sum(toInteger(b.runs)) as
total_runs,collect(b.ball_id) as ball_idså
match (b1:Ball)<-[:GOT_OUT]-(p1:Player)
where b1.ball_id in (ball_ids) and p1.name=player
with season,player,total_runs,count(b1) as out_balls
return season,player,total_runs,out_balls,total_runs*1.0/out_balls as
bat_avg
order by bat_avg desc
limit 10
select
s.season,
p.player_name,
sum(mb.runs) as total_runs,
round(case when count(distinct lb.match_id) filter (where
p.id=ANY(lb.dismiss_player_ids)) = 0 then null else
sum(mb.runs)::numeric/count(distinct mb.match_id)::numeric-count(distinct
lb.match_id) filter (where not p.id=ANY(lb.dismiss_player_ids))::numeric
end,2) as bat_avg
from
graphdb.seasons s
join
graphdb.matches m on s.id=m.season_id
join
graphdb.match_ball_wise_info mb on m.id=mb.match_id
join
graphdb.teams t on (t.id!=mb.team_id and (t.id=m.home_team_id or
t.id=m.away_team_id))
Q&A

More Related Content

What's hot

Machine Learning and GraphX
Machine Learning and GraphXMachine Learning and GraphX
Machine Learning and GraphXAndy Petrella
 
Working with Complex Types in DataFrames: Optics to the Rescue
Working with Complex Types in DataFrames: Optics to the RescueWorking with Complex Types in DataFrames: Optics to the Rescue
Working with Complex Types in DataFrames: Optics to the RescueDatabricks
 
Signals from outer space
Signals from outer spaceSignals from outer space
Signals from outer spaceGraphAware
 
Graph Database Prototyping made easy with Graphgen
Graph Database Prototyping made easy with GraphgenGraph Database Prototyping made easy with Graphgen
Graph Database Prototyping made easy with GraphgenGraphAware
 
Guug11 mashing up-google_apps
Guug11 mashing up-google_appsGuug11 mashing up-google_apps
Guug11 mashing up-google_appsTony Hirst
 
An R primer for SQL folks
An R primer for SQL folksAn R primer for SQL folks
An R primer for SQL folksThomas Hütter
 
Interactive Graph Analytics with Spark-(Daniel Darabos, Lynx Analytics)
Interactive Graph Analytics with Spark-(Daniel Darabos, Lynx Analytics)Interactive Graph Analytics with Spark-(Daniel Darabos, Lynx Analytics)
Interactive Graph Analytics with Spark-(Daniel Darabos, Lynx Analytics)Spark Summit
 

What's hot (9)

Machine Learning and GraphX
Machine Learning and GraphXMachine Learning and GraphX
Machine Learning and GraphX
 
Working with Complex Types in DataFrames: Optics to the Rescue
Working with Complex Types in DataFrames: Optics to the RescueWorking with Complex Types in DataFrames: Optics to the Rescue
Working with Complex Types in DataFrames: Optics to the Rescue
 
Hadoop - Apache Hive
Hadoop - Apache HiveHadoop - Apache Hive
Hadoop - Apache Hive
 
Signals from outer space
Signals from outer spaceSignals from outer space
Signals from outer space
 
Graph Database Prototyping made easy with Graphgen
Graph Database Prototyping made easy with GraphgenGraph Database Prototyping made easy with Graphgen
Graph Database Prototyping made easy with Graphgen
 
Pandas
PandasPandas
Pandas
 
Guug11 mashing up-google_apps
Guug11 mashing up-google_appsGuug11 mashing up-google_apps
Guug11 mashing up-google_apps
 
An R primer for SQL folks
An R primer for SQL folksAn R primer for SQL folks
An R primer for SQL folks
 
Interactive Graph Analytics with Spark-(Daniel Darabos, Lynx Analytics)
Interactive Graph Analytics with Spark-(Daniel Darabos, Lynx Analytics)Interactive Graph Analytics with Spark-(Daniel Darabos, Lynx Analytics)
Interactive Graph Analytics with Spark-(Daniel Darabos, Lynx Analytics)
 

Similar to Graph db - Pramati Technologies [Meetup]

Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...Databricks
 
The 2nd graph database in sv meetup
The 2nd graph database in sv meetupThe 2nd graph database in sv meetup
The 2nd graph database in sv meetupJoshua Bae
 
Data Con LA 2022 - What's new with MongoDB 6.0 and Atlas
Data Con LA 2022 - What's new with MongoDB 6.0 and AtlasData Con LA 2022 - What's new with MongoDB 6.0 and Atlas
Data Con LA 2022 - What's new with MongoDB 6.0 and AtlasData Con LA
 
A Hands-on Intro to Data Science and R Presentation.ppt
A Hands-on Intro to Data Science and R Presentation.pptA Hands-on Intro to Data Science and R Presentation.ppt
A Hands-on Intro to Data Science and R Presentation.pptSanket Shikhar
 
PyconZA19-Distributed-workloads-challenges-with-PySpark-and-Airflow
PyconZA19-Distributed-workloads-challenges-with-PySpark-and-AirflowPyconZA19-Distributed-workloads-challenges-with-PySpark-and-Airflow
PyconZA19-Distributed-workloads-challenges-with-PySpark-and-AirflowChetan Khatri
 
XII - 2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
XII -  2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdfXII -  2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
XII - 2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdfKrishnaJyotish1
 
Graph Databases in the Microsoft Ecosystem
Graph Databases in the Microsoft EcosystemGraph Databases in the Microsoft Ecosystem
Graph Databases in the Microsoft EcosystemMarco Parenzan
 
Cypher and apache spark multiple graphs and more in open cypher
Cypher and apache spark  multiple graphs and more in  open cypherCypher and apache spark  multiple graphs and more in  open cypher
Cypher and apache spark multiple graphs and more in open cypherNeo4j
 
A look under the hood at Apache Spark's API and engine evolutions
A look under the hood at Apache Spark's API and engine evolutionsA look under the hood at Apache Spark's API and engine evolutions
A look under the hood at Apache Spark's API and engine evolutionsDatabricks
 
Introduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at lastIntroduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at lastHolden Karau
 
aRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RaRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RGraphRM
 
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...jexp
 
managing big data
managing big datamanaging big data
managing big dataSuveeksha
 
Multiple graphs in openCypher
Multiple graphs in openCypherMultiple graphs in openCypher
Multiple graphs in openCypheropenCypher
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxMalla Reddy University
 
AWS November Webinar Series - Advanced Analytics with Amazon Redshift and the...
AWS November Webinar Series - Advanced Analytics with Amazon Redshift and the...AWS November Webinar Series - Advanced Analytics with Amazon Redshift and the...
AWS November Webinar Series - Advanced Analytics with Amazon Redshift and the...Amazon Web Services
 

Similar to Graph db - Pramati Technologies [Meetup] (20)

Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
 
The 2nd graph database in sv meetup
The 2nd graph database in sv meetupThe 2nd graph database in sv meetup
The 2nd graph database in sv meetup
 
Data Science
Data ScienceData Science
Data Science
 
Data Con LA 2022 - What's new with MongoDB 6.0 and Atlas
Data Con LA 2022 - What's new with MongoDB 6.0 and AtlasData Con LA 2022 - What's new with MongoDB 6.0 and Atlas
Data Con LA 2022 - What's new with MongoDB 6.0 and Atlas
 
A Hands-on Intro to Data Science and R Presentation.ppt
A Hands-on Intro to Data Science and R Presentation.pptA Hands-on Intro to Data Science and R Presentation.ppt
A Hands-on Intro to Data Science and R Presentation.ppt
 
Neo4j graph database
Neo4j graph databaseNeo4j graph database
Neo4j graph database
 
PyconZA19-Distributed-workloads-challenges-with-PySpark-and-Airflow
PyconZA19-Distributed-workloads-challenges-with-PySpark-and-AirflowPyconZA19-Distributed-workloads-challenges-with-PySpark-and-Airflow
PyconZA19-Distributed-workloads-challenges-with-PySpark-and-Airflow
 
XII - 2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
XII -  2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdfXII -  2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
XII - 2022-23 - IP - RAIPUR (CBSE FINAL EXAM).pdf
 
Graph Databases in the Microsoft Ecosystem
Graph Databases in the Microsoft EcosystemGraph Databases in the Microsoft Ecosystem
Graph Databases in the Microsoft Ecosystem
 
Cypher and apache spark multiple graphs and more in open cypher
Cypher and apache spark  multiple graphs and more in  open cypherCypher and apache spark  multiple graphs and more in  open cypher
Cypher and apache spark multiple graphs and more in open cypher
 
A look under the hood at Apache Spark's API and engine evolutions
A look under the hood at Apache Spark's API and engine evolutionsA look under the hood at Apache Spark's API and engine evolutions
A look under the hood at Apache Spark's API and engine evolutions
 
Introduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at lastIntroduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at last
 
aRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RaRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con R
 
GraphDatabase.pptx
GraphDatabase.pptxGraphDatabase.pptx
GraphDatabase.pptx
 
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
New Features in Neo4j 3.4 / 3.3 - Graph Algorithms, Spatial, Date-Time & Visu...
 
Neo4j: Graph-like power
Neo4j: Graph-like powerNeo4j: Graph-like power
Neo4j: Graph-like power
 
managing big data
managing big datamanaging big data
managing big data
 
Multiple graphs in openCypher
Multiple graphs in openCypherMultiple graphs in openCypher
Multiple graphs in openCypher
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 
AWS November Webinar Series - Advanced Analytics with Amazon Redshift and the...
AWS November Webinar Series - Advanced Analytics with Amazon Redshift and the...AWS November Webinar Series - Advanced Analytics with Amazon Redshift and the...
AWS November Webinar Series - Advanced Analytics with Amazon Redshift and the...
 

More from Pramati Technologies

Clojure through the eyes of a Java Nut | [Mixed Nuts] at Pramati Technologies
Clojure through the eyes of a Java Nut | [Mixed Nuts] at Pramati TechnologiesClojure through the eyes of a Java Nut | [Mixed Nuts] at Pramati Technologies
Clojure through the eyes of a Java Nut | [Mixed Nuts] at Pramati TechnologiesPramati Technologies
 
Swift UI - Declarative Programming [Pramati Technologies]
Swift UI - Declarative Programming [Pramati Technologies]Swift UI - Declarative Programming [Pramati Technologies]
Swift UI - Declarative Programming [Pramati Technologies]Pramati Technologies
 
Adaptive Cards - Pramati Technologies
Adaptive Cards - Pramati TechnologiesAdaptive Cards - Pramati Technologies
Adaptive Cards - Pramati TechnologiesPramati Technologies
 
VitaFlow | Mageswaran Dhandapani [Pramati]
VitaFlow | Mageswaran Dhandapani [Pramati]VitaFlow | Mageswaran Dhandapani [Pramati]
VitaFlow | Mageswaran Dhandapani [Pramati]Pramati Technologies
 
Typography Style Transfer using GANs | Pramati
Typography Style Transfer using GANs | Pramati Typography Style Transfer using GANs | Pramati
Typography Style Transfer using GANs | Pramati Pramati Technologies
 
Document Clustering using LDA | Haridas Narayanaswamy [Pramati]
Document Clustering using LDA | Haridas Narayanaswamy [Pramati]Document Clustering using LDA | Haridas Narayanaswamy [Pramati]
Document Clustering using LDA | Haridas Narayanaswamy [Pramati]Pramati Technologies
 
Pramati - Chennai Development Center
Pramati - Chennai Development CenterPramati - Chennai Development Center
Pramati - Chennai Development CenterPramati Technologies
 

More from Pramati Technologies (7)

Clojure through the eyes of a Java Nut | [Mixed Nuts] at Pramati Technologies
Clojure through the eyes of a Java Nut | [Mixed Nuts] at Pramati TechnologiesClojure through the eyes of a Java Nut | [Mixed Nuts] at Pramati Technologies
Clojure through the eyes of a Java Nut | [Mixed Nuts] at Pramati Technologies
 
Swift UI - Declarative Programming [Pramati Technologies]
Swift UI - Declarative Programming [Pramati Technologies]Swift UI - Declarative Programming [Pramati Technologies]
Swift UI - Declarative Programming [Pramati Technologies]
 
Adaptive Cards - Pramati Technologies
Adaptive Cards - Pramati TechnologiesAdaptive Cards - Pramati Technologies
Adaptive Cards - Pramati Technologies
 
VitaFlow | Mageswaran Dhandapani [Pramati]
VitaFlow | Mageswaran Dhandapani [Pramati]VitaFlow | Mageswaran Dhandapani [Pramati]
VitaFlow | Mageswaran Dhandapani [Pramati]
 
Typography Style Transfer using GANs | Pramati
Typography Style Transfer using GANs | Pramati Typography Style Transfer using GANs | Pramati
Typography Style Transfer using GANs | Pramati
 
Document Clustering using LDA | Haridas Narayanaswamy [Pramati]
Document Clustering using LDA | Haridas Narayanaswamy [Pramati]Document Clustering using LDA | Haridas Narayanaswamy [Pramati]
Document Clustering using LDA | Haridas Narayanaswamy [Pramati]
 
Pramati - Chennai Development Center
Pramati - Chennai Development CenterPramati - Chennai Development Center
Pramati - Chennai Development Center
 

Recently uploaded

Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 

Recently uploaded (20)

Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 

Graph db - Pramati Technologies [Meetup]

  • 1. So what are graph databases pistas at? Aneesh Mon N 06-Nov-2019 Chennai
  • 2. About Mixed-Nuts-at-Pramati Mixed Nuts is a meetup organized by Pramati Technologies in Chennai. Meetups and Workshops on a diverse range of tech topics are hosted here. Who are we? Website : https://www.pramati.com/ Blog : https://blog.imaginea.com/
  • 3. About Me Aneesh has been working with huge data sets and is proficient in integrating, centralizing and maintaining data using database, ETL and SOLR skills. Recently he has started exploring Graph databases, to solve open issues of RDBMS. LinkedIn: https://www.linkedin.com/in/aneeshmonn
  • 4. Agenda 1. RDBMS Challenges 2. GraphDB and Why GraphDB? a. Popular GraphDB’s b. Popular Query languages for GraphDB 3. Property Graph Model 4. Neo4J a. Neo4j Cypher & Sandbox 5. IPL Data Analysis GraphDB Vs RDBMS 6. Demo
  • 5. IPL Data Analysis: GraphDB Schema
  • 6. RDBMS Challenges 1. RDBMS lacks performance when the data is highly connected a. cause a lot of joins b. over 7 self/recursive joins, the RDMS starts to get really slow 2. RDBMS aren’t designed to capture this rich relationship and lacks flexibility a. don’t adapt well to change b. fixed schema c. addresses known problems 3. Complex Queries a. query syntax becomes complex and large as the joins increase
  • 7. GraphDB and Why GraphDB? ● GraphDB ○ designed to treat the relationships between data as equally important to the data itself ○ intended to hold data without constricting it to a pre-defined model ○ data is stored like we first draw it out ● Why GraphDB ○ Its connected world! There are no isolated pieces of information ○ stores connections alongside the data ○ graph databases excel at managing highly-connected data
  • 8. Popular GraphDB’s ● Neo4J ● OrientDB ● Amazon Neptune ● ArangoDB
  • 9. Popular Query languages for GraphDB ● Cypher: a graph query declarative language for Neo4j that enables ad hoc and programmatic (SQL-like) access to the graph ● GraphQL: an open-source data query and manipulation language for APIs ● Gremlin: a graph programming language that is a part of Apache TinkerPop open-source project ● AQL (ArangoDB Query Language): a SQL-like query language used in ArangoDB for both documents and graphs
  • 10. Property Graph Model ● Nodes ○ entities in the graph ○ can be tagged with labels, representing their different roles in your domain ○ can hold any number of attributes (key-value pairs) called properties ● Relationships ○ provide directed, named, semantically- relevant connections between two node entities ○ has a direction, a type, a start node, and an end node
  • 11. Neo4j ● Open-source, NoSQL, native graph database ● Provides full database characteristics, including ACID transaction compliance ● Implements the property graph model down to the storage level ● Uses Cypher Query Language ● Constant time traversals ● Flexible property graph schema ● Drivers for popular programming languages
  • 12. Neo4j Cypher & Sandbox ● Play area for us to understand Neo4J ● https://neo4j.com/sandbox-v2/
  • 13. IPL Data Analysis: RDBMS Schema
  • 14. IPL Data Analysis: GraphDB Schema
  • 15. Demo
  • 16. Q1. List down all the matches played by CSK. Cypher SQL MATCH p=()<-[:PLAYED]-(team:Team) where team.abb="CSK" RETURN p LIMIT 25 SELECT s.season, (select team_name from graphdb.teams where id=home_team_id)||' vs '||(select team_name from graphdb.teams where id=away_team_id) FROM graphdb.seasons s inner join graphdb.matches m on m.season_id=s.id inner join graphdb.teams on teams.id=any(ARRAY[home_team_id,away_team_id]) where teams.short_name='CSK'
  • 17. Q2. Winning percentage for toss winner season by season Cypher SQL match (s:Season)-[:PLAYED_IN]-(m:Match) with s,count(m) as match_count match (s)-[:PLAYED_IN]-(m1:Match)-[:TOSS_WON_BY]-(t:Team) WHERE (m1)-[:WON_BY]-(t) with s,match_count,count(m1) as win_count return s.name,round((win_count*1.0/match_count)*100) as game_win_pct, win_count, match_count order by game_win_pct desc SELECT season as season, round((toss_winner_winner_cnt / total_matches), 2) * 100 AS win_percentage, toss_winner_winner_cnt, total_matches FROM ( SELECT season, count(DISTINCT m.id) FILTER(WHERE toss_winner_team_id=match_winner_team_id)::numeric as toss_winner_winner_cnt, COUNT(DISTINCT m.id)::numeric as total_matches FROM graphdb.seasons s inner join graphdb.matches m on m.season_id=s.id inner join graphdb.match_win_info mw on mw.match_id=m.id GROUP BY 1)t order by 2 desc;
  • 18. Q3. IPL Highest Partnership for a season Cypher SQL Match(s:Season)<-[r:PLAYED_IN]-(m:Match)<-[b:BELONGS_TO_MATCH]-(i:Innings)- [i2:IN_INNINGS]-(o:Over)-[b2:BELONGS_TO_OVER]-(b3:Ball)- [s2:STRIKER|NON_STRIKER]-(p:Player) where s.name="2013" WITH s.name as name,m.match_id as match_id,m.name as match_name,i.innings as innings,b3.number as ball_no,toInteger(b3.runs)+toInteger(b3.extra) as runs,collect(p.name) as batsmans UNWIND(batsmans) as player WITH name,match_id,match_name,innings,ball_no,runs,player ORDER BY player WITH name as season,match_id,match_name,innings,ball_no,runs,COLLECT(distinct player) as batsmans WITH season,match_id,match_name,innings,batsmans,sum(runs) as partnership_runs return season,match_name,batsmans,max(partnership_runs) as max_partnership_runs order by max_partnership_runs desc limit 5 select distinct season, partnership, partnership_runs, played_by from ( select season, match_id, (select short_name from graphdb.teams t inner join graphdb.matches m on m.home_team_id=t.id and m.id=match_id limit 1)||' Vs '||(select short_name from graphdb.teams t inner join graphdb.matches m on m.away_team_id=t.id and m.id=match_id limit 1) as played_by, match_innings, partnership, sum(runs) as partnership_runs from ( select season as season,mb.match_id,mb.match_innings,array_to_string((select array_agg(player_name order by player_name) from (select
  • 19. Q4. Batting Average of a Player in a season Cypher SQL match (p:Player)<-[:STRIKER]-(b:Ball)-[:BELONGS_TO_OVER]->(:Over)- [:IN_INNINGS]->(:Innings)-[:BELONGS_TO_MATCH]->(m:Match)- [:PLAYED_IN]->(s:Season) where s.name='2017' and p.name='V Kohli' with s.name as season,p.name as player,sum(toInteger(b.runs)) as total_runs,collect(b.ball_id) as ball_idså match (b1:Ball)<-[:GOT_OUT]-(p1:Player) where b1.ball_id in (ball_ids) and p1.name=player with season,player,total_runs,count(b1) as out_balls return season,player,total_runs,out_balls,total_runs*1.0/out_balls as bat_avg order by bat_avg desc limit 10 select s.season, p.player_name, sum(mb.runs) as total_runs, round(case when count(distinct lb.match_id) filter (where p.id=ANY(lb.dismiss_player_ids)) = 0 then null else sum(mb.runs)::numeric/count(distinct mb.match_id)::numeric-count(distinct lb.match_id) filter (where not p.id=ANY(lb.dismiss_player_ids))::numeric end,2) as bat_avg from graphdb.seasons s join graphdb.matches m on s.id=m.season_id join graphdb.match_ball_wise_info mb on m.id=mb.match_id join graphdb.teams t on (t.id!=mb.team_id and (t.id=m.home_team_id or t.id=m.away_team_id))
  • 20. Q&A