RDBMS to Graph Webinar

120
RDBMS TO GRAPH Live from San Mateo, March 9, 2016 Webinar

Transcript of RDBMS to Graph Webinar

Page 1: RDBMS to Graph Webinar

RDBMS TO GRAPH

Live from San Mateo, March 9, 2016Webinar

Page 2: RDBMS to Graph Webinar

Data used to be stored like this: punch tape. Or punch cards. Horrible way to read and understand data.Impossible to index easily, cross-reference, eliminate inconsistencies and cross-reference.

Page 3: RDBMS to Graph Webinar

Then we started storing data in tables, and “relational” databases.

Sometimes those tables are human-readable.

But as soon as you normalize the data to eliminate duplication and inconsistencies, many fields start referencing auto-generated numerical foreign keys. And your data becomes difficult to understand and maintain without complicated JOIN queries.

Page 4: RDBMS to Graph Webinar

ACCOUNT HOLDER 2

ACCOUNT HOLDER 1

ACCOUNT HOLDER 3

CREDIT CARD

BANKACCOUNT

BANKACCOUNT

BANKACCOUNT

ADDRESS

PHONE NUMBER

PHONE NUMBER

SSN 2

UNSECURE LOAN

SSN 2

UNSECURE LOAN

CREDIT CARD

Enter Graph Databases. The future is now.

Graph Databases, like Neo4j, store data in a much more logical way. A way that represents the real world, and prioritizes the representation, discoverability and maintainability of data relationships.

Page 5: RDBMS to Graph Webinar

IntuitivnessSpeedAgility

Page 6: RDBMS to Graph Webinar

IntuitivenessSpeedAgility

Page 7: RDBMS to Graph Webinar

Intuitiveness

Page 8: RDBMS to Graph Webinar

IntuitivnessSpeedAgility

Page 9: RDBMS to Graph Webinar

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

Page 10: RDBMS to Graph Webinar

IntuitivnessSpeedAgility

Page 11: RDBMS to Graph Webinar

A Naturally Adaptive Model

A Query Language Designed for Connectedness

+

=Agility

Page 12: RDBMS to Graph Webinar

CypherTypical 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 ImpactLess time writing queries

Less time debugging queries

Code that’s easier to read

Less time writing queriesMore time understanding the answersLeaving time to ask the next question

Less time debugging queries: More time writing the next piece of codeImproved quality of overall code base

Code that’s easier to read:Faster ramp-up for new project membersImproved maintainability & troubleshooting

Page 13: RDBMS to Graph Webinar

ABOUT ME• Developed web apps for 5 years

including e-commerce, business workflow, more.

• Worked at Google for 8 years on Google Apps, Cloud Platform

• Technologies: Python, Java, BigQuery, Oracle, MySQL, OAuth

[email protected] @ryguyrg

Page 14: RDBMS to Graph Webinar

NEO4j USE CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

Page 15: RDBMS to Graph Webinar

NEO4j USE CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

GRAPH THINKING: Real Time Recommendations

VIEW

ED

VIEWED

BOUG

HT

VIEWED BOUGHT

BOUGHT

BO

UG

HT

BOUG

HT

Real-Time Recommendations could be about finding the relationsships relevant to make recommend a product or a service…. …which is exactly why Walmart is using Neo4j.

Page 16: RDBMS to Graph Webinar

“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 CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

Page 17: RDBMS to Graph Webinar

NEO4j USE CASESReal 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

MANAGES

MANAGES

REGION

LEADS

LEADS

COLL

ABO

RATE

S

Master Data Management is about bringing together all the entities within an organization and external to the organization. To understand the relationship between each of them.

Page 18: RDBMS to Graph Webinar

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 CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

Cisco uses it for this — to power their content management, resources and knowledge-base articles for use by sales teams. It also powers product recommendations to make sure customers are getting the power of their offerings.

Although this project is focused on sales teams, another group has used Neo4j to power all of their helpdesk content -

Page 19: RDBMS to Graph Webinar

NEO4j USE CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

GRAPH THINKING: Master Data Management

Solu%onSupportCase

SupportCase

KnowledgeBaseAr%cle

Message

KnowledgeBaseAr%cle

KnowledgeBaseAr%cle

Neo4j is the heart of Cisco’s Helpdesk Solution too.

Master Data Management is about bringing together all the entities within an organization and external to the organization. To understand the relationship between each of them.

