0% found this document useful (0 votes)
90 views

Learning Guide 2: Nosql and Newsql: Cloud Computing Databases

The document discusses graph databases and newSQL cloud databases. It provides information on Neo4j, a popular graph database, describing its data model using nodes, relationships, and properties. It also explains newSQL databases which seek to provide scalable performance like NoSQL while maintaining ACID guarantees like traditional databases. Examples of creating nodes, relationships, and properties in Neo4j using Cypher queries are also included.

Uploaded by

Dr Patrick Cerna
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

Learning Guide 2: Nosql and Newsql: Cloud Computing Databases

The document discusses graph databases and newSQL cloud databases. It provides information on Neo4j, a popular graph database, describing its data model using nodes, relationships, and properties. It also explains newSQL databases which seek to provide scalable performance like NoSQL while maintaining ACID guarantees like traditional databases. Examples of creating nodes, relationships, and properties in Neo4j using Cypher queries are also included.

Uploaded by

Dr Patrick Cerna
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Federal TVET Institute

Master of Science in Information Communication Technology


Addis Ababa, Ethiopia

Learning Guide 2: noSQL and


newSQL: Cloud Computing
Databases
Information Sheet 2.2 Graph Databases and newSQL Cloud Databases

Dr. Patrick D. Cerna (Associate Professor)

ICT647 – Advance Topics in Information


Technology
Semester I, AY 2017-2018
Learning Objectives
At the end of the chapter the students will be able
to:

• Understand the need of cloud databases with


graph database (noSQL) and newSQL
• Know further graph databases by creating nodes
and relationship using Neo4J
• Explore newSQL Noudb cloud database.

What is a Graph Database?
• A graph is a pictorial representation of a set of
objects where some pairs of objects are
connected by links. It is composed of two
elements - nodes (vertices) and
relationships (edges).
• Graph databases store relationships and
connections as first-class entities.
RDBMS Vs Graph Database
Sr.No RDBMS Graph Database

1 Tables Graphs
2 Rows Nodes
3 Columns and Data Properties and its
values
4 Constraints Relationships

5 Joins Traversal
Features of Neo4j

• Neo4j is a popular Graph Database. Other Graph


Databases are Oracle NoSQL Database,
OrientDB, HypherGraphDB, GraphBase,
InfiniteGraph, and AllegroGraph.
Features of Neo4J
• Data model (flexible schema) − Neo4j follows a data model
named native property graph model. Here, the graph contains nodes
(entities) and these nodes are connected with each other (depicted
by relationships). Nodes and relationships store data in key-value
pairs known as properties.
• In Neo4j, there is no need to follow a fixed schema. You can add or
remove properties as per requirement. It also provides schema
constraints.
• ACID properties − Neo4j supports full ACID (Atomicity,
Consistency, Isolation, and Durability) rules.
• Scalability and reliability − You can scale the database by
increasing the number of reads/writes, and the volume without
effecting the query processing speed and data integrity. Neo4j also
provides support for replication for data safety and reliability.
Features of Neo4J
• Cypher Query Language − Neo4j provides a powerful declarative
query language known as Cypher. It uses ASCII-art for depicting
graphs. Cypher is easy to learn and can be used to create and
retrieve relations between data without using the complex queries
like Joins.
• Built-in web application − Neo4j provides a built-in Neo4j
Browser web application. Using this, you can create and query
your graph data.
• Drivers − Neo4j can work with −
• REST API to work with programming languages such as Java,
Spring, Scala etc.
• Java Script to work with UI MVC frameworks such as Node JS.
• It supports two kinds of Java API: Cypher API and Native Java API
to develop Java applications. In addition to these, you can also work
with other databases such as MongoDB, Cassandra, etc.
• Indexing − Neo4j supports Indexes by using Apache Lucence.
Neo4j Property Graph Data Model

• The model represents data in Nodes,


