neo4j : introduction to graph database

30
Neo4j:Introduction to Graph DB Presenter: Manash Ranjan Rautray,QA, Mindfire Solutions Date: 12/09/2014

Upload: mindfire-solutions

Post on 14-Jun-2015

317 views

Category:

Software


1 download

DESCRIPTION

Neo4j is an open-source graph database, implemented in Java.

TRANSCRIPT

Page 1: Neo4J : Introduction to Graph Database

Neo4j:Introduction to Graph DB

Presenter: Manash Ranjan Rautray,QA,Mindfire SolutionsDate: 12/09/2014

Page 2: Neo4J : Introduction to Graph Database

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Manash Ranjan Rautray, Software QA EngineerMindfire Solutions

Skills : WebDriver, Java, JUnit, Maven, Oracle 11G,Neo4j,Mongo DBCertifications : ISTQB Foundation Level, V-Skills Selenium Certified,MCP:70-480

Connect with Me :LinkedIn : http://in.linkedin.com/pub/manash-ranjan-rautray/60/9a5/528

Contact Me :Email :[email protected]

Skype: mfsi_manashr

About Me

Page 3: Neo4J : Introduction to Graph Database

Presenter: Manash Ranjan Rautray, Mindfire Solutions

The Path Forward:

What is a Graph ?

What is Neo4j ?

Building blocks of a Graph DB

Data Modelling: SQL vs Graph

Use case: Social Media

Cypher Query Language

Installation of Neo

Page 4: Neo4J : Introduction to Graph Database

What is Graph ?

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 5: Neo4J : Introduction to Graph Database

This is a Graph

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 6: Neo4J : Introduction to Graph Database

Twitter Social Graph

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 7: Neo4J : Introduction to Graph Database

Internet Graph

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 8: Neo4J : Introduction to Graph Database

A graph database...

2NO: not for charts & diagrams.

YES: for storing data that is structured as a graph.Remember linked lists, trees?Graphs are the general-purpose data structure.

“A relational database may tell you the average age of everyone in this session,but a graph database will tell you with whom you will be going for lunch.”

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 9: Neo4J : Introduction to Graph Database

What is Neo4j?

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 10: Neo4J : Introduction to Graph Database

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 11: Neo4J : Introduction to Graph Database

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 12: Neo4J : Introduction to Graph Database

open_source:true

language:’Swedish’

year:2007

The Property Graph of Neo4j:

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 13: Neo4J : Introduction to Graph Database

Who is using Graph Databases?● Some big names using Graph Databases:○ Facebook - Open Graph Database○ Google - Knowledge Graph○ Twitter - FlockDB distributed graph Database○ Adobe○ Glassdoor○ JustDial○ CareerBuilder○ Indiatimes○ telenor○ hewlett packard○ T-Mobile○ Cisco

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 14: Neo4J : Introduction to Graph Database

Why Neo4j?

● Fully Transactional (ACID)● Highly Agile● Best suited for data which is highly connected and have complex relationships.● Is supremely fast when it comes to querying connected data● Highly scalable, up to several billion nodes/relationships/properties● Neo4j allows infinite depth● Data Modeling in Neo4j :

The whole model relies on the questions we have to ask our database

Very easily done, even when designing domains in SQL we tend to make graphs on whiteboards.

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 15: Neo4J : Introduction to Graph Database

Neo4j vs. Mysql● for the simple friends of friends query, Neo4j is 60% faster than

MySQL● for friends of friends of friends, Neo is 180 times faster● and for the depth four query, Neo4j is 1,135 times faster● and MySQL just chokes on the depth 5 query

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 16: Neo4J : Introduction to Graph Database

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 17: Neo4J : Introduction to Graph Database

Data Modeling : SQL vs. Graph

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 18: Neo4J : Introduction to Graph Database

Example: YouTube in SQL

ID Name

1 Alice

2 Bob

3 Charles

4 David

ID Name

1 Bob’s Gaming Channel

2 Bob’s Cute Dog

3 Cooking with Charles

4 David’s How-To Channel

5 Disco Dancing with David

User ID

Channel ID

2 1

2 2

3 3

4 4

4 5

USERS

CHANNELSUSERS_CHANNELS

User ID

Channel ID

1 3

1 4

2 3

2 5

3 1

USERS_SUBSCRIPTIONS

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 19: Neo4J : Introduction to Graph Database

User

Channel Example: YouTube in a Graphname:’David’

name:’David’s How-To Channel’

OPERATES

name:’Disco Dancing with David’

name:’Bob’

name:’Bob’s Cute Dog’

name:’Bob’s Gaming Channel’

name:’Charles’name:’Cooking with Charles’

name:’Alice’

OPERATES SUBSCRIBEDOPERATES

OPERATES

OPERATESSUBSCRIBED

SUBSCRIBED

SUBSCRIBED

SUBSCRIBED

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 20: Neo4J : Introduction to Graph Database

Use Case: Social Media

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 21: Neo4J : Introduction to Graph Database

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 22: Neo4J : Introduction to Graph Database

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 23: Neo4J : Introduction to Graph Database

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 24: Neo4J : Introduction to Graph Database

Cypher Query Language● Is a declarative query language for querying Neo4j● Expressive and Human readable syntax● Matches patterns of nodes and relationships toextract/modify information in the graph● With cypher, we can create, update, removenodes, relationships and properties● Has an online console at http://www.neo4j.org/console● Has a short learning curve due to similarities withSQL query statements

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 25: Neo4J : Introduction to Graph Database

Cypher Query Language

Create a Node:

CREATE (n:Actor { name:"Tom Hanks",age:44 })

● Actor is the Label● n is the variable for new node● {} brackets to add properties to the node

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 26: Neo4J : Introduction to Graph Database

Cypher Query Language

Read Properties of a Node:

MATCH (actor:Actor)WHERE actor.name="Tom HanksRETURN actor;

● Actor is the Label● actor is the variable for node● WHERE to restrict the result to ourcriteria● RETURN the properties on the node

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 27: Neo4J : Introduction to Graph Database

Question and Answer

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 28: Neo4J : Introduction to Graph Database

References

http://neo4j.com/docs/milestone/

http://neo4j.com/graphacademy/?gclid=CJ_Mn56e3b8CFXNo7AodVDoAkAhttps://www.youtube.com/watch?v=7Fsfa5DP9sE

groups.google.com/group/neo4j

Page 29: Neo4J : Introduction to Graph Database

Thank you

Presenter: Manash Ranjan Rautray, Mindfire Solutions

Page 30: Neo4J : Introduction to Graph Database

www.mindfiresolutions.com

https://www.facebook.com/MindfireSolutions

http://www.linkedin.com/company/mindfire-solutions

http://twitter.com/mindfires