Page 20: RDBMS to Graph Webinar

NEO4j USE CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

GRAPH THINKING: Fraud Detection

OPENED_ACCOUNT

HAS IS_ISSUED

HAS

LIVES LIVES

IS_ISSUED

OPE

NED_

ACCO

UNT

Discovering fraud is another use case that is particularly suitable to graphs, because it’s all about about finding fraudulent patterns. Here we work with the top banks and insurance companies as well as many governments..

Page 21: RDBMS to Graph Webinar

“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 SadowskiCyber Security Expert

NEO4j USE CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

Page 22: RDBMS to Graph Webinar

GRAPH THINKING: Graph Based Search

NEO4j USE CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

PUBLISH

INCLUDE

INCLUDE

CREATE

CAPT

URE

IN

IN

SOURCE

USES

USES

IN

IN

USES

SOURCE SOURCE

Page 23: RDBMS to Graph Webinar

Uses Neo4j to manage the digital assets inside of its next generation in-flight entertainment system.

NEO4j USE CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

Page 24: RDBMS to Graph Webinar

NEO4j USE CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

BROWSES

CONN

ECTS

BRIDGES

ROUTES

POW

ERSROUTES

POWERSPOWERS

HOSTS

QUERIES

GRAPH THINKING: Network & IT-Operations

Decency analysisRoot cause analysis

Page 25: RDBMS to Graph Webinar

Uses Neo4j for network topology analysis for big telco service providers

NEO4j USE CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

Page 26: RDBMS to Graph Webinar

GRAPH THINKING: Identity And Access Management

NEO4j USE CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

TRUSTS

TRUSTS

ID

ID

AUTHENTICATES

AUTH

ENTI

CATE

S

OWNS

OWNSC

AN

_REA

D

Think of organizational hierarchies. No longer is it just a tree.

Page 27: RDBMS to Graph Webinar

UBS was the recipient of the 2014 Graphie Award for “Best Identify And Access Management App”

NEO4j USE CASESReal Time Recommendations

Master Data Management

Fraud Detection

Identity & Access Management

Graph Based Search

Network & IT-Operations

Page 28: RDBMS to Graph Webinar

Neo4j Adoption by Selected VerticalsSOFTWARE FINANCIAL

SERVICES RETAIL MEDIA & BROADCASTING

SOCIAL NETWORKS TELECOM HEALTHCARE

Page 29: RDBMS to Graph Webinar

AGENDA• Use Cases • SQL Pains • Building a Neo4j Application • Moving from RDBMS -> Graph Models

• Walk through an Example • Creating Data in Graphs • Querying Data

Page 30: RDBMS to Graph Webinar

I hired this kid for all the handwriting you’ll see throughout the presentation.So, don’t blame me.

Page 31: RDBMS to Graph Webinar

SQL

Day in the Life of a RDBMS Developer

Let’s explore how your SQL developer works today.

Page 32: RDBMS to Graph Webinar

They work with data in tables.

Here’s a table of people and where they're from, their hair color and the university they attended.

This table is fairly natural, but duplicating values across multiple rows. Let’s say you want to change the name of a university or a country, you’d have to update all rows.

Page 33: RDBMS to Graph Webinar

So, instead, you’d create a separate table for the country, with an ID that references it. This is your primary key.

Page 34: RDBMS to Graph Webinar

This allows you to add additional properties.

Page 35: RDBMS to Graph Webinar

Now, you use that ID to reference the country in the people table - a foreign key.

Page 36: RDBMS to Graph Webinar

And you’d want to normalize the university table as well.

Page 37: RDBMS to Graph Webinar

And use the university ID to reference it. Now your table it a lot less readable.

Page 38: RDBMS to Graph Webinar

So, we see this set of 3 tables with arrows indicating references between primary keys and foreign keys, used in JOINs.

Page 39: RDBMS to Graph Webinar

SELECT p.name, c.country, c.leader, p.hair, u.name, u.pres, u.stateFROM people p LEFT JOIN country c ON c.ID=p.country LEFT JOIN uni u ON p.uni=u.idWHERE u.state=‘CT’

Your SQL looks like this.Only, this is a super simple JOIN across 3 tables. I’ve often had to work with 10+ tables being JOINed.

Page 40: RDBMS to Graph Webinar

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

And your SQL developer? All she’s thinking about is joins

Page 41: RDBMS to Graph Webinar

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

