SlideShare a Scribd company logo
Graph Database
Using
Neo4J
By Harmeet Singh(Taara)
(Java EE Developer)
Email: harmeetsingh.0013@gmail.com
Website: http://programmers-nest.com
Blog: http://harmeetsingh13.blogspot.com
Skype: harmeetsingh0013
Contents
➔ Introduction
➔ Big Data
➔ Graph Databases
➔ Graph DB Vs RDBMS
➔ Journey: RDBMS To Graph DB Modeling
➔ Neo4J
➔ Cypher Query
◆ CREATE, MATCH, WHERE, SET, DELETE, RETURN, REMOVE
◆ Relationship
◆ ORDER BY, SKIP, LIMIT, DISTINCT
◆ Aggregation
➔ Spring-Data-Neo4J Sample
➔ Leftover: The things we didn't cover
Acknowledgement
➔ Thanks To My Parents.
➔ Thanks To All Who Support Me or Not.
➔ Dedicated To My Teacher “Mr. Kapil Sakhuja”.
Introduction
➔ Today, we discuss about Graph Database and Why
Graph Databases involved.
➔ How we use Graph Database using Neo4J.
➔ Cypher Query Language for Neo4J.
➔ Spring-Data-Neo4J Sample Application.
BigData
Graph Database
➔ A Graph Database is a set of vertices and
edges.
➔ Graph Databases is to view the data as an
arbitrary set of objects connected by one or
more kinds of relationships.
Graph DB Vs RDBMS
➔ RDBMS limitation on How a relationship is defined
within a relational database?
➔ In RDBMS creating a join table that brings together
two disparate tables is a common practice, doing so
adds a layer of complexity.
Graph DB Vs RDBMS
➔ A join table is created in order to have metadata that
provides properties about relationships between two
tables. When a similar relationship needs to be created
among other tables, yet another join table must be
created.
➔ Graph databases over relational database is to avoid
what might be referred to as “join hell”
Journey: RDBMS to Graph DB Modeling
➔ In RDBMS, the data is collected in form of Tables, and
the Tables are define with Rows And Columns.
➔ The single table contains Multiple Records and these
records are represent to real world Entity.
Journey: RDBMS to Graph DB Modeling
➔ Now, in Graph Database the data represent in the form
of Nodes and One node is compared to one record in
table.
➔ The Node type is compared to Entity.
➔ In Graph DB, we can create easy relationships with
nodes.
Neo4J
Necessity Is The Mother Of Invention
➔ Neo4j began its life in 2000, when Emil Eifrem, Johan
Svensson, and Peter Naubauer.
➔ World’s Best And First Graph Database.
Neo4J
➔ The “j” in Neo4j stands for Java, and the Java
Development Kit (JDK) is required to run it.
➔ Neo aimed to introduce a database that offered a
better way to model, store, and retrieve data while
keeping all of the core concepts—such as ACIDity,
transactions, and so forth—that made relational
databases into a proven commodity.
Cypher Query Language
➔ Cypher is the Declarative Query Language used for
data manipulation in Neo4j.
➔ A Declarative Language is a high-level type of
language in which the purpose is to instruct the
application on what needs to be done or what you
want from the application, as opposed to how to do it.
➔ Cypher is a Case Sensitive Language.
Cypher Query Language
➔ Cypher is a declarative, SQL-inspired language for
describing patterns in graphs. It allows us to describe
what we want to select, insert, update or delete from a
Graph Database without requiring us to describe
exactly how to do it.
➔ Cypher is not yet a standard graph database language
that can interact with other graph database platforms.
CREATE
➔ SQL
◆ INSERT INTO User (name, age) values
(“James”, 26)
➔ Cypher
◆ CREATE (u:User {name:"James",age:"26"})
RETURN u
MATCH
➔ SQL
◆ SELECT * FROM User
◆ SELECT u.name FROM USER u
➔ Cypher
◆ MATCH (u:User) RETURN u
◆ MATCH (u:User) RETURN u.name
WHERE
➔ SQL
◆ SELECT * FROM User u WHERE u.age = 26
➔ Cypher
◆ MATCH (u:User {age:26}) RETURN u
◆ MATCH (u:User) WHERE u.age = 26 RETURN u
SET
➔ SQL
◆ UPDATE User u SET u.age = 26 WHERE u.name
= “James”
◆ ALTER TABLE User ADD address varchar(45)
➔ Cypher
◆ MATCH (u:User {name:"James"}) SET u.age =
26 RETURN u
◆ MATCH (u:User {name:"James"}) SET u.
address = "Moga" RETURN u
DELETE
➔ SQL
◆ DELETE FROM User u WHERE u.name IS NULL
➔ Cypher
◆ MATCH(u:User) WHERE u.name IS NULL DELETE
u
➔ NOTE: If you delete a node that has relationships, you need
to be sure to remove the relationships as well
RETURN
➔ The RETURN is similar to the SELECT statement found
in SQL
➔ SQL
◆ SELECT u.name AS UserName, u.age AS Age
FROM User u
➔ Cypher
◆ MATCH(u:User) RETURN u.name AS UserName,
u.age AS Age
REMOVE
➔ SQL
◆ ALTER TABLE User u DROP COLUMN u.address
WHERE u.name = “James”
➔ Cypher
◆ MATCH(u:User {name:"James"}) REMOVE u.
address RETURN u
Relationships
➔ CREATE Relation
◆ Match (u:User {name:"James"}), (c:Company
{name:"Netsol"}) create (u)-[:EMP]-> (c)
◆ Match (u:User {id:1}), (u1:User {id:2})
create (u)-[:FRIEND {type:"Brothers"}]->
(u1) RETURN u, u1
➔ NOTE: By convention those relationship-types are written
all upper case using underscores between words.
Relationships
➔ MATCH
◆ (node1)-[rel:TYPE]->(node2)
◆ MATCH(u:User) -[rel:FRIEND]-> (u1:User)
RETURN u.name, u1.name, rel.type
◆ MATCH(u:User) -[:FRIEND]-> (u1:User) -[:
FRIEND]-> (u2:User) RETURN u, u1, u2
Relationships
➔ MATCH
◆ MATCH(u:User) -[*]-> (u1:User) RETURN u,
u1
◆ MATCH(u:User) -[*1..5]-> (u1:User) RETURN
u, u1
◆ MATCH(u:User) -[*2]-> (u1:User) RETURN u,
u1
◆ MATCH(u:User) -[:FRIEND*2]-> (u1:User)
RETURN u, u1
DISTINCT, ORDER BY, SKIP, LIMIT
➔ SQL
◆ SELECT DISTINCT u.name FROM User u WHERE
u.age = 25 ORDER BY u.name DESC
OFFSET 0 LIMIT 5
➔ Cypher
◆ MATCH(u:User {age:25}) RETURN
DISTINCT u.name ORDER BY u.name DESC
SKIP 0 LIMIT 5
Aggregation
➔ COUNT
◆ MATCH(u:User {age:25}) RETURN COUNT(u.
name)
➔ COLLECT
◆ MATCH(u:User {age:25}) RETURN COLLECT(u.
name)
➔ NOTE: There are more aggregation functions like
min(), max(), avg() etc.
Spring-Data-Neo4j Sample
➔ Please access below link for Spring-Data-Neo4j Sample
Application.
◆ https://github.com/harmeetsingh0013/Spring-Data-
Neo4j-Example
Leftover: The things we didn’t cover
➔ Graph Theory
➔ Database ACID Operations
➔ Graph DB Modeling
➔ Advance Cypher Query Language
➔ Neo4j Aggregation Functions
➔ Neo4J Native Libraries With Java
➔ Neo4J Rest API
➔ Indexing
References
➔ Practical Neo4J By Gregory Jordan
Foreword By Jim Webber
➔ http://neo4j.com/top-ten-reasons/
➔ http://neo4j.com/developer/get-started/

