Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Getting started with
Graph Databases & Neo4j
Suroor Wijdan
@wotthetech
Agenda for Today
● Intro to Graph Databases
● Who is using graph databases?
● What is Neo4j?
● MongoDB vs Neo4j?
● Nodes a...
What is NoSQL?
● NoSQL stands for “Not Only SQL”
● Some questions which you can ask to database:
○ What is my Average Inco...
Intro to Graph Databases
Graph is everywhere
● Graph Databases
present a new
perspective on the
same type of data.
● Graph...
A Quote....
“A relational database may tell you how much your
customer has spent at your store”
“but”
“a graph database wi...
Who is using Graph Databases?
● Some big names using Graph Databases:
○ Facebook - Open Graph Database
○ Google - Knowledg...
What is Neo4j?
● Neo4j is a robust property graph database
● Fully Transactional (ACID)
● Highly Agile
● Best suited for d...
What is Neo4j?
● Neo4j allows infinite depth
● Uses Cypher Query Language for querying,
also has Java and REST API’s
● Hum...
MongoDB vs Neo4j
MongoDB is meant for cases where you would
like to have dynamic queries on quite a size of
data.
- Not ca...
Nodes and Relationships
● A minimal graph can consist of a single node
with properties defined on it.
● A Property graph h...
Nodes and Relationships
Da Vinci Code
Dan Brown Manoj
Roni
The Lost Symbol
Gone with the Wind
Suspense
Thriller
Nodes and Relationships
Da Vinci Code
Dan Brown Manoj
Roni
The Lost Symbol
Harry Potter
Suspense
Thriller
Authored By
Read...
Cypher Query Language
● Is a declarative query language for querying Neo4j
● Expressive and Human readable syntax
● Matche...
Cypher Query Language
Create a Node:
CREATE (n:User { fname:"Manoj", lname:“Nama” });
● User is the Label
● n is the varia...
Cypher Query Language
Read Properties of a Node:
MATCH (n:User)
WHERE n.fname = “Manoj”
RETURN n
● User is the Label
● n i...
Cypher Query Language
Update property on a Node:
MATCH (user:User)
WHERE user.fname = 'Manoj'
SET user.lname = ‘Mohan’
RET...
Cypher Query Language
Delete a Node:
MATCH (user:User)
WHERE user.fname = 'Emily'
DELETE user
● User is the Label
● Restri...
Cypher Query Language
Set a new property on a Node after creation:
MATCH (user:User)
WHERE user.name = 'Roni'
SET user.cou...
Cypher Query Language
Find a node in CQL
START n=node(*)
WHERE HAS (n.name) AND n.name = "Roni"
RETURN n;
● START clause t...
Steps to get a Neo4j server up & running
(Linux)
Run the following commands in Terminal:
● sudo bash
● wget -O - http://de...
Neo4j Web Admin
References
1. Online Manual - http://docs.neo4j.org/chunked/milestone/
2. Online Cypher Console - http://console.neo4j.org...
THANKS!
Get in touch for any queries :
twitter: @wotthetech
github: suroorwijdan
PS: You are free to share this ppt but gi...
Upcoming SlideShare
Loading in …5
×

Getting started with Graph Databases & Neo4j

3,434 views

Published on

The presentation gives a brief information about Graph Databases and its usage in today's scenario. Moving on the presentation talks about the popular Graph DB Neo4j and its Cypher Query Language i.e., used to query the graph.