All day long.

Page 42: RDBMS to Graph Webinar

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

JOIN

And they’re keeping her up at night as well.

Page 43: RDBMS to Graph Webinar

Meanwhile, it’s expensive to find data.So we add indexes to make it easier.But when we have to do index lookups for each and every JOIN?And we have a dozen JOINs?That’s expensive.

Page 44: RDBMS to Graph Webinar

What’s the solution? Denormalize! But now hard to maintain and have consistent data.

Page 45: RDBMS to Graph Webinar

• Complex to model and store relationships • Performance degrades with increases in data • Queries get long and complex • Maintenance is painful

SQL Pains

Page 46: RDBMS to Graph Webinar

• 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

Page 47: RDBMS to Graph Webinar

John Resig, who you may know as the creator of jQuery, loves Neo4j because it simplifies life.

Page 48: RDBMS to Graph Webinar

What does this Graph look like?

So you’ve seen what tables look like. How do graphs make this better?

Page 49: RDBMS to Graph Webinar

CYPHER

Ann DanLoves

The obligatory “Ann Loves Dan” example

Page 50: RDBMS to Graph Webinar

Property Graph Model

CREATE (:Person { name:“Dan”} ) - [:LOVES]-> (:Person { name:“Ann”} )

LOVES

LABEL PROPERTY

NODE NODE

LABEL PROPERTY

The whiteboard model is the physical model.

Page 51: RDBMS to Graph Webinar
Page 52: RDBMS to Graph Webinar

MATCH (p:Person)-[:WENT_TO]->(u:Uni), (p)-[:LIVES_IN]->(c:Country), (u)-[:LED_BY]->(l:Leader), (u)-[:LOCATED_IN]->(s:State)WHERE s.abbr = ‘CT’RETURN p.name, c.country, c.leader, p.hair, u.name, l.name, s.abbr

Page 53: RDBMS to Graph Webinar

David Meza, chief knowledge architect at NASA, had this to say.

Page 54: RDBMS to Graph Webinar

How do you use Neo4j?

CREATE MODEL

+

LOAD DATA QUERY DATA

Create your Graph ModelLoad your data Query your data

Page 55: RDBMS to Graph Webinar

How do you use Neo4j?

Querying can be done in the Neo4j Browser.

Page 56: RDBMS to Graph Webinar

Querying can be done in the Neo4j Browser.

Page 57: RDBMS to Graph Webinar

How do you use Neo4j?

Page 58: RDBMS to Graph Webinar

Language Drivers

javascript, java, ruby, .net, python, php

Page 59: RDBMS to Graph Webinar

Language Drivers

haskell, go

Page 60: RDBMS to Graph Webinar

Native Server-Side Extensions

Need to get every last ounce of performance?You can write server-side extensions in Java.

Page 61: RDBMS to Graph Webinar
Page 62: RDBMS to Graph Webinar

Architectural Options

DataStorageandBusinessRulesExecu5on

DataMiningandAggrega5on

Applica'on

GraphDatabaseCluster

Neo4j Neo4j Neo4j

AdHocAnalysis

BulkAnaly'cInfrastructureHadoop,EDW…

DataScien'st

EndUser

DatabasesRela5onalNoSQLHadoop

Page 63: RDBMS to Graph Webinar

RDBMS to Graph Options

MIGRATEALLDATA

MIGRATESUBSET

DUPLICATESUBSET

Non-GraphQueries GraphQueries

GraphQueriesNon-GraphQueries

AllQueries

Rela3onalDatabase

GraphDatabase

Application

Application

Application

NonGraphData

AllData

Page 64: RDBMS to Graph Webinar

FROM RDBMS TO GRAPHS

Page 65: RDBMS to Graph Webinar
Page 66: RDBMS to Graph Webinar
Page 67: RDBMS to Graph Webinar

Northwind

Page 68: RDBMS to Graph Webinar

Northwind - the canonical RDBMS Example

Page 69: RDBMS to Graph Webinar

( )-[:TO]->(Graph)

Page 70: RDBMS to Graph Webinar
Page 71: RDBMS to Graph Webinar

( )-[:IS_BETTER_AS]->(Graph)

Page 72: RDBMS to Graph Webinar

Starting with the ER Diagram

Page 73: RDBMS to Graph Webinar

Locate the Foreign Keys

Page 74: RDBMS to Graph Webinar

