8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 1/33
GRAPH DATABASES
CHAPTER 10: INTRODUCTION
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 2/33
Use Case: Route Finding
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-2
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 3/33
Use Case: Logistics
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-3
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 4/33
Use Case: Social Network
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-4
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 5/33
Use Case: Recommendations
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-5
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 6/33
Use Case: Access Control
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-6
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 7/33
Graph Database: Example
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-7
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 8/33
Graph Database: Definitions
• “A graph database is a database whose data model conforms to some
form of graph (...) structure. The graph data model usually consists ofnodes (...) and (...) edges (...), where the nodes represent concepts
(...) and the edges represent relationships (…) between these
concepts (…). …” Encyclopedia of Database Systems (Springer)
• “A graph database management system (henceforth, a graph
database) is an online database management system with Create,
Read, Update, and delete (CRUD) methods that expose a graph data
model …” Robinson/Webber/Eifrem
• “A graph database is any storage system that provides index-free
adjacency.“ Rodriquez
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15 10-8
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 9/33
Relational vs. Graph (Cont.)
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-9
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 10/33
Relational vs. Graph (Cont.)
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-10
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 11/33
Relational vs. Graph (Cont.)
Example: Social Network “path exists” Performance
• a sample social graph with ~1,000 persons
• average 50 friends per person
• pathExists(a,b) limited to depth 4
• caches warmed up to eliminate disk I/O
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
# persons query time
Relational DBMS 1,000 2,000 ms
Neo4j 1,000 2 ms
Neo4j 1.000,000 2ms
Source: Neo Technology, Inc.
10-11
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 12/33
Graph Databases …
Are good for …
• Highly connected data (social networks)
• Recommendations (e-commerce)
• Path Finding (how do I know you?)
• A* (Least Cost path)
• …
If you’ve ever …
• Joined more than 7 tables together
• Modeled a graph in a table
• Tried to write some crazy stored procedure with multiple recursive
self and inner joins
… you should use a graph database
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15 10-12
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 13/33
Graph Databases – Topics of Interest
• Graph Data Models
• Graph Query Languages
• Graph Indexing
• Graph Storage
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15 10-13
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 14/33
Literature
• Edlich, S., Friedland, A., Hampe, J., Brauer, B., Brückner, M.
NoSQL Einstieg in die Welt nichtrelationaler Web 2.0 Datenbanken,Carl Hanser Verlag, 2011 (2nd ed.)
• Robinson, I., Webber, J., Eifrem, E. Graph Databases, O’Reilly, 2013
free e-Book on http://graphdatabases.com/
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15 10-14
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 15/33
Graph Databases
Introduction
• Graph Data Models
• Graph Query Languages
• Graph Indexing
• Graph Storage
• Graph Database Management Systems
• Conclusion & Outlook
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15 10-15
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 16/33
Graph Data Models
Orthogonal graph characteristics
• Directed vs. undirected
• Simple vs. multi
• Weighted vs. unweighted
• Unlabeled vs. edge-labeled vs. vertex-labeled
• …
Property Graph Model
• Most popular graph data model in graph databases today (Tinkerpop,
InfiniteGraph, InfoGrid, Neo4j etc.)• Directed labeled multigraph
• Edge properties: key/value pairs
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15 10-16
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 17/33
Property Graph Data Model
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-17
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 18/33
Property Graph Data Model
• Nodes
– Entities
• Relationships
– Connect entities and structure domain
• Properties
– Attributes and metadata
• (Labels)
– Group nodes by role
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15 10-18
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 19/33
Property Graph Data Model: Nodes
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-19
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 20/33
Property Graph Data Model: Relationships
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-20
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 21/33
Property Graph Data Model: Relationships
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-21
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 22/33
Property Graph Data Model: Labels
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-22
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 23/33
Property Graph Data Model
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-23
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 24/33
Graph Data Modeling
• Easy to design and model direct representation of the model –
“Whiteboard Friendlyness”
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-24
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 25/33
Graph Data Modeling (Cont.)
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-25
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 26/33
Graph Data Modeling (Cont.)
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Neo Technology, Inc.
10-26
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 27/33
Graph Data Modeling: Best Practice
• Nodes for Things
• Relationships for Structure• Represent Complex value types as nodes
• Iterative and incremental development
• Test-driven data model development
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15 10-27
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 28/33
Graph Data Modelling: Cross-Domain Models
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Robinson/Webber/Eifrem: 2013
10-28
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 29/33
Graph Data Modelling: Cross-Domain Models
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Robinson/Webber/Eifrem: 2013
10-29
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 30/33
Graph Data Modelling: Cross-Domain Models
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
Source: Robinson/Webber/Eifrem: 2013
literary domain
theatrical domain
geospatial domain
10-30
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 31/33
Graph Databases and Schema
• Most graph databases are schema-less
• However, first graph databases started to introduce schemaconstructs …
• Example: Neo4j 2.0
– Necessary requirement: Labels
– Unique Constraints:
• Unique constraints do not mean that all nodes have to have a unique
value for the properties — nodes without the property are not
subject to this rule.
• CREATE CONSTRAINT / DROP CONSTRAINT
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15
CREATE CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE
10-31
h d l
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 32/33
Graph Data Models
• Further graph data model approaches
–
Hypergraphs with hyperedges (e.g. HyperGraphDB, sonesGraphDB) – …
• Related approaches
– RDF
•Triples (subject, predicate, object)
• Standardized (W3C)
• Optimized for reasoning
• However, e.g. AllegroGraph: RDF store and graph database
– …
• Further reading for graph data models:
– Edlich, S., Friedland, A., Hampe, J., Brauer, B., Brückner, M.NoSQL Einstieg in die Welt nichtrelationaler Web 2.0 Datenbanken,Carl Hanser Verlag, 2011 (2nd ed.)
h_da Prof. Dr. Uta Störl Graph Databases - WS 2014/15 10-32
h b
8/19/2019 GraphDB 10 Introduction
http://slidepdf.com/reader/full/graphdb-10-introduction 33/33
Graph Databases
Introduction
Graph Data Models
• Graph Query Languages
• Graph Indexing
• Graph Storage
• Graph Database Management Systems
• Conclusion & Outlook
h d P f D Ut Stö l G h D t b WS 2014/15 10 33