Published in: Technology
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Getting started with Graph Databases & Neo4j

  1. 1. Getting started with Graph Databases & Neo4j Suroor Wijdan @wotthetech
  2. 2. Agenda for Today ● Intro to Graph Databases ● Who is using graph databases? ● What is Neo4j? ● MongoDB vs Neo4j? ● Nodes and Relationships ● Cypher Query Language ● CRUD operations in CQL ● Project Use Case ● Questions? ● Exercises
  3. 3. What is NoSQL? ● NoSQL stands for “Not Only SQL” ● Some questions which you can ask to database: ○ What is my Average Income? ○ What Items I have in his Shopping Cart? ○ How did I get into this session? - Ask a RDBMS - Ask a Key Value Store - Ask a Graph
  4. 4. Intro to Graph Databases Graph is everywhere ● Graph Databases present a new perspective on the same type of data. ● Graph is the most generic type of data structure capable of storing data in highly accessible way ● Suitable for any kind of data that is related ● Graph databases are optimized for the relations between records ● a graph containing Nodes & Relationships ● with both having Properties ● verily perfect for complex and highly connected data Important Quote
  5. 5. A Quote.... “A relational database may tell you how much your customer has spent at your store” “but” “a graph database will tell your customers what should they buy next”
  6. 6. 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 ○ Hellwet Packard ○ T-Mobile ○ Cisco ALL THESE USE
  7. 7. What is Neo4j? ● Neo4j is a robust property graph database ● Fully Transactional (ACID) ● Highly Agile ● Best suited for data which is highly connected ● Is supremely fast when it comes to querying connected data ● The most popular graph database in the world ● Highly scalable, up to several billion nodes/relationships/properties
  8. 8. What is Neo4j? ● Neo4j allows infinite depth ● Uses Cypher Query Language for querying, also has Java and REST API’s ● Human Readable Queries ● Data Modelling 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 ● Neo4j helps us derive patterns from our data
  9. 9. MongoDB vs Neo4j MongoDB is meant for cases where you would like to have dynamic queries on quite a size of data. - Not capable of handling relationships Neo4j is best suitable in use cases where you have complex relationships and data which is highly connected. Neo4j can help you find routes, social patterns, etc. from your data. - Not Horizontally Scalable (as of now)
  10. 10. Nodes and Relationships ● A minimal graph can consist of a single node with properties defined on it. ● A Property graph has Nodes and Relationships with properties defined on them. ● node ( vertex) ● relationship (edge) :- with direction ● property(attribute) :- on nodes and relationships Lets see an example: -
  11. 11. Nodes and Relationships Da Vinci Code Dan Brown Manoj Roni The Lost Symbol Gone with the Wind Suspense Thriller
  12. 12. Nodes and Relationships Da Vinci Code Dan Brown Manoj Roni The Lost Symbol Harry Potter Suspense Thriller Authored By Read By Friendswith Authored By Recommends Belongs To BelongsTo Belongs To Release Date Recom m ends J.K Rowling Authored By An Example of Book Store with Recommendations
  13. 13. 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
  14. 14. Cypher Query Language Create a Node: CREATE (n:User { fname:"Manoj", lname:“Nama” }); ● User is the Label ● n is the variable for new node ● {} brackets to add properties to the node
  15. 15. Cypher Query Language Read Properties of a Node: MATCH (n:User) WHERE n.fname = “Manoj” RETURN n ● User is the Label ● n is the variable for node ● WHERE to restrict the result to our criteria ● RETURN the properties on the node
  16. 16. Cypher Query Language Update property on a Node: MATCH (user:User) WHERE user.fname = 'Manoj' SET user.lname = ‘Mohan’ RETURN user.fname, user.lname; ● User is the Label ● Restricts search to the nodes under USER label ● SET adds a new property to the node ● RETURN clause indicates what data to return
  17. 17. Cypher Query Language Delete a Node: MATCH (user:User) WHERE user.fname = 'Emily' DELETE user ● User is the Label ● Restricts search to the nodes under USER label ● DELETE clause deletes a node from graph ● RETURN clause indicates what data to return
  18. 18. Cypher Query Language Set a new property on a Node after creation: MATCH (user:User) WHERE user.name = 'Roni' SET user.country = ‘India’ RETURN user.name, user.country; ● User is the Label ● Restricts search to the nodes under USER label ● SET adds or updates a property on a node ● RETURN clause indicates what data to return
  19. 19. Cypher Query Language Find a node in CQL START n=node(*) WHERE HAS (n.name) AND n.name = "Roni" RETURN n; ● START clause to begin a query ● n=node(*) to search through all nodes ● WHERE clause to constrain the results ● n.name indicates the name property must exist ● = "Roni" compares an existing name to the value Roni ● RETURN clause requests particular results
  20. 20. Steps to get a Neo4j server up & running (Linux) Run the following commands in Terminal: ● sudo bash ● wget -O - http://debian.neo4j. org/neotechnology.gpg.key | apt-key add - ● echo 'deb http://debian.neo4j.org/repo stable/' > /etc/apt/sources.list.d/neo4j. list ● apt-get install neo4j ● start neo4j server, available at http: //localhost:7474 of the machine neo4j start
  21. 21. Neo4j Web Admin
  22. 22. References 1. Online Manual - http://docs.neo4j.org/chunked/milestone/ 2. Online Cypher Console - http://console.neo4j.org 3. Cypher Cheat Sheet - http://docs.neo4j.org/refcard/1.9/ 4. Graph image taken from - http://www.neo4j.org
  23. 23. THANKS! Get in touch for any queries : twitter: @wotthetech github: suroorwijdan PS: You are free to share this ppt but give due credit to the creator wherever used.

×