Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Neo4j Graph Data Modelling
  • Toc
  • feedback
Neo4j Graph Data Modelling

Neo4j Graph Data Modelling

By : Mahesh K Lal
3 (1)
close
Neo4j Graph Data Modelling

Neo4j Graph Data Modelling

3 (1)
By: Mahesh K Lal

Overview of this book

If you are a developer who wants to understand the fundamentals of modeling data in Neo4j and how it can be used to model full-fledged applications, then this book is for you. Some understanding of domain modeling may be advantageous but is not essential.
Table of Contents (11 chapters)
close
10
Index

Extracting airport information from flights


There are multiple steps involved in making the successful transition from airports being properties of flights to airports being an entity connected to the city they are located in.

To start with, let's create a constraint so that an airport can be uniquely identified by its code. The query is as follows:

neo4j-sh (?)$ CREATE CONSTRAINT ON (airport:Airport) ASSERT airport.code IS UNIQUE;

The output of the preceding query is as follows:

+-------------------+
| No data returned. |
+-------------------+
Constraints added: 1

Breaking airports out as a node

The next step is to break out the source_airport_code and destination_airport_code properties into nodes. After this change, the :HAS_FLIGHT and :FLYING_TO relationships will connect :Flight and :Airport rather than :Flight and :City, as shown:

Figure 5.3: Airports and flights—current and future models

In Figure 5.3, the relationships depicted with the dotted line exist currently. Relationships shown with...

bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete