Top Banner
Neo4j Tabriz Software Open Talks #opentalks @silverman2OOO9 2015-10-29 / 1394-08-07 Farzin Bagheri
42

introduction to Neo4j (Tabriz Software Open Talks)

Feb 10, 2017

Download

Data & Analytics

Farzin Bagheri
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: introduction to Neo4j (Tabriz Software Open Talks)

Neo4j

Tabriz Software Open Talks

#opentalks

@silverman2OOO9

2015-10-29 / 1394-08-07

Farzin Bagheri

Page 2: introduction to Neo4j (Tabriz Software Open Talks)

Table of Contents

Database

Relational Databases

NOSQL

● NOSQL Categories

Neo4j● Cypher● Example● Usage

Page 3: introduction to Neo4j (Tabriz Software Open Talks)

Database

Page 4: introduction to Neo4j (Tabriz Software Open Talks)

Relational Database

● Relational Database : SQL Server , MySQL , Oracle,...● Concepts : Table , Row, Column,…

But,is it enough?

Page 5: introduction to Neo4j (Tabriz Software Open Talks)

No !

Page 6: introduction to Neo4j (Tabriz Software Open Talks)

Why?

● Cost● Need Powerful hardware● Need Expert● Sometimes we need only some feature

Page 7: introduction to Neo4j (Tabriz Software Open Talks)

NoSQL Databases

Page 8: introduction to Neo4j (Tabriz Software Open Talks)

What is NoSQL ?

Page 9: introduction to Neo4j (Tabriz Software Open Talks)

NoSQL

Not Only SQL

Page 10: introduction to Neo4j (Tabriz Software Open Talks)

4 Type of NoSQL Databases :

● Key-Value : ○ Data mode : Key and value! for example : Set A 20○ Example : Redis , Riak , Dynamodb (Amazon) ,...○ Use Case : Task Queue (Celery) , Cashing ,...

● Document : ○ Data model : collection of Key - value : { FName : “Farzin” , LName : ”Bagheri” , City : “Khoy” }

○ Example : MongoDB , couchDB○ Use Case : Inserting a Log Record (Nginx or Apache)

● Column Family or BigTable : ○ Data model : big table! each rows has their own Schema.○ Example : Hbase , Cassandra○ Use Case : like Relational Databases but more flexible

● Graph Databases ○ Data mode : Node (Vertices) , Relationship (Edge) and Properties○ Example : Neo4j , OrientDB , ArangoDB ,... ○ Use Case : Social network , Recommendation , Graph-Based Search,...

Page 11: introduction to Neo4j (Tabriz Software Open Talks)

4 Type of NoSQL Databases :

● Key-Value : ○ Data mode : Key and value! for example : Set A 20○ Example : Redis , Riak , Dynamodb (Amazon) ,...○ Use Case : Task Queue (Celery) , Cashing ,...

● Document : ○ Data model : collection of Key - value : { FName : “Farzin” , LName : ”Bagheri” , City : “Khoy” }

○ Example : MongoDB , couchDB○ Use Case : Inserting a Log Record (Nginx or Apache)

● Column Family or BigTable : ○ Data model : big table! each rows has their own Schema.○ Example : Hbase , Cassandra○ Use Case : like Relational Databases but more flexible

● Graph Databases ○ Data mode : Node (Vertices) , Relationship (Edge) and Properties○ Example : Neo4j , OrientDB , ArangoDB ,... ○ Use Case : Social network , Recommendation , Graph-Based Search,...

Page 12: introduction to Neo4j (Tabriz Software Open Talks)

4 Type of NoSQL Databases :

● Key-Value : ○ Data mode : Key and value! for example : Set A 20○ Example : Redis , Riak , Dynamodb (Amazon) ,...○ Use Case : Task Queue (Celery) , Cashing ,...

● Document : ○ Data model : collection of Key - value : { FName : “Farzin” , LName : ”Bagheri” , City : “Khoy” }

○ Example : MongoDB , couchDB○ Use Case : Inserting a Log Record (Nginx or Apache)

● Column Family or BigTable : ○ Data model : big table! each rows has their own Schema.○ Example : Hbase , Cassandra○ Use Case : like Relational Databases but more flexible

● Graph Databases○ Data mode : Node (Vertices) , Relationship (Edge) and Properties○ Example : Neo4j , OrientDB , ArangoDB ,... ○ Use Case : Social network , Recommendation , Graph-Based Search,...

Page 13: introduction to Neo4j (Tabriz Software Open Talks)

4 Type of NoSQL Databases :

