Relational databases were conceived to digitize paper forms and automate well-structured business processes, and still have their uses. But RDBMS cannot model or store data and its relationships without complexity, which means performance degrades with the increasing number and levels of data relationships and data size. Additionally, new types of data and data relationships require schema redesign that increases time to market.
A graph database like Neo4j naturally stores, manages, analyzes, and uses data within the context of connections meaning Neo4j provides faster query performance and vastly improved flexibility in handling complex hierarchies than SQL. Join this webinar to learn why companies are shifting away from RDBMS towards graphs to unlock the business value in their data relationships
3. AGENDA
• Use Cases
• SQL Pains
• Building a Neo4j Application
• Moving from RDBMS -> Graph Models
• Walk through an Example
• Creating Data in Graphs
• Querying Data
12. SYSTEMS OF RECORD
Relational Database Model
Structured
Pre-computed
Based on rigid rules
SYSTEMS OF ENGAGEMENT
NoSQL Database Model
Highly Flexible
Real-Time Queries
Highly Contextual
26. Speed
“We found Neo4j to be literally thousands of times faster
than our prior MySQL solution, with queries that require
10-100 times less code. Today, Neo4j provides eBay with
functionality that was previously impossible.”
- Volker Pacher, Senior Developer
“Minutes to milliseconds” performance
Queries up to 1000x faster than RDBMS or other NoSQL
28. A Naturally Adaptive Model
A Query Language Designed
for Connectedness
+
=Agility
29. Cypher
Typical Complex SQL Join The Same Query using Cypher
MATCH (boss)-[:MANAGES*0..3]->(sub),
(sub)-[:MANAGES*1..3]->(report)
WHERE boss.name = “John Doe”
RETURN sub.name AS Subordinate,
count(report) AS Total
Project Impact
Less time writing queries
Less time debugging queries
Code that’s easier to read
30. NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
31. NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
GRAPH THINKING:
Real Time Recommendations
VIEWED
VIEWED
BOUGHT
VIEWED
BOUGHT
BOUGHT
BOUGHT
BOUGHT
32. “As the current market leader in graph databases,
and with enterprise features for scalability and
availability, Neo4j is the right choice to meet our
demands.” Marcos Wada
Software Developer, Walmart
NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
33. NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
GRAPH THINKING:
Master Data Management
MANAGES
MANAGES
LEADS
REGION
M
ANAG
ES
MANAGES
REGION
LEADS
LEADS
COLLABORATES
34. Neo4j is the heart of Cisco HMP: used for governance
and single source of truth and a one-stop shop for all
of Cisco’s hierarchies.
NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
35. NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
GRAPH THINKING:
Master Data Management
Solu%on
Support
Case
Support
Case
Knowledge
Base Ar%cle
Message
Knowledge
Base Ar%cle
Knowledge
Base Ar%cle
Neo4j is the heart of Cisco’s Helpdesk Solution too.
36. NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
GRAPH THINKING:
Fraud Detection
O
PENED_ACCO
UNT
HAS
IS_ISSUED
HAS
LIVES
LIVES
IS_ISSUED
OPENED_ACCOUNT
37. “Graph databases offer new methods of uncovering
fraud rings and other sophisticated scams with a
high-level of accuracy, and are capable of stopping
advanced fraud scenarios in real-time.”
Gorka Sadowski
Cyber Security Expert
NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
38. GRAPH THINKING:
Graph Based Search
NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
PUBLISH
INCLUDE
INCLUDE
CREATE
CAPTURE
IN
IN
SOURCE
USES
USES
IN
IN
USES
SOURCE
SOURCE
39. Uses Neo4j to manage the digital assets inside of its next
generation in-flight entertainment system.
NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
40. NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
BROWSES
CONNECTS
BRIDGES
ROUTES
POWERS
ROUTES
POWERS
POWERS
HOSTS
QUERIES
GRAPH THINKING:
Network & IT-Operations
41. Uses Neo4j for network topology analysis
for big telco service providers
NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
42. GRAPH THINKING:
Identity And Access Management
NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
TRUSTS
TRUSTS
ID
ID
AUTHENTICATES
AUTHENTICATES
O
W
NS
OWNS
CAN_READ
43. UBS was the recipient of the 2014
Graphie Award for “Best Identify And
Access Management App”
NEO4j USE CASES
Real Time Recommendations
Master Data Management
Fraud Detection
Identity & Access Management
Graph Based Search
Network & IT-Operations
44.
45. Neo4j Adoption by Selected Verticals
SOFTWARE
FINANCIAL
SERVICES
RETAIL
MEDIA &
BROADCASTING
SOCIAL
NETWORKS
TELECOM HEALTHCARE
60. • Complex to model and store relationships
• Performance degrades with increases in data
• Queries get long and complex
• Maintenance is painful
SQL Pains
61. • Easy to model and store relationships
• Performance of relationship traversal remains constant with
growth in data size
• Queries are shortened and more readable
• Adding additional properties and relationships can be done on
the fly - no migrations
Graph Gains
62. Relational Versus Graph Models
Relational Model Graph Model
KNOWS
KNOWS
KNOWS
ANDREAS
TOBIAS
MICA
DELIA
Person FriendPerson-Friend
ANDREAS
DELIA
TOBIAS
MICA
76. RDBMS to Graph Options
MIGRATE
ALL DATA
MIGRATE
SUBSET
DUPLICATE
SUBSET
Non-Graph Queries Graph Queries
Graph Queries Non-Graph Queries
All Queries
Rela3onal
Database
Graph
Database
Application
Application
Application
Non Graph
Data
All Data
98. Who do people report to?
MATCH
(e:Employee)<-[:REPORTS_TO]-(sub:Employee)
RETURN
e.employeeID AS managerID,
e.firstName AS managerName,
sub.employeeID AS employeeID,
sub.firstName AS employeeName;
120. 3 Steps to Creating the Graph
IMPORT NODES CREATE INDEXES IMPORT RELATIONSHIPS
121. Importing Nodes
// Create customers
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://
raw.githubusercontent.com/neo4j-contrib/developer-resources/
gh-pages/data/northwind/customers.csv" AS row
CREATE (:Customer {companyName: row.CompanyName, customerID:
row.CustomerID, fax: row.Fax, phone: row.Phone});
// Create products
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://
raw.githubusercontent.com/neo4j-contrib/developer-resources/
gh-pages/data/northwind/products.csv" AS row
CREATE (:Product {productName: row.ProductName, productID:
row.ProductID, unitPrice: toFloat(row.UnitPrice)});
122. Importing Nodes
// Create suppliers
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://
raw.githubusercontent.com/neo4j-contrib/developer-resources/
gh-pages/data/northwind/suppliers.csv" AS row
CREATE (:Supplier {companyName: row.CompanyName, supplierID:
row.SupplierID});
// Create employees
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://
raw.githubusercontent.com/neo4j-contrib/developer-resources/
gh-pages/data/northwind/employees.csv" AS row
CREATE (:Employee {employeeID:row.EmployeeID, firstName:
row.FirstName, lastName: row.LastName, title: row.Title});
123. Importing Nodes
// Create categories
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://
raw.githubusercontent.com/neo4j-contrib/developer-resources/
gh-pages/data/northwind/categories.csv" AS row
CREATE (:Category {categoryID: row.CategoryID, categoryName:
row.CategoryName, description: row.Description});
// Create orders
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://
raw.githubusercontent.com/neo4j-contrib/developer-resources/
gh-pages/data/northwind/orders.csv" AS row
MERGE (order:Order {orderID: row.OrderID}) ON CREATE SET
order.shipName = row.ShipName;
124. Creating Indexes
CREATE INDEX ON :Product(productID);
CREATE INDEX ON :Product(productName);
CREATE INDEX ON :Category(categoryID);
CREATE INDEX ON :Employee(employeeID);
CREATE INDEX ON :Supplier(supplierID);
CREATE INDEX ON :Customer(customerID);
CREATE INDEX ON :Customer(customerName);
125. Creating Relationships
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://
raw.githubusercontent.com/neo4j-contrib/developer-resources/
gh-pages/data/northwind/orders.csv" AS row
MATCH (order:Order {orderID: row.OrderID})
MATCH (customer:Customer {customerID: row.CustomerID})
MERGE (customer)-[:PURCHASED]->(order);
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://
raw.githubusercontent.com/neo4j-contrib/developer-resources/
gh-pages/data/northwind/products.csv" AS row
MATCH (product:Product {productID: row.ProductID})
MATCH (supplier:Supplier {supplierID: row.SupplierID})
MERGE (supplier)-[:SUPPLIES]->(product);
126. Creating Relationships
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-
contrib/developer-resources/gh-pages/data/northwind/orders.csv" AS row
MATCH (order:Order {orderID: row.OrderID})
MATCH (product:Product {productID: row.ProductID})
MERGE (order)-[pu:INCLUDES]->(product)
ON CREATE SET pu.unitPrice = toFloat(row.UnitPrice), pu.quantity =
toFloat(row.Quantity);
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-
contrib/developer-resources/gh-pages/data/northwind/orders.csv" AS row
MATCH (order:Order {orderID: row.OrderID})
MATCH (employee:Employee {employeeID: row.EmployeeID})
MERGE (employee)-[:SOLD]->(order);
127. Creating Relationships
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/
neo4j-contrib/developer-resources/gh-pages/data/northwind/
products.csv" AS row
MATCH (product:Product {productID: row.ProductID})
MATCH (category:Category {categoryID: row.CategoryID})
MERGE (product)-[:PART_OF]->(category);
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/
neo4j-contrib/developer-resources/gh-pages/data/northwind/
employees.csv" AS row
MATCH (employee:Employee {employeeID: row.EmployeeID})
MATCH (manager:Employee {employeeID: row.ReportsTo})
MERGE (employee)-[:REPORTS_TO]->(manager);
132. User Defined Procedures
User-defined procedures are written in Java,
deployed into the database, and called from Cypher.
http://neo4j.com/docs/developer-manual/current/#procedures