PR 6 No SQL
PR 6 No SQL
Practical No: 6
Aim: Introduction to Neo4j Graph Databases
Objective
To introduce students to Neo4j Graph Databases by covering the basics, emphasizing the
property graph model and graph theory fundamentals. It explores use cases in areas like social
networks and fraud detection while guiding students through the installation process of Neo4j
for hands-on experience.
Prerequisite Theory
Graph databases are a type of NoSQL database that uses graph structures with nodes, edges,
and properties to represent and store data. They are particularly well-suited for scenarios where
relationships between entities are important and need to be efficiently queried.
- Property: Key-value pairs associated with nodes and edges, providing additional
information.
- Graph databases often use the Cypher query language for data manipulation and retrieval.
Cypher is designed to be expressive and intuitive for querying graph data.
- Graph databases excel at traversing relationships between nodes. You can easily follow
edges to navigate through the graph and discover connections between nodes.
- Graph databases are designed to efficiently handle queries involving relationships, making
them well-suited for applications that involve complex and interconnected data.
- Microsoft Azure Cosmos DB: Supports graph data models along with other NoSQL
models.
Use Cases:
- Graph databases are suitable for scenarios where relationships are as important as the data
itself, such as social networks, fraud detection, recommendation engines, network analysis, and
knowledge graphs.
1. Social Networks:
- Modeling users as nodes and relationships (friendship, following) as edges allows for
efficient representation and traversal of social networks, enabling features like friend
recommendations.
2. Recommendation Engines:
- Nodes representing users and items (products, content) with edges capturing
interactionshelp build personalized recommendation systems by analyzing the graph structure.
3. Fraud Detection:
4. Knowledge Graphs:
- Graph databases are employed to represent and analyze relationships between biological
entities (genes, proteins) in genomics research, drug discovery, and systems biology.
- Representing IT components and their dependencies as nodes and edges helps visualizeand
manage complex IT infrastructures, optimizing operations and troubleshooting.
1. Install Java:
- If OpenJDK 11 or Oracle Java 11 is not already installed, obtain and install it on your
system.
- Set the `JAVA_HOME` environment variable to the installation path of your JDK.
2. Download Neo4j:
- Visit the Neo4j Download Center and download the latest release.
- https://neo4j.com/deployment-center/
- Verify the integrity by checking the SHA hash. Click on SHA-256 below your downloaded
file on the Download Center and compare it with the calculated SHA-256 hash using platform-
specific commands.
- Choose a permanent location for the extracted files, for example, D:\neo4j\ (referred to as
NEO4J_HOME).
3. Run Neo4j:
- Connect using the username 'neo4j' with the default password 'neo4j'.
Answer:
2. Which query language is commonly used for data manipulation and retrieval in graph databases?
a) A document c) A table
b) An entity in the graph d) A row
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
a) N4J_HOME c) JAVA_HOME
b) NEO4J_DIR d) NEO4J_HOME
Answer:
a) http://localhost:8080 c) http://127.0.0.1:8000
b) http://localhost:7474 d) http://neo4j-browser.com
Answer:
Answer:
True/False:
1. Graph databases are particularly well-suited for scenarios where relationships between
entities are notimportant.
2. The Cypher query language is specifically designed for querying relational databases.
Assessment Rubrics
Needs
Criteria Excellent (10) Good (7) Satisfactory
Improvement Marks
(5)
(3)
Has a
Understandingof Demonstrates a Shows a strong satisfactory Struggles with
profound understanding of
Basics of Graph understanding basic conceptsof
understanding of the basics of
Databases of the basics of graph databases
the basics of graph databases
graph databases
graph databases
Demonstrates a Lacks
Comprehensionof Exhibits a deep Shows a basic
good understanding
Graph Theory comprehension comprehension
comprehensionof of graph theory
Fundamentals of graph theory of graph theory
graph theory fundamentals
fundamentals fundamentals
fundamentals
Effectively Attempts to
Application of Adequately Struggles to
applies graph apply graph
Graph Databases applies graph apply graph
databases in databases but
in Use Cases databases in some databases in
various use with
use cases use cases
cases significant
issues
Unable to install
Successful Installs Neo4j Installs Neo4j Installs Neo4j Neo4j or
Installation of successfully with with minor with major encounters
Neo4j no issues issues issues critical
installation
issues
Average Marks