Book Image

Neo4j Graph Data Modelling

Book Image

Neo4j Graph Data Modelling

Overview of this book

Table of Contents (16 chapters)
Neo4j Graph Data Modeling
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Analysis of the historical data


We have explored how to use the data model to enable a traveler to find what they need. With this data and some clever querying, we can also discover some trends that can help the businesses. Given we have the year, month, and day of bookings and hotel stays, we can venture into analyzing data and behavior patterns of individuals, and how it affects the businesses (hotels and airlines).

Querying to discover patterns

Bookings are not spread across the year evenly. There will always be months when the number of bookings made far exceeds the number of bookings during other months. The following query gives the number of bookings made for each month:

neo4j-sh (?)$ MATCH (booking:Booking)
WITH COLLECT(booking) AS bookings, booking
RETURN DISTINCT booking.month AS month, COUNT(bookings) AS num_of_bookings 
ORDER BY num_of_bookings DESC;

The output of the preceding query is as follows:

+-------------------------+
| month | num_of_bookings |
+-------------------------...