2. Manash Ranjan Rautray, Software QA Engineer
Mindfire Solutions
Skills : WebDriver, Java, JUnit, Maven, Oracle 11G,Neo4j,Mongo DB
Certifications : 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 :manash.rautray@mindfiresolutiosn.com
Skype: mfsi_manashr
Presenter: Manash Ranjan Rautray, Mindfire
Solutions
About Me
3. 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
Presenter: Manash Ranjan Rautray, Mindfire
Solutions
4. What is Graph ?
Presenter: Manash Ranjan Rautray, Mindfire
Solutions
5. This is a Graph
Presenter: Manash Ranjan Rautray, Mindfire
Solutions
8. A graph database...
2N
O: 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
9. What is Neo4j?
Presenter: Manash Ranjan Rautray, Mindfire
Solutions
12. The Property Graph of Neo4j:
open_source:
true
language:’Swedish’
year:2007
Presenter: Manash Ranjan Rautray, Mindfire
Solutions
13. 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
14. 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
15. 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
17. Data Modeling : SQL vs.
Graph
Presenter: Manash Ranjan Rautray, Mindfire
Solutions
18. 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
USERS_CHANNELS CHANNELS
USERS_SUBSCRIPTIONS
User
ID
Channel
ID
1 3
1 4
2 3
2 5
3 1
Presenter: Manash Ranjan Rautray, Mindfire
Solutions
19. User
Channel Example: YouTube in a
name:’David’Graph
name:’Disco Dancing with David’
OPERATES
name:’David’s How-To Channel’
name:’Bob’
name:’Bob’s Cute Dog’
name:’Bob’s Gaming Channel’
name:’Alice’
name:’Cooking with Charles’ name:’Charles’
OPERATES
SUBSCRIBED
OPERATES
OPERATES
OPERATES
SUBSCRIBED
SUBSCRIBED
SUBSCRIBED
SUBSCRIBED
Presenter: Manash Ranjan Rautray, Mindfire
Solutions
20. Use Case: Social Media
Presenter: Manash Ranjan Rautray, Mindfire
Solutions
24. Cypher Query Language
● Is a declarative query language for querying
Neo4j
● Expressive and Human readable syntax
● Matches patterns of nodes and relationships to
extract/modify information in the graph
● With cypher, we can create, update, remove
nodes, relationships and properties
● Has an online console at http://www.neo4j.
org/console
● Has a short learning curve due to similarities with
SQL query statements
Presenter: Manash Ranjan Rautray, Mindfire
Solutions
25. 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
26. Cypher Query Language
Read Properties of a Node:
MATCH (actor:Actor)
WHERE actor.name="Tom Hanks
RETURN actor;
● Actor is the Label
● actor is the variable for node
● WHERE to restrict the result to our
criteria
● RETURN the properties on the node
Presenter: Manash Ranjan Rautray, Mindfire
Solutions