Book Image

Learning Neo4j 3.x - Second Edition

By : Jerome Baton
Book Image

Learning Neo4j 3.x - Second Edition

By: Jerome Baton

Overview of this book

Neo4j is a graph database that allows traversing huge amounts of data with ease. This book aims at quickly getting you started with the popular graph database Neo4j. Starting with a brief introduction to graph theory, this book will show you the advantages of using graph databases along with data modeling techniques for graph databases. You'll gain practical hands-on experience with commonly used and lesser known features for updating graph store with Neo4j's Cypher query language. Furthermore, you'll also learn to create awesome procedures using APOC and extend Neo4j's functionality, enabling integration, algorithmic analysis, and other advanced spatial operation capabilities on data. Through the course of the book you will come across implementation examples on the latest updates in Neo4j, such as in-graph indexes, scaling, performance improvements, visualization, data refactoring techniques, security enhancements, and much more. By the end of the book, you'll have gained the skills to design and implement modern spatial applications, from graphing data to unraveling business capabilities with the help of real-world use cases.
Table of Contents (24 chapters)
Title Page
Credits
About the Authors
Acknowledgement
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface

Preface

Learning Neo4j 3.x will give you the keys to graph databases and Neo4j in particular. From concepts to applications, you will learn a lot about Neo4j and will wonder why using relational databases again.

What this book covers

Chapter 1, Graph Theory and Databases, explains the fundamental theoretical and historical underpinnings of graph database technology. Additionally, this chapter positions graph databases in an ever-changing database landscape. It compares the technology/industry with other data technologies out there.

Chapter 2, Getting Started with Neo4j, introduces the specific Neo4j implementation of a graph database and looks at key concepts and characteristics.

Chapter 3, Modeling Data for Neo4j, covers the basic modeling techniques for graph databases.

Chapter 4, Getting Started with Cypher, provides an overview of the Cypher query language.

Chapter 5, Awesome Procedures on Cypher - APOC, introduces the APOC library. You will learn how to use it within Cypher queries, get information on it, and find the procedure you need among the hundreds provided by the community.

Chapter 6, Extending Cypher, talks about adding functions and procedures to a Neo4j instance. Write your own APOC.

Chapter 7, Query Performance Tuning, shows you how to tune your Cypher queries for better performance.

Chapter 8, Importing Data into Neo4j, explains how to import data from different kinds of sources.

Chapter 9, Going Spatial, covers the geolocation capabilities of Neo4j, APOC, and Neo4j Spatial.

Chapter 10, Security, covers authentication and authorization in Neo4j.

Chapter 11, Visualizations for Neo4j, shows you how to display your data.

Chapter 12, Data Refactoring with Neo4j, explains how to change the data model to fit new requirements.

Chapter 13, Clustering, sets up a causal cluster using the Neo4j Enterprise edition.

Chapter 14, Use-Case Example – Recommendations, digs into a specific graph database use case--real-time recommendations--and explains it using a specific example dataset/query patterns.

Chapter 15, Use-Case Example – Impact Analysis and Simulation, analyzes the impact of a change in the network on the rest of the network. In this part of the book, we will explain and explore that use case.

Appendix, Tips and Tricks, provides tips and more knowledge, don't miss it.

What you need for this book

To run the software and examples, you will need a decent developer station with Java 7 or better, with 4 GB of RAM and 2 GB of free disk space.

Examples are provided for the GNU/Linux systems.

Most chapters apply to Neo4j Community Edition and Neo4j Enterprise Edition, except Chapter 10, Security, and Chapter 13, Clustering.

In the later chapters, two laptops, several Raspberry Pis, and Docker containers are used.

Who this book is for

This book is for developers who want an alternative way to store and process data within their applications or developers who have to deal with highly connected data. No previous graph database experience is required; however, some basic database knowledge will help you understand the concepts more easily.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We mapped the learningneo4j package to the /learningneo4j URL."

A block of code is set as follows:

public class StringHacking {
@UserFunction
 @Description("Returns the last word of a string")
 public String getLastWord( @Name("aStr") String aStr){
 if(aStr==null) return null;
 else  {
 int pos = aStr.lastIndexOf(" ");
 if(pos==-1) return aStr;
 else return aStr.substring(pos+1);
 }
 }
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

MATCH (ln:LastName)--(p:Person)
RETURN ln, learningneo4j.randomCount(p.lastName) AS badcount

 

Any command-line input or output is written as follows:

mkdir data/ldap/environment -p
mkdir data/ldap/db -p

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "In order to download new modules, we will go to Files | Settings | Project Name | Project Interpreter."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply email [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files emailed directly to you. You can download the code files by following these steps:

  1. Log in or register to our website using your email address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Learning-Neo4j-3x-Second-Edition. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

 

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title. To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

 

Piracy

Piracy of copyrighted material on the internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the internet, please provide us with the location address or website name immediately so that we can pursue a remedy. Please contact us at [email protected] with a link to the suspected pirated material. We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.