More Related Content

Similar to Graph Database Using Neo4J

Data Modeling with Neo4j
Data Modeling with Neo4jData Modeling with Neo4j
Data Modeling with Neo4j
Neo4j
 
Neo4j (Part 1)
Neo4j (Part 1)Neo4j (Part 1)
Neo4j (Part 1)
Bibhuti Regmi
 
GraphDatabase.pptx
GraphDatabase.pptxGraphDatabase.pptx
GraphDatabase.pptx
JeyaVarthini1
 
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
Athens Big Data
 
03 introduction to graph databases
03   introduction to graph databases03   introduction to graph databases
03 introduction to graph databases
Neo4j
 
Change RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDBChange RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDB
Apaichon Punopas
 
Introduction to SQL Server Graph DB
Introduction to SQL Server Graph DBIntroduction to SQL Server Graph DB
Introduction to SQL Server Graph DB
Greg McMurray
 
Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...
Robert Schadek
 
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Databricks
 
Using Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowUsing Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 Flow
Karsten Dambekalns
 
NoSQL, Neo4J for Java Developers , OracleWeek-2012
NoSQL, Neo4J for Java Developers , OracleWeek-2012NoSQL, Neo4J for Java Developers , OracleWeek-2012
NoSQL, Neo4J for Java Developers , OracleWeek-2012
Eugene Hanikblum
 