Drop the Foreign Keys

Page 75: RDBMS to Graph Webinar

Find the JOIN Tables

Page 76: RDBMS to Graph Webinar

(Simple) JOIN Tables Become Relationships

Page 77: RDBMS to Graph Webinar

Attributed JOIN Tables -> Relationships with Properties

Page 78: RDBMS to Graph Webinar

Querying a Subset Today

Page 79: RDBMS to Graph Webinar

As a Graph

Page 80: RDBMS to Graph Webinar

QUERYING THE GRAPH

Page 81: RDBMS to Graph Webinar

using openCypher

Declarative query languageEasy to learn for someone familiar with languages like SQLBut optimized for graphs, and quickly readable

Page 82: RDBMS to Graph Webinar

Property Graph Model

CREATE(:Employee{firstName:“Steven”})-[:REPORTS_TO]->(:Employee{firstName:“Andrew”})

REPORTS_TO Steven Andrew

LABEL PROPERTY

NODE NODE

LABEL PROPERTY

Page 83: RDBMS to Graph Webinar

Who do people report to?MATCH (e:Employee)<-[:REPORTS_TO]-(sub:Employee)RETURN *

Page 84: RDBMS to Graph Webinar

Who do people report to?

Results can be returned as nodes and relationships

Page 85: RDBMS to Graph Webinar

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;

or alternatively as a table.

Page 86: RDBMS to Graph Webinar

Who do people report to?

Page 87: RDBMS to Graph Webinar

Who does Robert report to?

MATCH p=(e:Employee)<-[:REPORTS_TO]-(sub:Employee)WHERE sub.firstName = ‘Robert’RETURN p

Page 88: RDBMS to Graph Webinar

Who does Robert report to?

Page 89: RDBMS to Graph Webinar

What is Robert’s reporting chain?

MATCH p=(e:Employee)<-[:REPORTS_TO*]-(sub:Employee)WHERE sub.firstName = ‘Robert’RETURN p

But the power of the graph is in the ability to query arbitrary length paths.See the asterisks.

Page 90: RDBMS to Graph Webinar

What is Robert’s reporting chain?

Page 91: RDBMS to Graph Webinar

Who’s the Big Boss?MATCH (e:Employee)WHERE NOT (e)-[:REPORTS_TO]->()RETURN e.firstName as bigBoss

Page 92: RDBMS to Graph Webinar

Who’s the Big Boss?

Page 93: RDBMS to Graph Webinar

Product Cross-SellingMATCH (choc:Product {productName: 'Chocolade'}) <-[:INCLUDES]-(:Order)<-[:SOLD]-(employee), (employee)-[:SOLD]->(o2)-[:INCLUDES]->(other:Product)RETURN employee.firstName, other.productName, COUNT(DISTINCT o2) as countORDER BY count DESCLIMIT 5;

Page 94: RDBMS to Graph Webinar

Product Cross-Selling

Page 95: RDBMS to Graph Webinar

(ASIDE ON GRAPH COMPUTE)

Optimized for OLTPBut can be used for Graph ComputeEither with built-in functionsOr server-side extensionsOr via exporting data to spark / graphx for analysis

Page 96: RDBMS to Graph Webinar

Shortest Path Between AirportsMATCH p = shortestPath( (a:Airport {code:”SFO”})-[*0..2]-> (b:Airport {code: “MSO”}))RETURN p

Example using built-in algorithms.Dijkstra also available for weighted paths

Page 97: RDBMS to Graph Webinar

(END ASIDE ON GRAPH COMPUTE)

Page 98: RDBMS to Graph Webinar

POWERING AN APP

Page 99: RDBMS to Graph Webinar

Simple App

Page 100: RDBMS to Graph Webinar

Simple App

Page 101: RDBMS to Graph Webinar

Simple Python Code

Page 102: RDBMS to Graph Webinar

Simple Python Code

Page 103: RDBMS to Graph Webinar

Simple Python Code

Page 104: RDBMS to Graph Webinar

Simple Python Code

Page 105: RDBMS to Graph Webinar

LOADING OUR DATA

Page 106: RDBMS to Graph Webinar

CSV

Page 107: RDBMS to Graph Webinar

CSV files for Northwind

Page 108: RDBMS to Graph Webinar

CSV files for Northwind

Page 109: RDBMS to Graph Webinar

3 Steps to Creating the Graph

