Loading presentation...

Present Remotely

Send the link below via email or IM


Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.


Seminar Report on Graph Databases

No description

nisarg modi

on 14 August 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Seminar Report on Graph Databases

What is in a Graph DB?
A Graph contains Nodes and Relationships

“A Graph –records data in–> Nodes –which have–> Properties.”

The simplest possible graph is a single Node, a record that has named values referred to as Properties. A Node could start with a single Property and grow to a few million, though that can get a little awkward. At some point it makes sense to distribute the data into multiple nodes, organized with explicit Relationships.

“Nodes –are organized by–> Relationships — which also have–> Properties.”

Relationships organize Nodes into arbitrary structures, allowing a Graph to resemble a List, a Tree, a Map, or a compound Entity – any of which can be combined into yet more complex, richly inter-connected structures.
An intuitive graph-oriented model for data representation
A disk-based, native storage manager completely optimized for storing graph structures for maximum performance and scalability
Massive scalability. Neo4j can handle graphs of several billion nodes/relationships/properties on a single machine and can be sharded to scale out across multiple machines
A powerful traversal framework for high-speed traversals in the node space
with fully ACID transactions
Can be deployed as a full server or a very slim database with a small footprint (~750k jar)
A simple and convenient object-oriented API
Provides commercial support
Spring Data Neo4j enables POJO based development. It extends annotated entity classes with transparent mapping functionality. Spring Data Neo4j is part of the bigger Spring Data project which aims to provide convenient support for NOSQL databases.
Neo4j provides 3 ways to query the graph
First one, the Cypher Language

START user=node({0})
MATCH user-[:friends]-friend-[:activities]->stream
RETURN stream
START user=node({0})
MATCH user-[:friends]->follower
WHERE follower.name =~ /S.*/
RETURN user, follower.name
4. what is graph
Cypher Query Language
Real World Implementations
1. Facebook's Graph Search
Different softwares using Graph Databases
2. Google Knowledge Graph

•HyperGraphDB: It is a general purpose, open-source data storage mechanism based on a powerful knowledge management formalism known as directed hypergraphs.

•InfoGrid: It is a Web Graph Database with many additional software components that make the development of web applications on a graph foundation easy. InfoGrid is open source, and is being developed in Java as a set of projects.

•DEX: It is a high-performance and scalable graph database management system written in C++.

•Neo4j: Out of all the graph databases currently available, Neo4j is the most widely used. Let's go through the details of Neo4j to understand graph databases better.
3. Other Implementations
How Graph Search Works
•Open Source
-Community development
•Implemented in java
-JVM, platform independent
•Fully transactional Java persistence engine
-Persistence framework
•Stores data structured in graphs rather than in tables
-Need flexible db for messy, intertwined data
Syntax Meaning
CREATE (n {name :"Name" }) Creates the node with the given properties.

START n=node(...)
MATCH n-[r]-m
RETURN type(r), count(*) Returns a count of each of the relationship-types.

SET n.prop = value Updates or creates the property prop with the given value

DELETE n, DELETE rel Deletes the node, relationship
What is Graph Search
Facebook Graph Search is a semantic search engine that was introduced by Facebook in March 2013.
The Graph Search feature combines the big data acquired from its over one billion users and external data into a search engine providing user-specific search results.
It is designed to give answers to user natural language queries rather than a list of links.
Sample Query:
To find all
Italian restaurants
that my

START me=node:person(name = ‘Sujen’),
MATCH (me)-[:IS_FRIEND_OF]->(friend)-[:LIKES]->(restaurant)
RETURN restaurant
The execution of the query happens in the following manner:
Creating a node and relation:
Our example graph consists of movies with an id, year and title and actors with a name. Actors have an :ACTS_IN relationship to movies, which represents the role they played, the role relationship has also a role attribute.
Google's Knowledge Graph
The Knowledge Graph is a knowledge base used by Google to enhance its search engine's search results with semantic-search information gathered from a wide variety of sources.
CREATE movie={id:"1",title:"K3G",year:"2000"};

