!everything

about

Graph Databases

To SQL or NOSQL

is that the question ?

Ye olde RDBMS's

etc etc

Key-value db's

{key, value}

(although, more complex data structures are often built on top of this...)

 

Comes in many flavors:

kv Cache

kv Store

kv Store (Eventually Consistent)

kv Store (Ordered)

...

Column family db's

Uses 'tuples' to store data, almost always distributed

Document-oriented db's

 <Article>
   <Author>
       <FirstName>Bob</FirstName>
       <Surname>Smith</Surname>
   </Author>
   <Abstract>This paper concerns....</Abstract>
   <Section n="1"><Title>Introduction</Title>
       <Para>...
   </Section>
 </Article>
{
"_id" : 1,
"name" : { "first" : "John", "last" : "Backus" },
"contribs" : [ "Fortran", "ALGOL", "Backus-Naur Form", "FP" ],
"awards" : [
           {
             "award" : "W.W. McDowell Award",
             "year" : 1967,
             "by" : "IEEE Computer Society"
           },
           { "award" : "Draper Prize",
             "year" : 1993,
             "by" : "National Academy of Engineering"
           }
]
}

To be Schemaful or Schemaless...

Graph db's

Comparing the apples and PINEAPPLES...

Data Model Performance Scalability Flexibility Complexity Functionality
Key–Value Store high high high none variable (none)
Column-Oriented Store high high moderate low minimal
Document-Oriented Store high variable (high) high low variable (low)
Graph Database variable variable high high graph theory
Relational Database variable variable low moderate relational algebra

So, graphs you say...

Thanks, Leonhard !

Leonhard Euler, 1707-1783

Seven bridges of königsberg

#1: make a model (graph)

#2: count the nodes and relations as you 'walk the graph'

So what's a graph then ?

Formally, a graph is just a collection of vertices and edges

or

a set of nodes and the relationships that connect them.

Why Neo4J ?

Neo4j is a highly scalable, robust (fully ACID) native graph database. Neo4j is used in mission-critical apps by thousands of leading startups, enterprises, and governments around the world.

(labeled) Property Graph

nodes and relationships,

+ properties. (and labels)

Cypher

MATCH (m:Movie)<-[:ACTS_IN]-(actor)-[:ACTS_IN]->(movie)
RETURN movie.title, collect(actor.name), count(*) AS count
ORDER BY count DESC ;
MATCH (node) -[:RELATIONSHIP]- (node)
MATCH (you:Person { name:"Your Name" }), (kevin:Person { name:"Kevin Bacon" }),
  path = shortestPath((you)-[*..6]-(kevin))
RETURN path
() -[]- ()

Don't take my word for it,

try it yourself, it's easy !

Stand Back!

i'm switching to DEMO mode..

Graph Databases

By maderskog

Graph Databases

  • 357