You are previewing Neo4j Cookbook.
O'Reilly logo
Neo4j Cookbook

Book Description

Harness the power of Neo4j to perform complex data analysis over the course of 75 easy-to-follow recipes

In Detail

Neo4j is an open source graph database written in Java. Graph databases provide an excellent way to get richer insight into data and lower the bar for entry into the data science world. Starting with a practical and vital introduction to Neo4j and various aspects of Neo4j installation, you will learn how to connect and access Neo4j servers from programming languages such as Java, Python, Ruby, and Scala. You will also learn about Neo4j administration and maintenance before expanding and advancing your knowledge by dealing with large Neo4j installations and optimizing them for both storage and querying.

This is a practical guide full of examples and Neo4j recipes. The recipes are well explained with code samples that are updated for the latest version of Neo4j.

What You Will Learn

  • Access the Neo4j graph database from any language of your choice, whether it is Java, Python, Scala, or .Net

  • Understand how to migrate data from different types of data stores such as SQL and NoSQL with ease

  • Utilize and learn data modeling best practices

  • Use and mine social data, whether it be from Facebook, Twitter, or LinkedIn

  • Deal with geospatial data and build services such as bounding box queries and nearest point of interest

  • Visualize Neo4j graphs by customizing available tools or writing your own tool

  • Scale Neo4j with up to billions of nodes and edges

  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased 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 e-mailed directly to you.

    Table of Contents

    1. Neo4j Cookbook
      1. Table of Contents
      2. Neo4j Cookbook
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Getting Started with Neo4j
        1. Introduction
        2. Single node installation of Neo4j over Linux
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Single node installation of Neo4j over Windows
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Single node installation of Neo4j over Mac OS X
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        5. Creating your first graph with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        6. Importing data from the CSV format to Neo4j
          1. Getting ready
          2. How to do it...
            1. Using a batch importer
            2. Using custom scripts
          3. How it works...
          4. See also
        7. Importing data from RDBMS to Neo4j
          1. Getting ready
          2. How to do it...
            1. Using the Neo4j SQL importer tool
            2. Using custom scripts
          3. How it works...
          4. There's more…
        8. Importing data from the Geoff format to Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
            1. Bulk load
          4. See also
        9. Importing data from OrientDB to Neo4j
          1. Getting ready
          2. How to do it...
            1. Exporting in the JSON format
            2. Using Gremlin
          3. How it works...
          4. See also
        10. Importing data from InfiniteGraph to Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        11. Importing data from the DEX graph database to Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        12. Common configurations of Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        13. Running multiple instances of Neo4j over a single machine
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        14. Building Neo4j from the source
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
      9. 2. Connecting to Neo4j
        1. Introduction
        2. Accessing Neo4j from the command line using the Neo4j shell
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Accessing Neo4j from the command line using curl
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Accessing Neo4j from the Java libraries
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Accessing Neo4j using the Java REST bindings
          1. Getting ready
          2. How to do it...
            1. Developing your own Neo4j REST client
            2. Using the Java Neo4j REST binding
          3. How it works...
        6. Mapping Neo4j to Java-annotated classes using Spring Data Neo4j
          1. Getting ready
          2. How to do it...
            1. Graph Entities
          3. How it works...
        7. Accessing the embedded Neo4j from Python
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Accessing Neo4j from Python using the REST bindings
          1. Getting ready
          2. How to do it...
        9. Annotate the Python object model to the Neo4j graph database
          1. Getting ready
          2. How to do it...
          3. How it works...
        10. Accessing the embedded Neo4j from Ruby
          1. Getting ready
          2. How to do it...
          3. How it works...
        11. Accessing Neo4j from Ruby using the REST Bindings
          1. Getting ready
          2. How to do it...
        12. Accessing Neo4j from Scala
          1. How to do it...
        13. Accessing Neo4j from .NET
          1. How to do it...
        14. Accessing Neo4j from PHP
          1. Getting ready
          2. How to do it…
        15. Accessing Neo4j from Node.js
          1. Getting ready
          2. How to do it…
      10. 3. The Cypher Query Language
        1. Introduction
        2. Creating your first node and relationship using Cypher
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Querying nodes and relationships using Cypher
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Deleting data from Neo4j using the Cypher query
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Boolean operators with Cypher
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Changing the order of results with Cypher
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Limiting and skipping results with Cypher
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Regular expressions with Cypher
          1. Getting ready
          2. How to do it...
          3. How it works...
        9. Aggregation with Cypher
          1. Getting ready
          2. How to do it...
          3. How it works...
        10. Combining results with Cypher
          1. Getting ready
          2. How to do it...
          3. How it works...
        11. Finding paths in Cypher along with their shortest route
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
      11. 4. Data Modeling and Leveraging with Neo4j
        1. Introduction
        2. Data modeling with Neo4j – moving away from traditional SQL
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Aggregate versus connected data models
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. The connected model
            2. The aggregated model
            3. The hybrid model
        4. Creating a binary search tree with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Healthcare data modeling with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Travel data modeling with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Social data modeling with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        8. Retail data modeling with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
      12. 5. Mining the Social Treasure
        1. Introduction
        2. Finding mutual friends with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Finding friends of friends with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Activity streaming with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Finding user similarity with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Network reachability with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
      13. 6. Developing Location-based Services with Neo4j
        1. Introduction
        2. Installing the Neo4j Spatial extension
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        3. Importing the Esri shapefiles
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        4. Importing the OpenStreetMap files
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        5. Importing data using the REST API
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        6. Creating a point layer using the REST API
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        7. Finding geometries within the bounding box
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        8. Finding geometries within a distance
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        9. Finding geometries within a distance using Cypher
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
      14. 7. Visualization of Graphs
        1. Introduction
        2. Visualization using the Neo4j console
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Viewing your graph with Linkurious
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. The Neo4j graph with Gephi
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Visualization with Neoeclipse
          1. Getting ready
          2. How to do it...
          3. How it works...
      15. 8. Industry Usages of Neo4j
        1. Introduction
        2. Healthcare with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        3. The social networking industry with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        4. The travel industry with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        5. E-commerce with Neo4j
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
      16. 9. Neo4j Administration and Maintenance
        1. Introduction
        2. Deploying Neo4j over the Amazon EC2 Cloud
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        3. Deploying Neo4j over the Heroku Cloud
          1. Getting ready
          2. How to do it...
          3. There's more…
        4. Deploying Neo4j over the Microsoft Azure Cloud
          1. Getting ready
          2. How to do it...
          3. There's more…
        5. Backups with Neo4j
          1. Getting ready
          2. How to do it...
            1. Neo4j backup with Community Edition
            2. Neo4j backup with Enterprise Edition
          3. There's more…
        6. Upgrading Neo4j to the latest version
          1. Getting ready
          2. How to do it...
          3. There's more…
        7. Neo4j's remote debugging setup
          1. Getting ready
          2. How to do it...
          3. There's more…
        8. Configuring secure access to your Neo4j instance
          1. Getting ready
          2. How to do it...
          3. There's more…
      17. 10. Scaling Neo4j
        1. Introduction
        2. A bulk upload of the initial large dataset
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        3. The high availability setup
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        4. Handling high read loads
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        5. Handling high write loads
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        6. Optimizing the Cypher query for performance
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
      18. Index