Neo4j Graph Data Modeling
eBook - ePub

Neo4j Graph Data Modeling

Mahesh Lal

Share book
  1. 138 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Neo4j Graph Data Modeling

Mahesh Lal

Book details
Book preview
Table of contents
Citations

About This Book

About This Book

  • Model your data as a graph using Neo4j to design databases with minimum hassle
  • Discover new patterns using graphs and solve problems that are difficult to solve using any other database
  • Step-by-step guide to designing a graph model with pitfalls and design choices

Who This Book Is For

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.

What You Will Learn

  • Translate a problem domain from a whiteboard to your database
  • Make design decisions based on the nature of data and how it is going to be used
  • Use Cypher to create and query data
  • Evolve your database in stages
  • Optimize the performance of your application with data design
  • Design paradigms to ensure flexibility, ease of querying, and performance
  • Move from an existing model to a new model without losing consistency

In Detail

Neo4j is a graph database that allows you to model your data as a graph and find solutions to complex real-world problems that are difficult to solve using any other type of database.

This book is designed to help you understand the intricacies of modeling a graph for any domain.

The book starts with an example of a graph problem and then introduces you to modeling non-graph problems using Neo4j. Concepts such as the evolution of your database, chains, access control, and recommendations are addressed, along with examples and are modeled in a graph. Throughout the book, you will discover design choices and trade-offs, and understand how and when to use them. By the end of the book, you will be able to effectively use Neo4j to model your database for efficiency and flexibility.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Neo4j Graph Data Modeling an online PDF/ePUB?
Yes, you can access Neo4j Graph Data Modeling by Mahesh Lal in PDF and/or ePUB format, as well as other popular books in Informatica & Programmazione open source. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781784397302

Neo4j Graph Data Modeling


Table of Contents

Neo4j Graph Data Modeling
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
eBooks, discount offers, and more
Questions
1. Graphs Are Everywhere
Graphs in mathematics
The property graph model
Storage – native graph storage versus non-native graph storage
Reasons to use graph databases
What to use a graph database for
Choosing Neo4j for exploring graph databases
The structure of the book
Summary
2. Modeling Flights and Cities
Graphs are more than social
Designing a system to get a travel itinerary
Introduction to modeling flights and cities
Identifying the entities
Introduction to modeling nodes and relationships
Using Cypher to operate on Neo4j
Creating cities in Neo4j
Indices
Adding flights to Neo4j
Traversing relationships
Summary
3. Formulating an Itinerary
Creating an itinerary from flights and cities
Information and paths
Using Cypher to find a path
Business logic should lie in code
Summary
4. Modeling Bookings and Users
Building a data model for booking flights
A simple model of the bookings ecosystem
Modeling bookings in an RDBMS
Creating bookings and users in Neo4j
Creating users
Creating bookings in Neo4j
Queries to find journeys and bookings
Finding all journeys of a user
Queries to find the booking history of a user
Upcoming journeys of a user
Summary
5. Refactoring the Data Model
Capturing information about hotels at airports
Modeling airports and hotels
Extracting airport information from flights
Breaking airports out as a node
Connecting flights to airports
Delinking flights and cities
Querying the refactored data model
Reasons for not migrating using a single query
Adding hotels to airports
Fetching hotels
Summary
6. Modeling Communication Chains
Capturing traveler reviews for hotels
A model for reviews and comments
Adding reviews to Neo4j
Listing reviews for a hotel
Using reviews to find the average rating of a hotel
Adding comments to Neo4j
Considerations for modeling temporal data as chains
Summary
7. Modeling Access Control
Controlling access for content change
Modeling hierarchies
Modeling geographical regions
Adding countries and regions to Neo4j
Modeling hotel chains
Adding hotel chains to Neo4j
Modeling access control groups and employees
Adding access groups to Neo4j
Adding employees to Neo4j
Querying the data model to find what is accessible to an employee
Summary
8. Recommendations and Analysis of Historical Data
Recommending cities to travelers
Modeling categories
Creating categories in Neo4j
Cities and categories
Recommending cities based on previous travels
Recommending cities on the basis of other travelers
Recommending hotels to travelers
Recommending hotels from the same chains
Recommending hotels visited by similar travelers
Recommending hotels that match a price range
Improving recommendations
Analysis of the historical data
Querying to discover patterns
Summary
9. Wrapping Up
There is no correct model
Further reading and exploration
What to watch out for while using Neo4j
Index

Neo4j Graph Data Modeling

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: July 2015
Production reference: 1230715
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-344-1
www.packtpub.com

Credits

Author
Mahesh Lal
Reviewers
Patrick Baumgartner
Sonal Raj
Daniel Vaughan
Acquisition Editor
Shaon Basu
Content Development Editor
Kirti Patil
Technical Editor
Mrunmayee Patil
Copy Editor
Pranjali Chury
Project Coordinator
Nidhi Joshi
Proofreader
Safis Editing
Indexer
Mariammal Chettiyar
Production Coordinator
Conidon Miranda
Cover Work
Conidon Miranda

About the Author

Mahesh Lal is a developer who has experience with various technologies. In 2011, while working on a social network for a client, he discovered the power of graphs, specifically Neo4j. Since then, he has been working with multiple clients across various domains for modeling their data as a graph. Currently working for ThoughtWorks, India, he is trying to help his clients look at their search problems in the form of a graph.

About the Reviewers

Patrick Baumgartner works as a passionate software craftsman at 42talents and builds software with Java/JEE, Spring Framework, OSGi, NoSQL databases, and other open source technologies. Since he began working with Neo4j in 2010, he sees the whole world as one big connected graph.
He is the host of the Neo4j Zurich and the Software Craftsmanship Zurich Meetup group and is actively involved in the agile community in Switzerland.
As a Spring trainer and Neo4j master instructor, he ...

Table of contents