Introducción a las Bases de Datos Orientadas a Grafos

Date: 2017-Nov-14
Presentation by: Kinane Domloje
Meetup: Introducción a las Bases de Datos Orientadas a Grafos

We Are…

Abed Halawi

Kinane Domloje

Tech Lead – Vinelab

Data Developer – Vinelab

@mulkave

@kinaneD

Graph Databases Beirut ● Meetup

Vinelab  -[:LOVES]-> Neo4j

Community Contributions

PHP OGM for Neo4j

Overview

● What is a Graph Database?
● Why use a Graph Database?
● Cypher Query Language
● Neo4j UI Walkthrough
● Relational vs. Graph Databases
● My Personal Journey with Graph Databases
● Best Practices in Data Modeling

What is a Graph
Database?

A Node

:Person
{
id: 9928,
name: John Doe,
email: john@doe.me,
created_at: 03-06-1969
}

What is a Graph?

Why use a Graph
Database?

“All models are wrong but some are useful”
~ George Box

Flexibility

Schema-less Data Structures

Constraints

– Unique node properties
– Node property existence
– Relationship property existence
– Indexing

Performance

Creativity
Pleasant modelling and development
experience.

What can you
model with graph?
Anything, literally!

Cypher Query
Language

Querying the graph database using Cypher
“Cypher is an expressive (yet compact) graph database query language”

Cypher • MATCH-WHERE clause
The MATCH clause allows you to specify the patterns Neo4j will search for in the database.

Other Cypher Clauses
CREATE & MERGE
create graph elements
DELETE
delete graph elements
SET
update labels and properties on nodes and relationships
WITH
Chains subsequent query parts and forward results from one to the next. Similar to
piping commands in Unix.
Aggregation & Statistics
COUNT, AVG, MAX, MIN, DISTINCT, …

Neo4j UI Walkthrough

Break

Relational vs Graph
Databases

Tabular Data

Real world data

Conceptual Data Model

Logical Data Model: Relational

Physical Data Model: Relational

Physical Data Model: Graph

List the interests of “Alice”
SELECT title FROM Interests
LEFT JOIN User_Interests
ON Interests.Id = User_Interests.InterestId
LEFT JOIN Users
ON Users.Id = User_Interests.UserId
WHERE Users.name = “Alice”

SQL Statement

List the interests of “Alice”
MATCH (u:User)-[:INTERESTD_IN]->(i:Interest)
WHERE u.name = “Alice”
RETURN i.title

Cypher Statement

Where has John been lately?

Pattern-Matching

Big-O Operations

Numbers

Flexibility

My Journey With Graph

Physical Data Model: Relational

Physical Data Model: 1st Iteration

Physical Data Model: 2nd Iteration

Graph Physical Data Model

Best Practices in Data
Modeling

Node Labels

Node Labels

VS

Relations Name

Fact Nodes

Questions?

Reference

https://neo4j-users.slack.com

See you next time,
Cheers!

Author: Jeroen Derks

Jeroen is the founder of the Alicante Tech meetup group. His current day job is to mostly build all kinds of applications, ranging from IoT to educational to corporate.

Leave a Reply