Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Neo4j Graph Data Modelling
  • Table Of Contents Toc
  • Feedback & Rating feedback
Neo4j Graph Data Modelling

Neo4j Graph Data Modelling

By : Mahesh K Lal
3 (1)
close
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
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...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
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

Delete Note

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

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY