What this book covers
Chapter 1, Introduction to Neo4j and Cypher, introduces Cypher and Neo4j. We discuss what the Cypher language is and how it is used to query the Neo4j graph database. We also take a look at how Cypher is different from other query languages and what sets it apart for querying graph databases.
Chapter 2, Components of Cypher, introduces the Cypher syntax with some examples. We will review the important aspects of the Cypher syntax and semantics in building graph traversal queries. We will discuss important keywords and the role they play in building the queries. We will take a look at the graph data model and how Cypher queries follow the data connections.
Chapter 3, Loading Data with Cypher, explains how to load the data into Neo4j using Cypher. We will discuss the various options available to create/update/delete the nodes, labels, relationships, and properties. We will discuss loading CSV, text and JSON files into Neo4j using Cypher.
Chapter 4, Querying Graph, discusses how querying works with Cypher. It discusses leveraging indexes on nodes and relationships to anchors and traversals. It also discusses conditional traversals, using multiple relationship types, returning paths, nodes, relationships, and so on. It also talks about returning the data as column-formatted data.
Chapter 5, Filtering, Sorting, and Aggregations, discusses how to filter the data using where
conditions on nodes and/or relationship properties, and how to sort the data and use aggregation functions such as SUM
, AVG
, COUNT
, and so on.
Chapter 6, List Expressions, UNION, and Subqueries, talks about using list expressions to reduce and process lists. It also explores how UNIONs can be used to return combined results from multiple queries along with leveraging subqueries to filter and process data.
Chapter 7, Working with Lists and Maps, explains how lists and maps are core elements in Cypher. This chapter discusses how we can handle lists and maps both as an input and as an output. It shows how easy it is to handle lists and maps as part of the querying process. It shows how to handle basic lists with Strings and also how to access individual elements at random or iterate through them.
Chapter 8, Advanced Query Patterns, discusses advanced concepts such as OPTIONAL MATCH
to handle scenarios where the graph path may or may not exist. It also discusses the query chain using WITH
and UNWIND
. It also talks about executing subqueries using the CALL
keyword and handling the responses in the main query.
Chapter 9, Query Tuning, talks about options to tune the Cypher queries. It talks about working with EXPLAIN PLAN
to understand the query execution plan. It also talks about using PROFILE
to understand how the query is executing and the amount of data being processed to understand the reasons for bottlenecks.
Chapter 10, Using APOC Utilities, talks about using APOC utilities to extend the built-in capabilities of Cypher. It gives more options to be able to load CSV and JSON data, schedule timers, make ad hoc batch data modifications, and so on.
Chapter 11, Cypher Ecosystem, talks about the Cypher ecosystem. It introduces you to tools and packages available to do more advanced data processing along with visualizing the results as graphs, tables, and so on.
Chapter 12, Tips and Tricks, talks about the best practices to get the most out of Cypher queries, which includes how to leverage data modeling and patterns. It also discusses the tips and tricks to identify performance bottlenecks and how to go about addressing them.