graph db
TRANSCRIPT
![Page 1: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/1.jpg)
Imran Ahmed August 2015
Graph is Everywhere !!! An Introduction to Graph Databases and Neo4j
![Page 2: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/2.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Agenda
No SQL Overview Graph Databases Comparison with RDBMS What is Neo4j? Cypher Query Language How to migrate ? Real-world implementation use cases with Neo4j Install and Deploy Conclusion
![Page 3: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/3.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
What is NOSQL ?It’s not “No to SQL”
It’s not “Never SQL”
It’s “Not only SQL”
NOSQL describes the ongoing trends where we as developers searching for different options based on changing requirements.
BTW what is changing and why we need NOSQL ?
Data is getting bigger…
Data is more connected… Data is more semi-structured…
![Page 4: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/4.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Types of NOSQL…
![Page 5: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/5.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Types of NOSQL…Key-Value• A hash table where there is a unique key and a pointer to a
particular item of data.E.g.: Oracle BDB, Amazon Simple DB etc.
Column (Big Table)• There are still keys but they point to multiple columns. The
columns are arranged by column family.• Supports Large amount of Data.E.g.: Cassandra, HBase.
Document• The semi-structured documents are stored in formats like JSON.
Supports Large amount of Data.• These were inspired by Lotus Notes and are similar to key-value
stores.E.g.: CouchDB, MongoDB.
![Page 6: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/6.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Graph Database
![Page 7: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/7.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
What is Graph DB ?A Database with explicit graph structure
Data Model• Nodes - Table• Edges - Relationships• Properties – Column
Every node knows its adjacent nodes
No separate index lookup or complex joins present
White board friendly.
![Page 8: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/8.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Why Graph DB ?
Fast and easy to query
Very high scalability - up to 32 billion nodes
Fast deep traversals instead of slow SQL queries that span many table joins.
Support ACID transactions with rollbacks support
Performance never degrade with increase in data unlike RDBMS
Priceless for connected data - That’s why industry leaders like FB, Google, eBay etc has already gone its way.
![Page 9: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/9.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Let’s compare
![Page 10: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/10.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Let’s compare
![Page 11: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/11.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Let’s compare
![Page 12: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/12.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Neo4j
World’s leading and most popular graph database
Open source , implemented in java
Schema free property graph
Perfect for complex and highly connected data
Here both nodes and relationships can contain properties
REST API - Accessible from most of the programming languages like Java, C#, Python, Pearl, Scala, Cypher etc.
![Page 13: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/13.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Cypher Query Language
Pattern matching query Language (like SQL for graphs)
It follows SQL like syntax and supports many clauses like Where , Order By etc.
It basically describes what you want and not how you want.
Avoid using Ids.
![Page 14: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/14.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Cypher Example
![Page 15: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/15.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Let’s compare head to head
![Page 16: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/16.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
Eassyyyy isn’t it ???
Let’s compare head to head
Compare Recommendation Engine.
Problem: Recommendation engine should look at the products that peer customers have purchased and then suggest them to the current user.
Complex sql - Recommendation engine.png Simple CQL - Recommendation engine.png
![Page 17: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/17.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
RDBMS GRAPH
![Page 18: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/18.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
RDBMS GRAPH
![Page 19: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/19.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
RDBMS GRAPH
![Page 20: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/20.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
RDBMS GRAPH
![Page 21: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/21.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
RDBMS GRAPH
![Page 22: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/22.jpg)
US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.
![Page 23: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/23.jpg)
Fraud Detection Case Study
Fraud - create data sample.txt
Fraud - Find disputed transactions.txt
Fraud - Find undisputed for each disputed.txt
Fraud - Zero in to the location.txt
![Page 24: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/24.jpg)
Fraud Detection - Result
![Page 25: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/25.jpg)
Key questions …
Cost Efficient ? Open source
Scalable ?
Performance ?
Normalized ?
User friendly ?
Up to 32 billion nodes
Better & Consistent
Supports all ACID properties
Simple queries, No joins, Multiple Language support,
Nice UI
![Page 26: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/26.jpg)
EMBRACE IT
REALITY IS A GRAPH
Conclusion
![Page 27: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/27.jpg)
![Page 28: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/28.jpg)
This is just the beginning...Visit www.neo4j.org for more!
Get Graphy!
![Page 29: Graph db](https://reader034.vdocument.in/reader034/viewer/2022042821/55d3a5a5bb61eb8f6a8b45b8/html5/thumbnails/29.jpg)
References:
https://en.wikipedia.org/wiki/Graph_database
http://www.tutorialspoint.com/neo4j
http://www.neo4j.org
http://www.neo4j.org/learn/cypher
WP-OvercomingSQLstrain.pdf