Relationships and Properties
• Properties are key-value pairs
• Nodes are represented using circle and
Relationships are represented using arrow keys
• Relationships have directions: Unidirectional and
Bidirectional
• Each Relationship contains "Start Node" or
"From Node" and "To Node" or "End Node"
• Both Nodes and Relationships contain properties
• Relationships connects nodes
The main building blocks of Graph DB Data Model are
Nodes, Relationships and Properties
• Neo4j Graph Database has the following
building blocks: Nodes, Properties,
Relationships, Labels, Data and Browser
Node
• Node is a fundamental unit of a Graph. It
contains properties with key-value pairs as
shown in the following image.
• Here, Node Name = "Employee" and it contains
a set of properties as key-value pairs.
Properties

• Property is a key-value pair to describe Graph


Nodes and Relationships.
• Key = Value
• Where Key is a String and Value may be
represented using any Neo4j Data types
Relationships

• Relationships are another major building block


of a Graph Database. It connects two nodes as
depicted in the following figure.

Here, Emp and Dept are two different nodes. "WORKS_FOR" is a relationship
between Emp and Dept nodes.
As it denotes, the arrow mark from Emp to Dept, this relationship
describes −
Emp WORKS_FOR Dept
Here, "WORKS_FOR" relationship has
one property as key-value pair.
Id = 123
Creating a Node with a Label in Neo4J

Syntax - Following is the syntax for creating a


node with a label using Cypher Query Language.

CREATE (node:label)

Example

CREATE (Dhawan:player)
Creating Relationships

Syntax - Following is the syntax to create a


relationship using the CREATE clause.

CREATE (node1)-[:RelationshipType]-
>(node2)

Example

CREATE (Dhawan:player{name: "Shikar


Dhawan", YOB: 1985, POB: "Delhi"})
CREATE (Ind:Country {name: "India"})
Creating Relationships

Now, create a relationship


named BATSMAN_OF between these two nodes
as −

CREATE (Dhawan)-[r:BATSMAN_OF]->(Ind)

Finally, return both the nodes to see the created


relationship.

RETURN Dhawan, Ind


Creating a Relationship Between the
Existing Nodes
Syntax Following is the syntax to create a
relationship using the MATCH clause.

MATCH (a:LabeofNode1), (b:LabeofNode2)


WHERE a.name = "nameofnode1" AND
b.name = " nameofnode2" CREATE (a)-[:
Relation]->(b) RETURN a,b
Creating a Relationship Between the
Existing Nodes
Following is a sample Cypher Query which creates
a relationship using the match clause.

MATCH (a:player), (b:Country) WHERE


a.name = "Shikar Dhawan" AND b.name
= "India" CREATE (a)-[r: BATSMAN_OF]-
>(b) RETURN a,b
What is newSQL

• newSQL is a class of
modern relational database management
systems that seek to provide the same scalable
performance of NoSQL systems for online
transaction processing (OLTP) read-write
workloads while still maintaining
the ACID guarantees of a traditional database
system.

• The term was first used by 451 Group analyst
Matthew Aslett in a 2011 research paper
discussing the rise of new database systems as
challengers to established vendors.
• Many enterprise systems that handle high-
profile data (e.g., financial and order processing
systems) also need to be able to scale but are
unable to use NoSQL solutions because they
cannot give up strong transactional and
consistency requirements.
The applications typically targeted by these
NewSQL systems are characterized by being
OLTP, that is, having a large number of
transactions that
(1) are short-lived (i.e., no user stalls),
(2) touch a small subset of data using index
lookups (i.e., no full table scans or large
distributed joins), and
(3) are repetitive (i.e. executing the same queries
with different inputs).
References:

• Hawramani, Ikram (2016). Cloud Computing


for Complete Beginners: Building and
Scaling High-Performance Web Servers on the
Amazon Cloud. Kindle Edition
• https://www.w3resource.com/mongodb/nosql.
php

You might also like