CST8276 Lab 9 Raman
CST8276 Lab 9 Raman
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
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.
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
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.
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)
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…)
Page 11 of 11