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

CST8276 Lab 9 Raman

This document outlines the steps for completing Lab 9 of the CST8276 course, which focuses on installing and using the Neo4j graph database. It includes detailed instructions for setting up the software, importing data, and querying the database to explore relationships between data entities. The lab emphasizes the importance of data relationships in graph databases compared to traditional relational databases.

Uploaded by

ramanisgartan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

CST8276 Lab 9 Raman

This document outlines the steps for completing Lab 9 of the CST8276 course, which focuses on installing and using the Neo4j graph database. It includes detailed instructions for setting up the software, importing data, and querying the database to explore relationships between data entities. The lab emphasizes the importance of data relationships in graph databases compared to traditional relational databases.

Uploaded by

ramanisgartan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

CST8276 Lab 9: Graph Databases – Neo4j

Name: Raghav Dhir


Student Number: 041104707

Purpose: This lab is the second of two that address the larger theme of NoSQL
databases. It focuses on installing and becoming somewhat familiar with the
Neo4j graph database.

Graph databases are very appropriate for use in situations where the data
relationships are more important than the individual attributes. For data that
would otherwise be stored in a relational database, it is as if the constraints from
foreign-keys are what is being captured. It is more than just the fact that the data
is related, it is that the relationships are of interest, and will be queried. The
visualization of the data in terms of directed graphs is usually of interest, and the
Neo4j browser that we will use in this lab has a built-in visualization engine.

Deliverable: To earn 2 marks towards your lab score, submit the requirements
listed below in a single document and demonstrate the results to your lab
professor on-time.

Requirements:

1. First Thing: If you are running Windows 10 Home Edition, you will need
to do this step first: (Otherwise: you would have an error after selecting the
install location during the Neo4j installation.)
a. You can check your Operating System Version by typing “About your
PC” into the Windows Search bar.
b. If it is Windows 10 Home or Windows 11 Home; do the following:
i. Add the following items to the Windows Path Environment
Variable (System Properties > Advanced > Environment
Variables > Path).
1. %SYSTEMROOT%\System32\WindowsPowerShell\v1.0
2. %SYSTEMROOT%\System32\wbem
ii. Move the two new components of the path to the top in the path
window so that they take precedence in the Path.

Page 1 of 11
CST8276 Lab 9: Graph Databases – Neo4j
2. There is a very nice white paper available online that outlines “The Top 5
Use Cases of Graph Databases”. Here is the link:
https://go.neo4j.com/rs/710-RRC-335/images/Neo4j_Top5_UseCases_Graph
%20Databases.pdf

Look at Use Case #3: Master Data Management


What are the main challenges to MDM that a graph database approach can help
with?
Complex and hierarchical datasets: Managing the topdown hierarchies of master
data with a relational database result in complex and unwieldy code that is slow to
run, expensive to build and time-consuming to maintain.
Real-time storage and query performance: The master data store must integrate
with and provide data to a host of applications within the enterprise. Providing
real-time information on complex and highly interconnected dataset is a significant
challenge.
Dynamic structure: Master data is dynamic in nature, making it harder for
developers to design systems that accommodate its evolution.
3. Navigate to the following site:
Neo4j Desktop Download | Free Graph Database Download
And download the current version of Neo4j Desktop. (v 4.4.8 or later)

The relationship between Neo4j Desktop and the other


tools is described at
Neo4j Graph Platform - Developer Guides
and
Getting Started Guide - Getting Started (neo4j.com)

4. On the download page, click on the download button to initiate the


download which includes Neo4j for Developers (the latest default build).
a. On the next page, fill out the form with your particular information,
read the license agreement, and click on “Download Desktop”. The
Neo4j installer (approx. 575MB) will download to your laptop.
i. When the activation key window pops-up, DO NOT CLOSE IT
RIGHT AWAY. You will need to copy the key (long string of
text) to activate the installation once the download is complete.
Take a screenshot of the key pop-up and paste it below. Also,
copy the text to a textfile (in Notepad) and save it for later.
You can keep this pop-up open until after you have completed
the download and installation.

Page 2 of 11
CST8276 Lab 9: Graph Databases – Neo4j
ii. You will be following the instructions as given in the follow-on
page “Installation and Launch Guide”. (There is also a link to a
video to follow, if you prefer.) The first step is to double-click
the Desktop icon for the installer to begin the install. You
should get a pop-up similar to the following:

iii. Make sure you select “Anyone who uses this computer (all
users). Then click Next.
iv. On the next screen, verify the default install location and click
Install.

v. On the “Completing Neo4j Desktop Setup” pop-up make sure


