Neo4j Cookbook
By Ankur Goel
()
About this ebook
- Rapidly build your data analysis application over Neo4j with ease
- Transition from RDMS and other NoSQL databases to Neo4j
- Learn to effectively scale your Neo4j installations to millions of nodes
If you are already using Neo4j in your application and want to learn more about data analysis or database graphs, this is the book for you. This book also caters for your needs if you are looking to migrate your existing application to Neo4j in the future. We assume that you are already familiar with any general purpose programming language and have some familiarity with Neo4j.
Related to Neo4j Cookbook
Related ebooks
Hadoop Real-World Solutions Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsApache Hive Cookbook Rating: 0 out of 5 stars0 ratingsElixir Cookbook Rating: 0 out of 5 stars0 ratingsApache Spark for Data Science Cookbook Rating: 0 out of 5 stars0 ratingsSolr Cookbook - Third Edition Rating: 0 out of 5 stars0 ratingsWeb Development with Django Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsData Visualization with D3.js Cookbook Rating: 0 out of 5 stars0 ratingsFlask Framework Cookbook Rating: 5 out of 5 stars5/5TensorFlow Machine Learning Cookbook Rating: 4 out of 5 stars4/5Node Cookbook: Second Edition Rating: 3 out of 5 stars3/5Learning Neo4j Rating: 3 out of 5 stars3/5Neo4j High Performance Rating: 0 out of 5 stars0 ratingsNeo4j in Action Rating: 0 out of 5 stars0 ratingsPython High Performance - Second Edition Rating: 0 out of 5 stars0 ratingsBuilding Web Applications with Python and Neo4j Rating: 0 out of 5 stars0 ratingsData Analysis with Python and PySpark Rating: 0 out of 5 stars0 ratingsLearning Cypher Rating: 0 out of 5 stars0 ratingsNeo4j Graph Data Modeling Rating: 4 out of 5 stars4/5Neo4j - A Graph Project Story Rating: 5 out of 5 stars5/5Machine Learning Systems: Designs that scale Rating: 0 out of 5 stars0 ratingsIntroducing Data Science: Big data, machine learning, and more, using Python tools Rating: 5 out of 5 stars5/5Fast Data Processing with Spark 2 - Third Edition Rating: 0 out of 5 stars0 ratingsPractical Full Stack Machine Learning: A Guide to Build Reliable, Reusable, and Production-Ready Full Stack ML Solutions Rating: 0 out of 5 stars0 ratingsMLOps Engineering at Scale Rating: 0 out of 5 stars0 ratingsData Pipelines with Apache Airflow Rating: 0 out of 5 stars0 ratingsGraph Databases in Action: Examples in Gremlin Rating: 0 out of 5 stars0 ratingsLearning Apache Spark 2 Rating: 0 out of 5 stars0 ratingsMachine Learning with TensorFlow, Second Edition Rating: 0 out of 5 stars0 ratings
Databases For You
Excel 2021 Rating: 4 out of 5 stars4/5Query Store for SQL Server 2019: Identify and Fix Poorly Performing Queries Rating: 0 out of 5 stars0 ratingsFileMaker Pro Design and Scripting For Dummies Rating: 0 out of 5 stars0 ratingsAccess 2019 For Dummies Rating: 0 out of 5 stars0 ratingsPractical Data Analysis Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Python Projects for Everyone Rating: 0 out of 5 stars0 ratingsSchaum’s Outline of Fundamentals of SQL Programming Rating: 3 out of 5 stars3/5SQL Clearly Explained Rating: 5 out of 5 stars5/5Access 2010 All-in-One For Dummies Rating: 4 out of 5 stars4/5The AI Bible, Making Money with Artificial Intelligence: Real Case Studies and How-To's for Implementation Rating: 4 out of 5 stars4/5COMPUTER SCIENCE FOR ROOKIES Rating: 0 out of 5 stars0 ratingsSQL Server: Tips and Tricks - 2 Rating: 4 out of 5 stars4/5Learn SQL in 24 Hours Rating: 5 out of 5 stars5/5Serverless Architectures on AWS, Second Edition Rating: 5 out of 5 stars5/5SQL: Practical Guide for Developers Rating: 2 out of 5 stars2/5Beginning Microsoft Power BI: A Practical Guide to Self-Service Data Analytics Rating: 0 out of 5 stars0 ratingsCodeless Data Structures and Algorithms: Learn DSA Without Writing a Single Line of Code Rating: 0 out of 5 stars0 ratingsData Stewardship: An Actionable Guide to Effective Data Management and Data Governance Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Practical SQL Rating: 4 out of 5 stars4/5Access for Beginners: Access Essentials, #1 Rating: 0 out of 5 stars0 ratingsLearn SQL Server Administration in a Month of Lunches Rating: 0 out of 5 stars0 ratingsArtificial Intelligence for Fashion: How AI is Revolutionizing the Fashion Industry Rating: 0 out of 5 stars0 ratingsBeginning Microsoft SQL Server 2012 Programming Rating: 1 out of 5 stars1/5100+ SQL Queries T-SQL for Microsoft SQL Server Rating: 4 out of 5 stars4/5Learning PostgreSQL Rating: 1 out of 5 stars1/5Building a Scalable Data Warehouse with Data Vault 2.0 Rating: 4 out of 5 stars4/5Relational Database Design and Implementation Rating: 5 out of 5 stars5/5
Reviews for Neo4j Cookbook
0 ratings0 reviews
Book preview
Neo4j Cookbook - Ankur Goel
Table of Contents
Neo4j Cookbook
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
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Getting Started with Neo4j
Introduction
Single node installation of Neo4j over Linux
Getting ready
How to do it...
How it works...
See also
Single node installation of Neo4j over Windows
Getting ready
How to do it...
How it works...
See also
Single node installation of Neo4j over Mac OS X
Getting ready
How to do it...
How it works...
There's more…
Creating your first graph with Neo4j
Getting ready
How to do it...
How it works...
There's more…
Importing data from the CSV format to Neo4j
Getting ready
How to do it...
Using a batch importer
Using custom scripts
How it works...
See also
Importing data from RDBMS to Neo4j
Getting ready
How to do it...
Using the Neo4j SQL importer tool
Using custom scripts
How it works...
There's more…
Importing data from the Geoff format to Neo4j
Getting ready
How to do it...
How it works...
Bulk load
See also
Importing data from OrientDB to Neo4j
Getting ready
How to do it...
Exporting in the JSON format
Using Gremlin
How it works...
See also
Importing data from InfiniteGraph to Neo4j
Getting ready
How to do it...
How it works...
There's more…
Importing data from the DEX graph database to Neo4j
Getting ready
How to do it...
How it works...
See also
Common configurations of Neo4j
Getting ready
How to do it...
How it works...
There's more…
Running multiple instances of Neo4j over a single machine
Getting ready
How to do it...
How it works...
See also
Building Neo4j from the source
Getting ready
How to do it...
How it works...
There's more…
2. Connecting to Neo4j
Introduction
Accessing Neo4j from the command line using the Neo4j shell
Getting ready
How to do it...
How it works...
Accessing Neo4j from the command line using curl
Getting ready
How to do it...
How it works...
Accessing Neo4j from the Java libraries
Getting ready
How to do it...
How it works...
Accessing Neo4j using the Java REST bindings
Getting ready
How to do it...
Developing your own Neo4j REST client
Using the Java Neo4j REST binding
How it works...
Mapping Neo4j to Java-annotated classes using Spring Data Neo4j
Getting ready
How to do it...
Graph Entities
How it works...
Accessing the embedded Neo4j from Python
Getting ready
How to do it...
How it works...
Accessing Neo4j from Python using the REST bindings
Getting ready
How to do it...
Annotate the Python object model to the Neo4j graph database
Getting ready
How to do it...
How it works...
Accessing the embedded Neo4j from Ruby
Getting ready
How to do it...
How it works...
Accessing Neo4j from Ruby using the REST Bindings
Getting ready
How to do it...
Accessing Neo4j from Scala
How to do it...
Accessing Neo4j from .NET
How to do it...
Accessing Neo4j from PHP
Getting ready
How to do it…
Accessing Neo4j from Node.js
Getting ready
How to do it…
3. The Cypher Query Language
Introduction
Creating your first node and relationship using Cypher
Getting ready
How to do it...
How it works...
Querying nodes and relationships using Cypher
Getting ready
How to do it...
How it works...
Deleting data from Neo4j using the Cypher query
Getting ready
How to do it...
How it works...
Boolean operators with Cypher
Getting ready
How to do it...
How it works...
Changing the order of results with Cypher
Getting ready
How to do it...
How it works...
Limiting and skipping results with Cypher
Getting ready
How to do it...
How it works...
Regular expressions with Cypher
Getting ready
How to do it...
How it works...
Aggregation with Cypher
Getting ready
How to do it...
How it works...
Combining results with Cypher
Getting ready
How to do it...
How it works...
Finding paths in Cypher along with their shortest route
Getting ready
How to do it...
How it works...
There's more…
4. Data Modeling and Leveraging with Neo4j
Introduction
Data modeling with Neo4j – moving away from traditional SQL
Getting ready
How to do it...
How it works...
Aggregate versus connected data models
Getting ready
How to do it...
How it works...
There's more...
The connected model
The aggregated model
The hybrid model
Creating a binary search tree with Neo4j
Getting ready
How to do it...
How it works...
Healthcare data modeling with Neo4j
Getting ready
How to do it...
How it works...
See also
Travel data modeling with Neo4j
Getting ready
How to do it...
How it works...
See also
Social data modeling with Neo4j
Getting ready
How to do it...
How it works...
See also
Retail data modeling with Neo4j
Getting ready
How to do it...
How it works...
See also
5. Mining the Social Treasure
Introduction
Finding mutual friends with Neo4j
Getting ready
How to do it...
How it works...
Finding friends of friends with Neo4j
Getting ready
How to do it...
How it works...
Activity streaming with Neo4j
Getting ready
How to do it...
How it works...
Finding user similarity with Neo4j
Getting ready
How to do it...
How it works...
Network reachability with Neo4j
Getting ready
How to do it...
How it works...
6. Developing Location-based Services with Neo4j
Introduction
Installing the Neo4j Spatial extension
Getting ready
How to do it...
How it works...
There's more…
Importing the Esri shapefiles
Getting ready
How to do it...
How it works...
There's more…
Importing the OpenStreetMap files
Getting ready
How to do it...
How it works...
There's more…
Importing data using the REST API
Getting ready
How to do it...
How it works...
There's more…
Creating a point layer using the REST API
Getting ready
How to do it...
How it works...
There's more…
Finding geometries within the bounding box
Getting ready
How to do it...
How it works...
There's more…
Finding geometries within a distance
Getting ready
How to do it...
How it works...
There's more…
Finding geometries within a distance using Cypher
Getting ready
How to do it...
How it works...
There's more…
7. Visualization of Graphs
Introduction
Visualization using the Neo4j console
Getting ready
How to do it...
How it works...
Viewing your graph with Linkurious
Getting ready
How to do it...
How it works...
The Neo4j graph with Gephi
Getting ready
How to do it...
How it works...
Visualization with Neoeclipse
Getting ready
How to do it...
How it works...
8. Industry Usages of Neo4j
Introduction
Healthcare with Neo4j
Getting ready
How to do it...
How it works...
There's more…
The social networking industry with Neo4j
Getting ready
How to do it...
How it works...
There's more…
The travel industry with Neo4j
Getting ready
How to do it...
How it works...
There's more…
E-commerce with Neo4j
Getting ready
How to do it...
How it works...
There's more…
9. Neo4j Administration and Maintenance
Introduction
Deploying Neo4j over the Amazon EC2 Cloud
Getting ready
How to do it...
How it works...
There's more…
Deploying Neo4j over the Heroku Cloud
Getting ready
How to do it...
There's more…
Deploying Neo4j over the Microsoft Azure Cloud
Getting ready
How to do it...
There's more…
Backups with Neo4j
Getting ready
How to do it...
Neo4j backup with Community Edition
Neo4j backup with Enterprise Edition
There's more…
Upgrading Neo4j to the latest version
Getting ready
How to do it...
There's more…
Neo4j's remote debugging setup
Getting ready
How to do it...
There's more…
Configuring secure access to your Neo4j instance
Getting ready
How to do it...
There's more…
10. Scaling Neo4j
Introduction
A bulk upload of the initial large dataset
Getting ready
How to do it...
How it works...
There's more…
The high availability setup
Getting ready
How to do it...
How it works...
There's more…
Handling high read loads
Getting ready
How to do it...
How it works...
There's more…
Handling high write loads
Getting ready
How to do it...
How it works...
There's more…
Optimizing the Cypher query for performance
Getting ready
How to do it...
How it works...
There's more…
Index
Neo4j Cookbook
Neo4j Cookbook
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: May 2015
Production reference: 1260515
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-725-3
www.packtpub.com
Credits
Author
Ankur Goel
Reviewers
Onofrio Panzarino
Ignaz Wanders
Commissioning Editor
James Jones
Acquisition Editor
James Jones
Content Development Editor
Ruchita Bhansali
Technical Editor
Narsimha Pai
Copy Editors
Dipti Kapadia
Rashmi Sawant
Project Coordinator
Kranti Berde
Proofreaders
Safis Editing
Paul Hindle
Indexers
Hemangini Bari
Rekha Nair
Graphics
Sheetal Aute
Valentina D'silva
Disha Haria
Production Coordinators
Komal Ramchandani
Alwin Roy
Cover Work
Komal Ramchandani
About the Author
Ankur Goel has been passionate about software development for a long time. He is particularly interested in exploring upcoming technologies in the areas of big data, artificial intelligence, and machine learning. He started his career with CDAC High Performance Computing Lab, where he worked on the PARAM series of supercomputers and built real-world use cases around them. He has been working for start-up companies and research labs for most of his career.
He also enjoys working with start-ups that are in the stealth mode stage, and helps them with their technology stack.
He lives in the beautiful city of Chandigarh, India, with his pretty wife and cute newborn daughter.
This book and all of the work that went on around it would not have been possible without the unconditional support of my wife, Pooja, and mother, Santosh. During this book, my daughter, Aradhita, came into our life, so I've been taking care of both the babies together, my first book and our first child.
I would also like to thank the amazing people at Neo4j Technologies for introducing the power of graph databases to the world and also for keeping everyone on their toes by introducing cool features frequently.
Special thanks to the reviewers and editors at Packt Publishing, especially Ruchita and Narsimha, without whose efforts this work would not have been possible.
About the Reviewers
Onofrio Panzarino is a programmer with 15 years of experience, working with various languages (mostly with Java), platforms, and technologies. Before receiving his master of science degree in electronics engineering, he worked as a digital signal processor programmer. Around the same time, he started working as a C++ developer for real-time embedded systems and PCs. Currently, he is working with Android, ASP.NET C#, and JavaScript. During these years, he gained a lot of experience in graph databases, particularly in Neo4j.
Onofrio is the author of Learning Cypher, by Packt Publishing, in 2014. He also reviewed Fast ASP.NET Websites, by Manning Publications.
He resides in Ancona, Italy. He is a speaker in the local Java user group and also a technical writer, mostly for Scala and NoSQL. In his spare time, he loves playing the piano with his family and programming with functional languages. His Twitter handle is @onof80.
Ignaz Wanders is an enterprise architect who specializes in integration and data architectures. He is an expert in service-oriented architecture and in applying top-down methodologies to achieve his goals.
Ignaz has great practical experience in ESBs, BPM, Neo4j, Java EE, and a wide variety of supporting frameworks and tools.
He is a speaker at international conferences and his astronomical background facilitates a strong analytical mind and excellent problem-solving skills.
Ignaz works for Archimiddle and offers consultancy to a variety of customers, ranging from government institutions to telecom and logistics.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads