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

Business logic should lie in code


We returned data from Neo4j without any processing such as ordering flights by their duration or only choosing those connecting flights that are flying out at least two hours after the arrival of the incoming flight. There are multiple reasons for this:

  • Returning flights or itineraries sorted by flight duration doesn't solve anything for us since the total journey time will be a sum of all the flight durations and all the layovers.

  • Eager aggregation is generally an expensive process and, in case the client consuming data from Neo4j has processing power, it's better to delegate the processing to the client rather than do it in Neo4j.

  • In our case specifically, the aggregation for layover times is a complex calculation, more suited to programming languages rather than a query language such as Cypher.

  • The minimum layover time of two hours is more of a business logic and needs to be tackled in code and not on the database. In general, it's better to keep queries...