“Run Neo4j Desktop” is selected, and click “Finish”.
vi. If you get a pop-up from your Firewall, click on “Allow access”
vii. In the (other) pop-up window, Read the License Agreement and
click on “I Agree”
viii. If this is your first install:
1. You may get a pop-up asking for the path where you want to
store application data. Make a screen shot that will
document your choice & paste below.

Page 3 of 11
CST8276 Lab 9: Graph Databases – Neo4j

`
2. Then, click “Confirm”
3. On the “Software Registration” pop-up, click on “No
thanks! Maybe later. :)” You will be asked again later.
4. On the “Anonymous Reporting” pop-up, select OK.
5. You are now able to create and start a database!.
a. In the Neo4j Desktop application, click on the “+New” button to
create a new project.
i. Find the new project in the navigation list on the Left Side of
the window. Select the project (if not already selected). Inside
the new project, Click “+Add” which will turn give options.
Click the one labelled “Local DBMS”.

Page 4 of 11
CST8276 Lab 9: Graph Databases – Neo4j

ii. Change the suggested Graph Name to:


“yourfirstnameGraphFirstExample”, give a password
“myfirstexample” and then click Create.

iii. Select the newly created Graph DBMS and then click on the
Start Button. Once the database (graph) is started, click on the
“Open” button and to open it with the Neo4j Browser option.

b. The Neo4j Browser will open in a new window, with a command-line


near the top (“$” is prompt) and a set of default frames below,
showing the output for some commands (e.g., “:play start” and
“:server status”

Page 5 of 11
CST8276 Lab 9: Graph Databases – Neo4j

c. Click on the “Get Started” button in the :play start output frame.
i. Read through the Graph Fundamentals material (by clicking
“>”)
ii. When you get to “Next steps, read through the Intro and Cypher
materials in the Keep Getting started area.

Page 6 of 11
CST8276 Lab 9: Graph Databases – Neo4j
6. We will now import some data: Make sure you do all steps on each of the
screens (you will likely have to scroll down to see some of the commands)
a. In the Neo4j Browser, run the command “:play northwind-
graph” (Type in the command and click the run button)

b. Then CAREFULLY FOLLOW THE INSTRUCTIONS to load a


series of “.CSV” files into the current graph. You need to copy the
individual commands into the command window (where you did
the :play northwind-graph) and then run them. If you highlight one of
the commands – it will get copied into the command window. There
should be 7 pages. Run each of the commands in order top-to-bottom
in each page before moving to the next page.
i. Load each of the records from the online CSV files on the first
page. Note that the URLs could have been local files. If you
receive an error message during the download, you may need to
change the http:// portion of the URL to be https:// (This bug
was recently introduced in Aug. 2022).
ii. There are some commands for creating the three indexes too.
Run them.
iii. Then click the “>” button to navigate to the next screen.
iv. Continue running commands on the following screens until you
finish screen 3

Page 7 of 11
CST8276 Lab 9: Graph Databases – Neo4j
7. Now comes the magic! You should be on the “Query using patterns” page
(screen 4).
a.Run the first query:
MATCH (s:Supplier)(:Product)(c:Category)
RETURN s.companyName as Company,
collect(distinct c.categoryName) as Categories

8. Continue with the Northwind Graph example until you are finished all of
importation steps on page 6 and are on page 7 of 7 of the instructions.
We will now do some discovery using the Neo4j Browser interface.

9. Click on the Database Icon near the top left hand side of the main window.

Which after you click will have the browser open with a list of node label
types: Customer, Category, Product, Order, Supplier.

Page 8 of 11
CST8276 Lab 9: Graph Databases – Neo4j

a. Click on the “Customer” node label type, and then the “Purchased”
relationship type. If you do not see the graph of the database, click on
the “Graph” icon in the left hand top area of the result panel. You
should see something like this:

Page 9 of 11
CST8276 Lab 9: Graph Databases – Neo4j
b. You will likely need to adjust the display of the node labels by
picking which attribute (label, …) to display in the diagram.
c. Right click on one of the customer nodes. A pop-up ring will appear
around the node.

d. Now select the graph icon in the bottom part of the pop-up ring; it will
load all the relationships for that customer node. For this database, it
will show the orders made by that customer. Repeat the process for
one of the orders, to find which products were in that order. Then
again on one of the products in that order to find a list of other orders
containing that product, and continue again on one of the other orders
to find other customers who have ordered that same product.
Below is an example showing two potential friends –Paula Wilson
and Pascale Cartrain that ordered the same item (Gnocchi di nonna
Alice) If they lived in the same city, it would be interesting.

Page 10 of 11
CST8276 Lab 9: Graph Databases – Neo4j
e. Experiment with the navigation until you can build a screen dump
of your relationship map for two other individuals who happened to
buy the same product. (It DOES NOT have to be the Gnocchi…)

That’s it! You're done!

Page 11 of 11

You might also like