AnzoGraph DB - SPARQL 101
AnzoGraph DB - SPARQL 101AnzoGraph DB - SPARQL 101
AnzoGraph DB - SPARQL 101
Cambridge Semantics
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph Databases
Max De Marzi
 
PGQL: A Language for Graphs
PGQL: A Language for GraphsPGQL: A Language for Graphs
PGQL: A Language for Graphs
Jean Ihm
 
The openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query Language
Neo4j
 
PHP Development With MongoDB
PHP Development With MongoDBPHP Development With MongoDB
PHP Development With MongoDBFitz Agard
 
PHP Development with MongoDB (Fitz Agard)
PHP Development with MongoDB (Fitz Agard)PHP Development with MongoDB (Fitz Agard)
PHP Development with MongoDB (Fitz Agard)MongoSF
 
Hands on Training – Graph Database with Neo4j
Hands on Training – Graph Database with Neo4jHands on Training – Graph Database with Neo4j
Hands on Training – Graph Database with Neo4j
Serendio Inc.
 

Similar to Graph Database Using Neo4J (20)

Data Modeling with Neo4j
Data Modeling with Neo4jData Modeling with Neo4j
Data Modeling with Neo4j
 
Neo4j (Part 1)
Neo4j (Part 1)Neo4j (Part 1)
Neo4j (Part 1)
 
GraphDatabase.pptx
GraphDatabase.pptxGraphDatabase.pptx
GraphDatabase.pptx
 
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
 
03 introduction to graph databases
03   introduction to graph databases03   introduction to graph databases
03 introduction to graph databases
 
CouchDB
CouchDBCouchDB
CouchDB
 
Change RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDBChange RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDB
 
Introduction to SQL Server Graph DB
Introduction to SQL Server Graph DBIntroduction to SQL Server Graph DB
Introduction to SQL Server Graph DB
 
Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...
 
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
 
Using Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowUsing Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 Flow
 
NoSQL, Neo4J for Java Developers , OracleWeek-2012
NoSQL, Neo4J for Java Developers , OracleWeek-2012NoSQL, Neo4J for Java Developers , OracleWeek-2012
NoSQL, Neo4J for Java Developers , OracleWeek-2012
 
Neo4j
Neo4jNeo4j
Neo4j
 
AnzoGraph DB - SPARQL 101
AnzoGraph DB - SPARQL 101AnzoGraph DB - SPARQL 101
AnzoGraph DB - SPARQL 101
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph Databases
 
PGQL: A Language for Graphs
PGQL: A Language for GraphsPGQL: A Language for Graphs
PGQL: A Language for Graphs
 
The openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query Language
 
PHP Development With MongoDB
PHP Development With MongoDBPHP Development With MongoDB
PHP Development With MongoDB
 
PHP Development with MongoDB (Fitz Agard)
PHP Development with MongoDB (Fitz Agard)PHP Development with MongoDB (Fitz Agard)
PHP Development with MongoDB (Fitz Agard)
 
Hands on Training – Graph Database with Neo4j
Hands on Training – Graph Database with Neo4jHands on Training – Graph Database with Neo4j
Hands on Training – Graph Database with Neo4j
 

