
The Cypher Query Language
Cypher is the language used to interact with Neo4j. Originally created by Neo4j for Neo4j, it has been open sourced as openCypher and is now used by other graph database engines such as RedisGraph. It is also part of the Graph Query Language (GQL) association, whose goal is to build a common graph database query language – like SQL is for relational databases. In any case, it is a good starting point to understand how to query graph databases due to its visual aspect: nodes and relationships can be identified quickly by looking at the query.
In this chapter, we will review the basics of Cypher, which will be used in this book: CRUD methods, bulk importing data with various formats, and pattern matching to extract exactly the data we need from a graph. It is a good place to introduce the Awesome Procedures On Cypher (APOC) plugin, which is an extension of Cypher introducing powerful methods for data imports, and more. We will also take a look at more advanced tools such as the Cypher query planner. It will help us to understand the different steps of a query and how we can tune it for faster execution. Finally, we'll discuss Neo4j and Cypher performance with a social (Facebook-like) graph.
The following topics will be covered in this chapter:
- Creating nodes and relationships
- Updating and deleting nodes and relationships
- Using the aggregation function
- Importing data from CSV or JSON
- Measuring performance and tuning your query for speed