Neo4j - Graph Database

11

Transcript of Neo4j - Graph Database

Page 1: Neo4j - Graph Database
Page 2: Neo4j - Graph Database

Neo4j - NoSQL Graph DatabaseMubashar Iqbal | SSE

Confiz Limited

Page 3: Neo4j - Graph Database

Session Agenda

● What is Graph Database ?● What is Neo4j ?● Cypher● Graph DB Model

Page 4: Neo4j - Graph Database

Graph Database

A graph database is not about charts, diagrams or vector artwork, it is related with storing data that is structured as a graph.

remember linked lists, trees?

Page 5: Neo4j - Graph Database

What is Graph Database?

● NoSQL Database● Collection of nodes, edges and properties to represent

and store data. ● Provides index-free adjacency● Properties expressed as key/value pairs● High Performance● Complex Relationships

Page 6: Neo4j - Graph Database

What is Neo4j?

● Open Source● NoSQL Graph Database● ACID transaction compliance● Runtime Failover● Cluster support● Compact storage● Memory caching for graph● Active Community

Page 7: Neo4j - Graph Database

Cypher - Query Language

● Cypher is Neo4j’s graph query language.● Match patterns of nodes and relationships in the graph

Example:MATCH (actor:Person)-[:ACTED_IN]->(movie:Movie)WHERE movie.title =~ "T.*"RETURN movie.title as title, collect(actor.name) as castORDER BY title ASC LIMIT 10;

Page 8: Neo4j - Graph Database

From SQL To Cypher

SQL Cypher

SELECT p.*

FROM products as p;

MATCH (p:Product)RETURN p;

SELECT p.ProductName, p.UnitPriceFROM products as pORDER BY p.UnitPrice DESCLIMIT 10;

MATCH (p:Product)RETURN p.productName, p.unitPriceORDER BY p.unitPrice DESCLIMIT 10;

SELECT p.ProductName, p.UnitPrice

FROM products as p

WHERE p.ProductName IN

('Chocolate',Coffee);

MATCH (p:Product)WHERE p.productName IN ['Chocolate',Coffee]RETURN p.productName, p.unitPrice;

Page 9: Neo4j - Graph Database

Graph DB Model● Nodes● Labels● Relationships

Page 10: Neo4j - Graph Database

Questions?

Page 11: Neo4j - Graph Database

Important LinksReferenceshttp://neo4j.com/developer/get-started/http://www.slideshare.net/neo4j/data-modeling-with-neo4j

Video Tutorialshttps://www.youtube.com/watch?v=7Fsfa5DP9sEhttps://www.youtube.com/watch?v=bqvDSioHYq8

Neo4j for phphttp://neo4j.com/developer/php/