IMPORT NODES CREATE INDEXES IMPORT RELATIONSHIPS

Page 110: RDBMS to Graph Webinar

Importing Nodes// Create customersUSING PERIODIC COMMITLOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-contrib/developer-resources/gh-pages/data/northwind/customers.csv" AS rowCREATE (:Customer {companyName: row.CompanyName, customerID: row.CustomerID, fax: row.Fax, phone: row.Phone});

// Create productsUSING PERIODIC COMMITLOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-contrib/developer-resources/gh-pages/data/northwind/products.csv" AS rowCREATE (:Product {productName: row.ProductName, productID: row.ProductID, unitPrice: toFloat(row.UnitPrice)});

Page 111: RDBMS to Graph Webinar

Importing Nodes// Create suppliersUSING PERIODIC COMMITLOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-contrib/developer-resources/gh-pages/data/northwind/suppliers.csv" AS rowCREATE (:Supplier {companyName: row.CompanyName, supplierID: row.SupplierID});

// Create employeesUSING PERIODIC COMMITLOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-contrib/developer-resources/gh-pages/data/northwind/employees.csv" AS rowCREATE (:Employee {employeeID:row.EmployeeID, firstName: row.FirstName, lastName: row.LastName, title: row.Title});

Page 112: RDBMS to Graph Webinar

Importing Nodes// Create categoriesUSING PERIODIC COMMITLOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-contrib/developer-resources/gh-pages/data/northwind/categories.csv" AS rowCREATE (:Category {categoryID: row.CategoryID, categoryName: row.CategoryName, description: row.Description});

// Create ordersUSING PERIODIC COMMITLOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-contrib/developer-resources/gh-pages/data/northwind/orders.csv" AS rowMERGE (order:Order {orderID: row.OrderID}) ON CREATE SET order.shipName = row.ShipName;

Page 113: RDBMS to Graph Webinar

Creating IndexesCREATE 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);

Page 114: RDBMS to Graph Webinar

Creating RelationshipsUSING PERIODIC COMMITLOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-contrib/developer-resources/gh-pages/data/northwind/orders.csv" AS rowMATCH (order:Order {orderID: row.OrderID})MATCH (customer:Customer {customerID: row.CustomerID})MERGE (customer)-[:PURCHASED]->(order);

USING PERIODIC COMMITLOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-contrib/developer-resources/gh-pages/data/northwind/products.csv" AS rowMATCH (product:Product {productID: row.ProductID})MATCH (supplier:Supplier {supplierID: row.SupplierID})MERGE (supplier)-[:SUPPLIES]->(product);

Page 115: RDBMS to Graph Webinar

Creating RelationshipsUSING PERIODIC COMMITLOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-contrib/developer-resources/gh-pages/data/northwind/orders.csv" AS rowMATCH (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 COMMITLOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-contrib/developer-resources/gh-pages/data/northwind/orders.csv" AS rowMATCH (order:Order {orderID: row.OrderID})MATCH (employee:Employee {employeeID: row.EmployeeID})MERGE (employee)-[:SOLD]->(order);

Page 116: RDBMS to Graph Webinar

Creating RelationshipsUSING PERIODIC COMMITLOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-contrib/developer-resources/gh-pages/data/northwind/products.csv" AS rowMATCH (product:Product {productID: row.ProductID})MATCH (category:Category {categoryID: row.CategoryID})MERGE (product)-[:PART_OF]->(category);

USING PERIODIC COMMITLOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/neo4j-contrib/developer-resources/gh-pages/data/northwind/employees.csv" AS rowMATCH (employee:Employee {employeeID: row.EmployeeID})MATCH (manager:Employee {employeeID: row.ReportsTo})MERGE (employee)-[:REPORTS_TO]->(manager);

Page 117: RDBMS to Graph Webinar

High Performance LOADingneo4j-import

4.58 million thingsand their relationships…

Loads in 100 seconds!

Page 118: RDBMS to Graph Webinar

WRAPPING UP

Page 119: RDBMS to Graph Webinar

“We found Neo4j to be literally thousands of times faster than our prior MySQL solution, with queries that require 10 to 100 times less code. Today, Neo4j provides eBay with functionality that was previously impossible.”

Volker PacherSenior Developer

Page 120: RDBMS to Graph Webinar

THANK YOU!

Ryan Boyd @ryguyrg [email protected]

Thank you for listening!