Recently uploaded

Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 

Recently uploaded (20)

Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 

Graph Database Using Neo4J

  • 1. Graph Database Using Neo4J By Harmeet Singh(Taara) (Java EE Developer) Email: harmeetsingh.0013@gmail.com Website: http://programmers-nest.com Blog: http://harmeetsingh13.blogspot.com Skype: harmeetsingh0013
  • 2. Contents ➔ Introduction ➔ Big Data ➔ Graph Databases ➔ Graph DB Vs RDBMS ➔ Journey: RDBMS To Graph DB Modeling ➔ Neo4J ➔ Cypher Query ◆ CREATE, MATCH, WHERE, SET, DELETE, RETURN, REMOVE ◆ Relationship ◆ ORDER BY, SKIP, LIMIT, DISTINCT ◆ Aggregation ➔ Spring-Data-Neo4J Sample ➔ Leftover: The things we didn't cover
  • 3. Acknowledgement ➔ Thanks To My Parents. ➔ Thanks To All Who Support Me or Not. ➔ Dedicated To My Teacher “Mr. Kapil Sakhuja”.
  • 4. Introduction ➔ Today, we discuss about Graph Database and Why Graph Databases involved. ➔ How we use Graph Database using Neo4J. ➔ Cypher Query Language for Neo4J. ➔ Spring-Data-Neo4J Sample Application.
  • 6. Graph Database ➔ A Graph Database is a set of vertices and edges. ➔ Graph Databases is to view the data as an arbitrary set of objects connected by one or more kinds of relationships.
  • 7. Graph DB Vs RDBMS ➔ RDBMS limitation on How a relationship is defined within a relational database? ➔ In RDBMS creating a join table that brings together two disparate tables is a common practice, doing so adds a layer of complexity.
  • 8. Graph DB Vs RDBMS ➔ A join table is created in order to have metadata that provides properties about relationships between two tables. When a similar relationship needs to be created among other tables, yet another join table must be created. ➔ Graph databases over relational database is to avoid what might be referred to as “join hell”
  • 9. Journey: RDBMS to Graph DB Modeling ➔ In RDBMS, the data is collected in form of Tables, and the Tables are define with Rows And Columns. ➔ The single table contains Multiple Records and these records are represent to real world Entity.
  • 10. Journey: RDBMS to Graph DB Modeling ➔ Now, in Graph Database the data represent in the form of Nodes and One node is compared to one record in table. ➔ The Node type is compared to Entity. ➔ In Graph DB, we can create easy relationships with nodes.
  • 11. Neo4J Necessity Is The Mother Of Invention ➔ Neo4j began its life in 2000, when Emil Eifrem, Johan Svensson, and Peter Naubauer. ➔ World’s Best And First Graph Database.
  • 12. Neo4J ➔ The “j” in Neo4j stands for Java, and the Java Development Kit (JDK) is required to run it. ➔ Neo aimed to introduce a database that offered a better way to model, store, and retrieve data while keeping all of the core concepts—such as ACIDity, transactions, and so forth—that made relational databases into a proven commodity.
  • 13. Cypher Query Language ➔ Cypher is the Declarative Query Language used for data manipulation in Neo4j. ➔ A Declarative Language is a high-level type of language in which the purpose is to instruct the application on what needs to be done or what you want from the application, as opposed to how to do it. ➔ Cypher is a Case Sensitive Language.
  • 14. Cypher Query Language ➔ Cypher is a declarative, SQL-inspired language for describing patterns in graphs. It allows us to describe what we want to select, insert, update or delete from a Graph Database without requiring us to describe exactly how to do it. ➔ Cypher is not yet a standard graph database language that can interact with other graph database platforms.
  • 15. CREATE ➔ SQL ◆ INSERT INTO User (name, age) values (“James”, 26) ➔ Cypher ◆ CREATE (u:User {name:"James",age:"26"}) RETURN u
  • 16. MATCH ➔ SQL ◆ SELECT * FROM User ◆ SELECT u.name FROM USER u ➔ Cypher ◆ MATCH (u:User) RETURN u ◆ MATCH (u:User) RETURN u.name
  • 17. WHERE ➔ SQL ◆ SELECT * FROM User u WHERE u.age = 26 ➔ Cypher ◆ MATCH (u:User {age:26}) RETURN u ◆ MATCH (u:User) WHERE u.age = 26 RETURN u
  • 18. SET ➔ SQL ◆ UPDATE User u SET u.age = 26 WHERE u.name = “James” ◆ ALTER TABLE User ADD address varchar(45) ➔ Cypher ◆ MATCH (u:User {name:"James"}) SET u.age = 26 RETURN u ◆ MATCH (u:User {name:"James"}) SET u. address = "Moga" RETURN u
  • 19. DELETE ➔ SQL ◆ DELETE FROM User u WHERE u.name IS NULL ➔ Cypher ◆ MATCH(u:User) WHERE u.name IS NULL DELETE u ➔ NOTE: If you delete a node that has relationships, you need to be sure to remove the relationships as well
  • 20. RETURN ➔ The RETURN is similar to the SELECT statement found in SQL ➔ SQL ◆ SELECT u.name AS UserName, u.age AS Age FROM User u ➔ Cypher ◆ MATCH(u:User) RETURN u.name AS UserName, u.age AS Age
  • 21. REMOVE ➔ SQL ◆ ALTER TABLE User u DROP COLUMN u.address WHERE u.name = “James” ➔ Cypher ◆ MATCH(u:User {name:"James"}) REMOVE u. address RETURN u
  • 22. Relationships ➔ CREATE Relation ◆ Match (u:User {name:"James"}), (c:Company {name:"Netsol"}) create (u)-[:EMP]-> (c) ◆ Match (u:User {id:1}), (u1:User {id:2}) create (u)-[:FRIEND {type:"Brothers"}]-> (u1) RETURN u, u1 ➔ NOTE: By convention those relationship-types are written all upper case using underscores between words.
  • 23. Relationships ➔ MATCH ◆ (node1)-[rel:TYPE]->(node2) ◆ MATCH(u:User) -[rel:FRIEND]-> (u1:User) RETURN u.name, u1.name, rel.type ◆ MATCH(u:User) -[:FRIEND]-> (u1:User) -[: FRIEND]-> (u2:User) RETURN u, u1, u2
  • 24. Relationships ➔ MATCH ◆ MATCH(u:User) -[*]-> (u1:User) RETURN u, u1 ◆ MATCH(u:User) -[*1..5]-> (u1:User) RETURN u, u1 ◆ MATCH(u:User) -[*2]-> (u1:User) RETURN u, u1 ◆ MATCH(u:User) -[:FRIEND*2]-> (u1:User) RETURN u, u1
  • 25. DISTINCT, ORDER BY, SKIP, LIMIT ➔ SQL ◆ SELECT DISTINCT u.name FROM User u WHERE u.age = 25 ORDER BY u.name DESC OFFSET 0 LIMIT 5 ➔ Cypher ◆ MATCH(u:User {age:25}) RETURN DISTINCT u.name ORDER BY u.name DESC SKIP 0 LIMIT 5
  • 26. Aggregation ➔ COUNT ◆ MATCH(u:User {age:25}) RETURN COUNT(u. name) ➔ COLLECT ◆ MATCH(u:User {age:25}) RETURN COLLECT(u. name) ➔ NOTE: There are more aggregation functions like min(), max(), avg() etc.
  • 27. Spring-Data-Neo4j Sample ➔ Please access below link for Spring-Data-Neo4j Sample Application. ◆ https://github.com/harmeetsingh0013/Spring-Data- Neo4j-Example
  • 28. Leftover: The things we didn’t cover ➔ Graph Theory ➔ Database ACID Operations ➔ Graph DB Modeling ➔ Advance Cypher Query Language ➔ Neo4j Aggregation Functions ➔ Neo4J Native Libraries With Java ➔ Neo4J Rest API ➔ Indexing
  • 29. References ➔ Practical Neo4J By Gregory Jordan Foreword By Jim Webber ➔ http://neo4j.com/top-ten-reasons/ ➔ http://neo4j.com/developer/get-started/