CREATE name={id:"1",name:"Kajol};

START actor=node:node_auto_index(name="Kajol"), movie=node:node_auto_index(title="K3G") CREATE UNIQUE actor-[r:Acts_in]->movie ;
Updating a graph :
START actor=node:node_auto_index(name="Kajol"), movie=node:node_auto_index(title="K3G") MATCH actor-[r:Acts_in]->movie SET r.role="lead actress" ;
START actor=node:node_auto_index(name="Kajol)
SET actor.name="Kajol Devgan";
Traversing the graph:
START m=node:node_auto_index(title="K3G")
MATCH m<-[:ACTS_IN]-actor-[:ACTS_IN]->movie
RETURN movie.title, collect(actor.name), count(*) as count ORDER BY count desc;
movie.title collect(actor.name) count
Devdas Sharukh 1
Find the movies in which the actors of K3G have acted in:-
Relational model has been dominating the computer industry since the 1980s mainly for storing and retrieving data.
But it is losing its importance due to its dependence on a rigid schema which makes it difficult to add new relationships.
It is becoming difficult to work with relational model as with increase in amount of data, number of tables increase which reduces efficiency.
Hence graph databases are considered to be one of the proposed solutions to this problem.
graph database
uses graph structures with nodes, edges, and properties to represent and store data, the most generic of data structures, capable of elegantly representing any kind of data in a highly accessible way.
The Knowledge Graph is also paving the way to new approaches toward SEO. Semantic search isn't just about the web. It's about all information, data, and applications.
Content expressed as microdata on the web page gets correlated easily to the data vocabulary it is giving information about, making it easy for the search engine find relevance and connectivity.
Supported microdata types are:
•Business and organizations
Implementation on Neo4j
Example of a Data graph
Look at the following statements describing the relationship between a dog and a cat: Bengie is a dog. Bonnie is a cat. Bengie and Bonnie are friends.
<div itemscope itemtype="http://data-vocabulary.org/Organization">
<span itemprop="name">L’Amourita Pizza</span>
Located at
<span itemprop="address" itemscope
<span itemprop="street-address">123 Main St</span>,
<span itemprop="locality">Albuquerque</span>,
<span itemprop="region">NM</span>.
Phone: <span itemprop="tel">206-555-1234</span>.
<a href="http://www.example.com" itemprop="url">http://pizza.example.com</a>.
A Neo4j graph
Representation of data inside a relational database, like Oracle's or MySQL’s is based on two concepts :
1) the structure of the data is determined ahead of time
2) data structures are tabular.
which is not the case in graph databases.
Relational databases are great if you’re storing tabular data.Things can start getting really complex if you try to turn, for example, a social network into a set of tables.
Declarative language.
Cypher is designed to be a humane query language, suitable for both developers and operations professionals who want to make ad-hoc queries on the database.
Cypher is inspired by a number of different approaches and builds upon established practices for expressive querying.
Most of the keywords like WHERE and ORDER BY are inspired by SQL.
Pattern matching borrows expression approaches from SPARQL.
Regular expression matching is implemented using the Scala programming language.
A Neo4j graph consists of :
Nodes that are connected by
Relationships, with
Properties on both nodes and relationships.

The fundamental units that form a graph are nodes and relationships. In Neo4j, both nodes and relationships can contain properties. Properties are key-value pairs where the key is a string. Property values can be either a primitive or an array of one primitive type.
The database is queried with Cypher Query Language.
S0: Find all friends of Esha.S1: Find the favorite movies of Esha’s friends.S2: Find the lead actors of favorite movies of Esha’s friends.
Comparison of graph database and relational database
Companies already using Neo4j...
There are many other companies who have implemented Neo4j technology, from big ones like Adobe (runs creative cloud on Neo4j), Cisco (Org-Management, MDM), social networks like Viadeo and many Job search companies (GlassDoor, and others) to startups like fiftythree who published the popular "Paper" app on iOS.
Level of Support/Maturity
start n=node(192) match n-[:friends]->y return y.name
start n=node(192) match n-[:friends]->y-[:fav_mov]->z return z.namestart n=node(192) match n-[:friends]->x-[:fav_mov]->y-[:acted_by]->z return z.name
Implementation on SQL
To implement relational databases, MySQL version 5.1.41 was used.
The database was queried using PHP scripting language.
S0: Find all friends of Esha.
S1: Find the favorite movies of Esha’s friends.
S2: Find the lead actors of favorite movies Esha’s friends.

Create a database.
Create tables within the database.
1) User: user_id, user_name
2) Friends: user_id, friend_id
3) Fav_movies: user_id , movie_name
4) Actors: movie_name, actor_name
Big Data is the term which is basically data in huge volumes which are of different data types and are dense.
NoSQL is the solution for working with Big Data.
The larger the data set, the longer it takes to find matches, so when number of users increase from one hundred to five hundred, the retrieval time gets increased manifold.
On the other hand graph database looks only at records that are directly connected to other records; it does not scan the entire graph to find the nodes that meet the search criteria.
Graph searches any element in log(n) time while relational database searches the same result in n2 , n3 depending upon the number of tables joined.
Advantages of graph databases
The graph model works best even when there are millions of relationships between objects.
It can easily accommodate the schema changes.
Graph Databases are suitable for semantic search.
“Minutes to milliseconds” performance.
Extreme business responsiveness.
Enterprise ready.
Create , Update , Traverse through Graph
Kajol Devgan
Other Applications
Network and Cloud Management:
A number of telephone companies are using graph databases to model their networks, in support of network optimization activities and to conduct “what if” failure analysis.
Content Management and Security and Access Control:
Adobe’s Creative Cloud uses a graph database to manage access to content and the relationships between users, groups, assets and collections. Telenor, one of the world’s largest telcos, brought its login time down from minutes to milliseconds by moving the part of its relational system that handled access control over to a graph database.
Era7 Bioinformatics uses graph databases to relate a complex web of information that includes genes, proteins and enzymes.
The “original” graph use case pioneered by Euler remains alive today. Mobile cell analysis, shortest-path analysis and logistics are three such use cases (among many) where graph databases are currently in use.


Nisarg Modi 60004100039

Presented by
Guided by
Graphs is the best way to store connected data.
Thank you.
With the recent developments in this field, we believe that Graphs could change the way we perceive information.
It will make for a better content delivery system and make search results more relevant (semantic-web).
[1] Chad Vicknair, Michael Macias, Zhendong Zhao, Xiaofei Nan, Yixin Chen, Dawn Wilkins “A Comparison of a Graph Database and a Relational Database”, ACM Southeast Regional

[2] Database Trends And Applications. Available http://www.dbta.com/Articles/Columns/Notes-on-NoSQL/Graph-Databases-and-the-Value-They-Provide-74544.aspx , 2012

[3] M. Kleppmann. Should you go beyond relational databases? Available:http://carsonified.com/blog/dev/should-you-go-beyond-relational-database

[4] Neo4j Blog, Available http://blog.neo4j.org/2009/04/current-database-debate-and-graph.html
Full transcript