•
•
•
•
Images from http://www.slideshare.net/debanjanmahata/an-introduction-to-nosql-graph-databases-and-neo4j
•
•
Relational Database Graph Database
Entity Row Node (Vertex)
Relationship Row Relationship (Edge)
•
•
•
•
•
–
•
•
•
–
Make two nodes
CREATE (:person {id: 1, name: “Kisung Kim”, birthday: 1980-01-05});
CREATE (:company {id: 1, name: “Bitnine Global”});
Make a relationship between the two nodes
MATCH (p:person {id: 1}), (c:company {id:1})
CREATE (p)-[:workFor {title: “CTO”, since: 2014}]->(c);
Kisung Kim Bitnine Global
workFor
Querying
MATCH (p:person {name: “Kisung Kim”})-[:workFor]->(c:company)
RETURN (p), (c)
No Table Definitions and No Joins
Query with variable length relationships
MATCH (p:person {name: “Kisung Kim”})-[:knows*..3]->(f:person)
RETURN (f)
Kisung Kim ?
workFor
Kisung Kim ?
knows
?
knows
?
knows
•
Magic Quadrant for Operational Database Management Systems, Gartner, 2016
•
•
•
•
( ) -[:processes]->(Cypher)
•
•
–
–
•
–
•
•
–
–
•
–
–
–
•
•
–
–
v1
Solution Company Latest Version Features
Neo Technology 3.1
Most famous graph database, Cypher
O(1) access using fixed-size array
Datastax -
Distributed graph system based on
Cassandra
Titan
•
•
•
•
From Graph Databases 2nd ed. O’Reilly, 2015
•
•
•
From http://s3.thinkaurelius.com/docs/titan/1.0.0/data-model.html
•
–
•
•
Graph
Vertex Edge
Vertex ID Properties Edge ID PropertiesStart Vertex ID End Vertex ID
B-tree
Vertex ID
B-tree
(Start, End)
B-tree
(End, Start)
•
–
–
–
•
•
Edge
Edge ID PropertiesStart Vertex ID End Vertex ID
B-tree
(Start, End)
B-tree
(End, Start)
Edge ID Properties
B-tree or
Hash index
(Vertex ID)
(Adjacent Vertex ID, Edge ID)
B-tree (Edge ID)
•
•
•
Vertex ID Properties
ag_vertex
Vertex ID Properties
Person
Vertex ID Properties
Message
Vertex ID Properties
Comment
Vertex ID Properties
Post
• AgensGraph v0.9
(https://github.com/bitnine-oss/agens-graph or http://bitnine.net/downloads/)
– Graph data model and DDL on PostgreSQL 9.6
– Cypher query processing (70% of OpenCypher spec.)
– Integrated query processing (Cypher + SQL)
– Client library (JDBC, ODBC, Python)
– Monitoring and development using Tadpole DB-hub
•
•
•
–
–
•
–
•
•
•
•
–
–
•
•
•
–
:likes
•
–
–
–
•
Person
Country:X
Person
:knows*1..2
Message
Given a start Person, find Persons that are their friends and friends of friends that have made
Messages in both of the given Countries, X and Y, within a given period. Only Persons that are
foreign to Countries X and Y are considered, that is Persons whose Location is not Country X or
Country Y.
•






•
–
–
•
•
•
• 
• 
• 
•
•
•
•

Pg Conf - Implementing Graph Database based-on PostgreSQL