NoSQL - PRACTICAL 7
NoSQL - PRACTICAL 7
PRACTICAL -7
AIM: WORKING WITH Neo4j DATABASE.
WHAT IS Neo4j?
Neo4j is a NoSQL database. It is highly scalable and schema-free. It is the most
popular graphical database management system in the world. Neo4j is
developed by Neo Technology and is known as an ACID-compliant
transactional database with native graph processing and storage capabilities.
Neo4j is implemented in the Java language and is accessible in other languages
using the Cypher Query Language (CQL). Neo4j is much faster than traditional
databases.
WORKING OF Neo4j.
Neo4j stores and display in the form of graph. In Neo4j data is represented by
nodes and relationships between those nodes.
Neo4j database are a lot different to relationship databases such as a MS access,
SQL server, MYSQL etc. Relational databases use tables, rows, and columns to
store data. They also present data in a tabular fashion.
Neo4j doesn’t use tables, rows, or columns to store or present data.
Neo4j is best for storing data that has many interconnecting relationships. That’s
why graph databases like Neo4j have an advantage and much better at dealing
with relational data than relational databases are.
The graph model doesn't usually require a predefined schema. so, there is no
need to create the database structure before you load the data. In Neo4j, the data
is the structure. Neo4j is a "schema-optional" DBMS.
In Neo4j, there is no need to set up primary key/foreign key constraints to
predetermine which fields can have a relationship, and to which data. You just
have to define the relationships between the nodes you need.
FEATURES OF Neo4j
It supports UNIQUE constraints.
It uses native graphics storage with native GPE (Graph Processing Engine).
1
NoSQL DATABASE SYSTEM
22012021006_AKASH 4-CEIT(B1)
USAGE OF Neo4j
Use Neo4j If your database management system has too many connection
relationships then using Neo4j will be the best choice.
Neo4j is highly preferred for storing data containing many connections between
nodes.
• Social networks such as Facebook, Twitter, Instagram
• Network diagram
• Fraud detection
• Graph-based digital asset search
• Data management
• Timely product recommendation real time
ADVANTAGES OF Neo4j
• The representation of connected data is very simple.
• Retrieve, browse or browse connected data very quickly.
• It uses a simple and powerful data model.
• Easily represent semi-structured data.
• Neo4j is fast because more data is connected so it is easy to retrieve and
browse.
CASE STUDY:
Neo4j Empowers Real-Time Fraud Detection for Financial Services.
CHALLENGE:
SOLUTION:
The firm turned to Neo4j to upgrade its extortion location capabilities with real-
time chart investigation. By modelling exchanges, clients, accounts, and their
3
NoSQL DATABASE SYSTEM
22012021006_AKASH 4-CEIT(B1)
Utilizing Neo4j's chart calculations and inquiry capabilities, the firm executed a
advanced extortion discovery framework that might distinguish suspicious
exercises in real-time. By analysing the value-based information and the
organize of connections between substances, Neo4j given significant bits of
knowledge that enabled extortion investigators to require quick and focused on
activities to moderate dangers.
RESULT:
Increased Accuracy:
Neo4j's graph-based approach altogether made strides the precision of extortion
location by recognizing unpretentious designs and peculiarities that
conventional frameworks frequently missed.
Real-Time Discovery:
With Neo4j's real-time capabilities, the firm may identify and react to false
exercises as they happened, minimizing money related misfortunes and
reputational harm.
Versatile Framework:
Neo4j's adaptable information demonstrate permitted the firm to adjust rapidly
to unused extortion plans and strategies, guaranteeing proceeded adequacy in
combating extortion.
CONCLUSION:
By leveraging Neo4j's chart database innovation, the money related
administrations firm changed its extortion location capabilities, accomplishing
more noteworthy exactness, speed, and flexibility in combating budgetary
wrongdoing. The organization with Neo4j not as it were defended the firm's
resources but moreover reinforced client believes and certainty in its
administrations.
4
NoSQL DATABASE SYSTEM
22012021006_AKASH 4-CEIT(B1)
EXERCISE
Exercise-1 (IPL DATASET)
OUTPUT:
OUTPUT:
OUTPUT:
OUTPUT:
5
NoSQL DATABASE SYSTEM
22012021006_AKASH 4-CEIT(B1)
OUTPUT:
OUTPUT:
7) Nodes with a weight larger than 70 and a height smaller than 120
QUERY: MATCH (p:PLAYER) WHERE p.weight > 70 AND p.height < 120 RETURN p;
OUTPUT:
8) Nodes with height greater than 2.1 or weight greater than 120
QUERY: MATCH (p:PLAYER) WHERE p.height > 2.1 OR p.weight > 120 RETURN p;
OUTPUT:
OUTPUT:
6
NoSQL DATABASE SYSTEM
22012021006_AKASH 4-CEIT(B1)
OUTPUT:
OUTPUT:
OUTPUT:
13) GET ALL OF Virat’s TEAMMATES THAT MAKE MORE THAN 30M
7
NoSQL DATABASE SYSTEM
22012021006_AKASH 4-CEIT(B1)
OUTPUT:
OUTPUT:
OUTPUT:
OUTPUT:
Neo4j Exercise -2
Create 7 nodes in people label having properties name, department, address, age. Create 7 nodes in
film label having properties title, released year, director name. Create relationships called friend,
brother, and favourite nodes.
8
NoSQL DATABASE SYSTEM
22012021006_AKASH 4-CEIT(B1)
CREATE (:People {name: 'Kushal', department: 'IT', address: 'Surat', age: 30}),
(:Film {title: "The Shawshank Redemption", released_year: 1994, director_name: "Frank Darabont"})
(:Film {title: "The Godfather", released_year: 1972, director_name: "Francis Ford Coppola"})
(:Film {title: "The Dark Knight", released_year: 2008, director_name: "Christopher Nolan"})
CREATE (divy)-[:FRIEND]->(dhruvin)
CREATE (dhruvin)-[:FRIEND]->(divy)
CREATE (jay)-[:FAVOURITE]->(the_godfather)
CREATE (the_godfather)-[:FAVOURITE_OF]->(jay)
9
NoSQL DATABASE SYSTEM
22012021006_AKASH 4-CEIT(B1)
CREATE (raman)-[:BROTHER]->(aman)
CREATE (aman)-[:BROTHER]->(raman)
CREATE (aman)-[:FAVOURITE]->(inception)
CREATE (inception)-[:FAVOURITE_OF]->(aman)
OUTPUT:
OUTPUT:
10
NoSQL DATABASE SYSTEM
22012021006_AKASH 4-CEIT(B1)
OUTPUT:
OUTPUT
OUTPUT:
OUTPUT:
11
NoSQL DATABASE SYSTEM
22012021006_AKASH 4-CEIT(B1)
OUTPUT:
OUTPUT:
12
NoSQL DATABASE SYSTEM