Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Neo4j Graph Data Modelling

You're reading from   Neo4j Graph Data Modelling Design efficient and flexible databases by optimizing the power of Neo4j

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher
ISBN-13 9781784393441
Length 138 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Mahesh K Lal Mahesh K Lal
Author Profile Icon Mahesh K Lal
Mahesh K Lal
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Graphs Are Everywhere FREE CHAPTER 2. Modeling Flights and Cities 3. Formulating an Itinerary 4. Modeling Bookings and Users 5. Refactoring the Data Model 6. Modeling Communication Chains 7. Modeling Access Control 8. Recommendations and Analysis of Historical Data 9. Wrapping Up Index

Modeling hierarchies


To model employees and access control groups, we need to first modify our existing data to account for hierarchies in regions, countries, and cities. We also need to add hotel chains and their hierarchies. We can then apply the same practices used in modeling hierarchies to model access groups.

Modeling geographical regions

We already have airports and cities, which are geographical entities. We can add a couple of other entities such as country and region.

Figure 7.1: Country and region

A country or a region is uniquely identified by its name.

We can represent the relationship between airports, cities, countries, and regions in the following way:

Figure 7.2: Regions, countries, cities, and airports

Note

The previous diagram representing Regions, countries, cities, and airports can be generalized to represent a hierarchy in Neo4j.

Adding countries and regions to Neo4j

We can add a constraint to ensure the uniqueness of a name across countries, shown as follows:

neo4j-sh (?)$ CREATE...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image