Graph
Databases
for
SQL
Server
Professionals
Stphane
Frche9e
Thursday
September
18,
2014
Who
am
I?
My
name
is
Stphane
Frche2e
SQL
Server
MVP
|
Consultant
|
Speaker
|
Database
&
BI
Architect
|
NoSQL.
Drums,
good
food
and
ne
wine.
Founder
@ukubu,
@GaNneauOuverte,
@TEDxGaNneau
I
have
a
passion
for
architecNng,
designing
and
building
soluNons
that
ma2er.
Twi2er:
@sfreche2e
Blog:
stephanefreche2e.com
Email:
[email protected]
Session
Outline
What
is
a
Graph?
What
is
Neo4j?
Data
Modeling
The
Property
Graph
Cypher
Query
Language
ImporNng
Data
Use
Cases
Demos
Resources
What
is
a
Graph?
Are
these
Graphs?
This
is
a
Graph
Node
RelaLonship
A
Property
Graph
OrganizaLon
Project
Graph
Twi9er
Social
Graph
What
is
Neo4j?
An
open-source
graph
database
by
Neo
Technology.
Neo4j
stores
data
in
nodes
connected
by
directed,
typed
relaLonships
with
properLes
on
both,
also
know
as
a
Property
Graph
Fully
ACID
compliant
Massively
scalable,
up
to
several
billion
nodes/
relaNonships/properNes
Highly-available,
when
distributed
across
mulNple
machines
Accessible
by
a
convenient
REST
interface
or
an
object-oriented
Java
API
Data
Modeling
From
SQL
Server
to
Graph
Property
Graph
Example:
Meetup
Data
In
SQL
Server
Member
MeetupOrganizer
MeetupMember
Meetup
ID
Member
MemberID
MeetupID
MemberID
MeetupID
ID
Name
1
Daniel
2
1
3
1
1
O2awa
SQL
Server
User
Group
2
Stephane
1
2
3
2
2
O2awa
JavaScript
3
John
3
3
4
2
3
O2awa
Visio
User
Group
4
Randy
2
4
4
4
4
O2awa
Tableau
User
Group
3
5
1
5
5
Dirty
Dancing
O2awa
Example:
Meetup
Data
In
a
Graph
Member
Meetup
name:
O2awa
SQL
Server
User
Group
name:
Stephane
name:
O2awa
Visio
User
Group
name:
John
NIZER
IS_ORGA IS_MEM
BER
ER
GANIZ
IS_OR
IS_ORGANIZER
IS_ORGAN
IS_MEMBER
IZER
name:
Dirty
Dancing
O2awa
name:
Randy
IS_MEMBER
IS_MEMBER
IS_ORGANIZER
name:
O2awa
Tableau
User
Group
name:
O2awa
JavaScript
name:
Daniel
Cypher
Query
Language
Cypher
is
a
declaraNve
graph
query
language
that
allows
for
expressive
and
ecient
querying
and
updaNng
of
the
graph
store
Pa2ern-matching
DeclaraNve:
what
to
retrieve,
not
how
to
retrieve
it
Inspired
from
other
known
Language
(SQL,
SPARQL,
Haskell,
Python)
AggregaNon,
Ordering,
Limit
Update
the
Graph
Cypher
and
T-SQL
Cypher
also
has
a
number
of
keywords
that
have
a
direct
equivalence
with
SQL
which
makes
it
a
curiously
familiar
language
WHERE
ORDER
BY
LIMIT
SUM,
COUNT,
STDEVP,
MIN,
MAX
etc
LTRIM,
UPPER,
LOWER,
REPLACE,
LEFT,
RIGHT,
SUBSTRING
DISTINCT
CASE
(SQL
Server
Pros)
[:WILL_LOVE]
->
(Cypher)
Cypher
-
Meetup
Neo4j
Browser
Demo
(lets
query
some
data)
ImporLng
Data
ImporLng
Data
Some
important
consideraNons
Dierent
import
scenarios
Dataset
size:
1000s,
100000s,
10000000s
Dataset
format
(source):
Database,
File
(CSV,
Spreadsheet,
GraphML,
Geo),
Service,
Other
Import
type:
IniNal
Bulk
Load,
Incremental
Load,
IniNal
Bulk
Load
+
Incremental
Load
Dierent
import
tools
Spreadsheet
based
Neo4j-shell
based:
(Cypher,
neo4j-shell-tools,
Cypher
LOAD
CSV)
Command-line
based:
Batch
Importer
Neo4j
Brower
based
ETL
Tools:
(Talend,
Mulesou,
Pentaho
Ke2le)
Custom
souware:
(Java
API,
REST
API,
Spring
Data
Neo4j)
Many
dierent
mappings
Import
Scenarios
Import
Tools
Not
always
clear
what
you
should
be
using
Depends
on
your
skillsets,
dataset
size
(lots
of
other
stu)
Choose
wisely!
Demo
(walkthrough
on
imporLng
data)
The
Sample
Dataset
ImporLng
using
Spreadsheets
Very
small
size
datasets
<
1000,
easy
to
use
Generate
Cypher
Copy
and
Execute
Format
data
in
statements
with
Cypher
in
Neo4j
spreadsheet
formulas
browser
ImporLng
using
Spreadsheets
ImporLng
using
neo4j-shell-tools
Small
to
medium
size
datasets
h2ps://github.com/jexp/neo4j-shell-tools
Create
import-cypher
Format
data
in
CSV
Execute
commands
commands
for
les
from
neo4j-shell
neo4j-shell-tools
ImporLng
using
neo4j-shell-tools
ImporLng
using
LOAD
CSV
NaNve
Cypher
Execute
AddiNonal
Create
Format
data
in
command
from
cleanup
for
LOAD
CSV
CSV
les
commands
neo4j-shell
or
Labels
and
browser
RelTypes
ImporLng
using
LOAD
CSV
ImporLng
using
Batch
Importer
Non-transacNonal
import,
suited
for
very
very
large
datasets
Copy
store
les
Start
Neo4j
Server
Format
data
in
Execute
Batch
Import
command
to
Neo4j
Server
with
generated
TSV
les
directory
store
les
Use
Cases
Principal
uses
of
Graph
Database
include
Network
and
Data
Center
Management
(Queries:
Impact
Analysis,
Root
Cause
Analysis,
Quality-of-Service
Mapping,
Asset
Management)
AuthorizaNon
and
Access
(Queries
:
Access
Management,
Interconnected
Group
OrganizaNon,
Provenance)
Social
(Queries
:
Friend
RecommendaNons,
Sharing
&
CollaboraNon,
Inuencer
Analysis)
Geo
(Queries
:
RouNng,
LogisNcs,
Capacity
Planning)
RecommendaNons
(Queries
:
Product,
Social,
Service,
and
Professional
RecommendaNons)
Fraud
DetecNon
h2p://www.neotechnology.com/neo4j-use-cases/
Summary
(graphs)-[:ARE]->(everywhere)
Resources
Neo4j
GraphGist
h2p://gist.neo4j.org/
Neo
Technology
h2p://www.neotechnology.com/
GraphConnect
Conference
h2p://graphconnect.com/
Neoj.org
(Learn,
Develop,
Downloads,)
h2p://www.neo4j.org/
Titan
Distributed
Graph
Database
Neo4j
on
Vimeo
h2p://vimeo.com/neo4j
h2ps://thinkaurelius.github.io/Ntan/
Neo4j
on
SlideShare
h2p://www.slideshare.net/neo4j
InniteGraph
h2p://www.innitegraph.com/
Neo4j
on
Github
h2ps://github.com/neo4j
OrientDB
h2p://www.orientechnologies.com/
Neo4j
Cypher
Cheat
Sheet
h2p://docs.neo4j.org/refcard/2.1/
Cayley
by
Google
h2ps://github.com/google/cayley
Neo4j
Graph
Database
as
a
Service
h2p://www.graphenedb.com/
Linkurious
The
easiest
way
to
explore
graph
databases
h2p://linkurio.us/
KeyLines-
Visualize
dynamic
networks
h2p://keylines.com/
Experiments
with
NEO4J:
Using
a
graph
database
as
a
SQL
Server
metadata
hub
h2p://bit.ly/V2PrxN
Kenny
Bastani
h2p://www.kennybastani.com/
Rik
Van
Bruggen
h2p://blog.bruggen.com/
Max
de
Marzi
h2p://maxdemarzi.com/
Be2er
Souware
Development
h2p://jexp.de/blog/
Graph
Databases
(Free
Book)
h2p://graphdatabases.com/
What
QuesLons
Do
You
Have?
Thank
You
For
a9ending
this
session