Lab
1
1. Download and install Neo4j Desktop
Go to https://neo4j.com/download-center/#desktop and download the appropriate Neo4j Desktop
installation files depending on your operating system.
Enter the required information and then click on download.
2
Click on “Copy to clipboard” to copy the activation key. You will need it later to activate Neo4j.
Launch Neo4j Desktop Setup.exe if you are using Windows and click on “Next”.
3
Change the path if needed, click on install and wait for the installation to complete.
Click on “finish” and launch Neo4j.
4
2. Launch Neo4j, create the database and import the data.
Click on Software Keys.
Click on “Add Software Key” and paste the key that you copied to the clipboard earlier (or copy it again)
and click on “Add”.
5
Click on “+New Project”.
Click on “Add” and then “Local DBMS”.
6
Change the name if needed and provide an 8-character password and then click on “Create”.
Click on “Start” and wait for the DBMS to start.
7
Once the DBMS has started click on “Create database”, provide a name for the database and click on
“Create”.
Click on “Open” and then on “Neo4j Browser”
8
Open the provided file “Ch14_FCC.txt”, select everything and copy.
Go back to Neo4j browser, paste and then press on run (play button).
You should get a message similar to “Added 196 labels, created 153 nodes, set 2090 properties, created
385 relationships, completed after 1589 ms.”.
9
Questions:
1.1 What are some of the business problems that this database can help solve?
1.2 Explain why, in this case, this type of database is more appropriate than a relational database.
Queries:
2.1 Use the query: ”MATCH (n:Restaurant) RETURN n “ to retrieve all the restaurants. Provide a
screenshot of the result.
2.2 Provide a query that will return all owners. Provide a screenshot of the result.
2.3 Use the query: “MATCH p=(Owner)-[r:OWNS]->(Restaurant) RETURN p” which will show owners
and their restaurants. Provide a screenshot of the result.
2.4 Provide a query that will return members and the restaurants that they reviewed. Provide a
screenshot of the result.
2.5 Use one of the following queries to retrieve the restaurant “La Grande” and provide a
screenshot of the result:
MATCH (r:Restaurant)
WHERE r.name = "La Grande"
RETURN r
Or
MATCH (r:Restaurant {name: "La Grande"})
RETURN r
2.6 Provide a query that will only return the restaurant “Burritoboro”. Provide a screenshot of the
result.
2.7 Use the following query to return all owners from Florida and provide a screenshot of the result:
MATCH (o:Owner)
WHERE o.state ="FL"
RETURN o
10
Use the following query to return all owners from Florida and provide a screenshot of the result:
MATCH (o:Owner)
WHERE o.state ="FL"
RETURN o.birth
What is the difference between this query and the previous one?
2.8 Write a query that will return the zip codes of all restaurants located in Tennessee. Provide a
screenshot of the result.
2.9 Use the following query to return all seafood restaurants and provide a screenshot of the
result.
MATCH (Rsf:Restaurant)-[:TYPE_OF]->(sf:Cuisine {name: "Seafood"})
RETURN sf,Rsf
2.10 Write a query that will return all reviews of the restaurant “Captain Seafood”. Provide a
screenshot of the result.
11
Rubric
Section Deliverable Grade
1.1 At least two problems are clearly identified, and clear and sufficient arguments are provided.
5
1.2 At least two advantages are clearly identified, and clear and sufficient arguments are provided.
5
2.1 Results are correct and show all restaurants. Screenshot showing the query and the result is provided.
4
2.2 Results are correct and show all restaurant owners. Screenshot showing the query and the result is provided.
10
2.3 Results are correct and show all owners and their restaurants. Screenshot showing the query and the result is provided.
4
2.4 Results are correct and show all members and the restaurants that they reviewed. Screenshot showing the query and the result is provided.
10
2.5 Results are correct and show only the restaurant "La Grande". Screenshot showing the query and the result is provided.
4
2.6 Results are correct and show only the restaurant "Burritoboro". Screenshot showing the query and the result is provided.
10
2.7 The difference between the two queries is clearly identified. Screenshots are used to show the difference.
4
2.8 Results are correct and show only documents associated with books checked out in March 2017. Screenshot showing the query and the result is provided
10
2.9 Results are correct and show only seafood restaurants. Screenshot showing the query and the result is provided. 4
2.1 Results are correct and show all reviews of the restaurant “Captain Seafood”. Screenshot showing the query and the result is provided. 10