● Key-Value : ○ Data mode : Key and value! for example : Set A 20○ Example : Redis , Riak , Dynamodb (Amazon) ,...○ Use Case : Task Queue (Celery) , Cashing ,...

● Document : ○ Data model : collection of Key - value : { FName : “Farzin” , LName : ”Bagheri” , City : “Khoy” }

○ Example : MongoDB , couchDB○ Use Case : Inserting a Log Record (Nginx or Apache)

● Column Family or BigTable : ○ Data model : big table! each rows has their own Schema.○ Example : Hbase , Cassandra○ Use Case : like Relational Databases but more flexible

● Graph Databases○ Data mode : Node (Vertices) , Relationship (Edge) and Properties○ Example : Neo4j , OrientDB , ArangoDB ,... ○ Use Case : Social network , Recommendation , Graph-Based Search,...

Page 14: introduction to Neo4j (Tabriz Software Open Talks)
Page 15: introduction to Neo4j (Tabriz Software Open Talks)

Graph are everywhere

Page 16: introduction to Neo4j (Tabriz Software Open Talks)

Graph

● Nodes● Relationships● Properties

http://neo4j.com/developer/graph-database/

Page 17: introduction to Neo4j (Tabriz Software Open Talks)

How to talk to Neo4j?

Page 18: introduction to Neo4j (Tabriz Software Open Talks)

Cypher

Page 19: introduction to Neo4j (Tabriz Software Open Talks)

Cypher

Page 20: introduction to Neo4j (Tabriz Software Open Talks)

Creating Node

Getting

CREATE ( : Person { Fname : "Farzin" , Lname : "Bagheri" } )

Page 21: introduction to Neo4j (Tabriz Software Open Talks)

Creating other Nodes

CREATE ( :Person { Fname : "Arash" , Lname : "Milani" } ) ,

( :Person { Fname : "Masoud" , Lname : "Sadri" } )

Getting All

Page 22: introduction to Neo4j (Tabriz Software Open Talks)

Going to be Social ! :)

Page 23: introduction to Neo4j (Tabriz Software Open Talks)

Creating Relationship :

Page 24: introduction to Neo4j (Tabriz Software Open Talks)

Small Social Network :

Page 25: introduction to Neo4j (Tabriz Software Open Talks)

Finding Friend and Friend of Friend :

● Friend of Someone :

Page 26: introduction to Neo4j (Tabriz Software Open Talks)

Finding Friend and Friend of Friend :

● Friend of Friend of Someone :

● Other way :

Page 27: introduction to Neo4j (Tabriz Software Open Talks)

Finding All :

Page 28: introduction to Neo4j (Tabriz Software Open Talks)

Cloud

Page 29: introduction to Neo4j (Tabriz Software Open Talks)
Page 30: introduction to Neo4j (Tabriz Software Open Talks)

(app) -[:depend_on]-> (os) - [:depend_on] -> (VM) -[:depend_on] >(Server)-[::depend_on] -> (Power)

Page 31: introduction to Neo4j (Tabriz Software Open Talks)

Dependency Chain :

Page 32: introduction to Neo4j (Tabriz Software Open Talks)

Which Server Host App1?

Page 33: introduction to Neo4j (Tabriz Software Open Talks)

App1 Dependency :

Page 34: introduction to Neo4j (Tabriz Software Open Talks)

Most Dependent :

Page 35: introduction to Neo4j (Tabriz Software Open Talks)

Recommendation

Page 36: introduction to Neo4j (Tabriz Software Open Talks)

MATCH ( p:person { name:"B" } ) -[ :Has ]-> ( o1:Order )-[ :include ]->( b:Book )

<-[ :include ] - ( o2:Order )

-[:include]-> ( otherBook )

where not o1-[:include]->(otherBook)

return distinct ( otherBook.name)

Page 37: introduction to Neo4j (Tabriz Software Open Talks)

Performance

Page 38: introduction to Neo4j (Tabriz Software Open Talks)

Usage

● Social network● Network Analysis● Recommendation systems● Fraud Detection

● Path Finding (Shortest path , simple path ,...)● Digital Marketing

Page 39: introduction to Neo4j (Tabriz Software Open Talks)

Database Popularity Change

Page 40: introduction to Neo4j (Tabriz Software Open Talks)

Neo4j in Iran & World

Page 41: introduction to Neo4j (Tabriz Software Open Talks)

Thank you

Page 42: introduction to Neo4j (Tabriz Software Open Talks)

References

● www.db-engines.com● www.neo4j.com● www.linkedin.com● Graph Database , Ian Robinson , Jim Webber & Emil Eifrem