+ All Categories
Home > Documents > Graph db

Graph db

Date post: 19-Aug-2015
Category:
Upload: imran-ahmed
View: 47 times
Download: 4 times
Share this document with a friend
Popular Tags:
29
Imran Ahmed August Graph is Everywhere !!! An Introduction to Graph Databases and Neo4j
Transcript
Page 1: Graph db

Imran Ahmed August 2015

Graph is Everywhere !!! An Introduction to Graph Databases and Neo4j

Page 2: Graph db

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

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

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

Types of NOSQL…

Page 5: Graph db

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

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

Graph Database

Page 7: Graph db

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

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

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

Let’s compare

Page 10: Graph db

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

Let’s compare

Page 11: Graph db

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

Let’s compare

Page 12: Graph db

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

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

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

Cypher Example

Page 15: Graph db

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

Let’s compare head to head

Page 16: Graph db

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

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

RDBMS GRAPH

Page 18: Graph db

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

RDBMS GRAPH

Page 19: Graph db

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

RDBMS GRAPH

Page 20: Graph db

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

RDBMS GRAPH

Page 21: Graph db

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

RDBMS GRAPH

Page 22: Graph db

US | UK | BENELUX | ME | IND©1996-2015 Aspire Systems, Inc.

Page 23: Graph db

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

Fraud Detection - Result

Page 25: Graph db

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

EMBRACE IT

REALITY IS A GRAPH

Conclusion

Page 27: Graph db
Page 28: Graph db

This is just the beginning...Visit www.neo4j.org for more!

Get Graphy!

Page 29: Graph db

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


Recommended