Implementing Graph Data Models in Neo4j

Course: Implementing Graph Data Models in Neo4j — Exercises neo4j icon


Welcome to Browser Guides! This is the interface for performing exercises to this Neo4j course. They are presented in the form of self-paced exercises. Navigate through the exercises by pressing the forward button at the right of the window.

We start by walking you through some preparations and instructions. If you have used Neo4j Browser Guides before, you can skip to the last page.

Before you start


Ensure the database is started

If you are using Neo4j Desktop, ensure that the project you have selected for use with Neo4j Browser is connected to a database that is started.

If you are using a Neo4j Sandbox or Neo4j Aura, the Neo4j Browser is already connected to a started database.

Ensure the APOC library is accessible (Neo4j Desktop only)

  1. In the project view, click the Manage area for the database that you are using. (3 dots to the right of the database name)

  2. Select the Plugins tab.

  3. Install APOC if it is not already installed. Click Install and Restart.

Ensure files for loading are accessible (Neo4j Desktop only)

If you are using Neo4j Desktop, you can load data either from a URL or from a local file.

Here is a ZIP file containing the course data files if you want to access them locally: neo4j-implementing-modeling.zip

Assuming you have uncompressed the ZIP file for this course, copy the neo4j-implementing-modeling\*.csv files to the import folder for your database as follows:

  1. Click the Manage area for the database that you are using.

  2. Click the Open Folder button. This opens a file browser for the database.

  3. Copy the neo4j-implementing-modeling*.csv files to the *import* folder.

The import folder will appear as follows:

ImportFolder

Note: If you are using a Neo4j Sandbox or Neo4j Aura, then you cannot place any files locally for loading.

Enable multi-statement query editor

  1. Click the Browser Settings button in the lower left side of Neo4j Browser browser settings button.

  2. Make sure that the Enable multi statement query editor checkbox is selected: enable multi statement query editor

Pin a window

It is useful to pin the Browser Guide to the top, so that it doesn’t scroll down when you execute statements. You do this by pressing the pin button in the upper right corner of the page: pin button Pressing it once more will unpin the window again: unpin button.

About the exercises


Preparations before each exercise

Each exercise starts with a Preparations page. It shows you how to reset the database and make sure that it will produce the expected results. This is useful, for example, if you have made a mistake in one of the previous exercises, or if you have done some testing on your own.

Writing and executing queries

  1. Write the query in the query pane at the top of Neo4j Browser.

  2. Click the Run button run button in order to execute the code.

Using code blocks

Many of the exercises contain code blocks with runnable code. Follow these steps in order to run the code in your database:

  1. Click inside of the code block. You will notice that the code is copied into the code pane at the top of Neo4j Browser.

  2. Click the Run button run button in order to execute the code.

"Taking it further"

Some exercises include optional sections called Taking it further. These are extra exercises that you can complete if you have more time, in order to gain more experience with implementing graph data models.

Exercises:


Exercise 1 — Getting started with the airport graph data model

Exercise 2 — Loading airport data

Exercise 3 — Profiling queries

Exercise 4 — Creating the Flight node from the CONNECTED_TO relationship

Exercise 5 — Creating the AirportDay node from the Airport and Flight nodes

Exercise 6 — Creating specific relationships

Exercise 7 — Refactoring large graphs