Join William Lyon for an in-depth discussion in this video A brief overview of Neo4j, part of Database Clinic: Neo4J.
- [Instructor] Neo4j is a graph database. One thing that's unique about graph databases is the data model. Unlike other databases that might use tables or documents to represent data, graph databases use a graph. Now when we say graph, we're talking about the graph data structure, not necessarily data visualization. Data visualization can be an important aspect of making sense of graph data, but it's important to understand that the underlying data model in Neo4j is composed of nodes, the entities in our data, and relationships that connect nodes.
Here we can see Neo4j Browser, which is a tool for interacting with Neo4j. I've loaded a data set of movies and user ratings from Neo4j Sandbox. Neo4j Sandbox is a great way to spin up some sample graph data sets and explore the common use cases for Neo4j. Neo4j is commonly used for building personalized recommendation systems, for real-time fraud detection, and working with IT and network operations data. But, of course, we can also use Neo4j as a general application database.
Neo4j Browser is a query workbench and visualization interface for Neo4j. It provides an interactive environment for developers to work with the database. We use the Cypher Query Language for interacting with Neo4j. You can think of Cypher as similar to Sequel, but designed for graphs instead of tables. Cypher's all about pattern matching. In this Cypher query, we can see the first line is a MATCH statement, followed by a graph pattern, defined using this ASCII art-like syntax.
Nodes are defined within parentheses and relationships within brackets. After the MATCH statement, we see other commands that should be familiar if you used another language, like Sequel. We're going to be using Cypher quite a bit throughout the course. We'll learn many of the features of Cypher. But a good reference resource is the Cypher Refcard, which has many examples of Cypher syntax. I use the Cypher Refcard almost every day, so it'll be a very handy resource to have available as we work through the problems in the course.
Neo4j has many of the same features that we expect in any other database. Things like ACID transactions, role-based authentication and authorization, a binary protocol for sending encrypted data over the wire. We can deploy Neo4j as a cluster with multiple database instances for scalability. Neo4j is designed for online transaction processing workloads. Things like powering real-time product recommendations for a web application. We can also use Neo4j for analytical queries and executing graph algorithms, like earning PageRank to find the most influential user in a social network.
It's important to note that Neo4j Browser is just one developer tool for interacting with Neo4j. Often our goal is to build an application that uses code to query the database. Neo4j has language drivers for most popular languages that allow for sending Cypher queries to the database. Here's an example of using Python to query Neo4j. Throughout the course, we'll mostly be using Cypher, but we will spend some time seeing how we can combine Python and Cypher as we work through the problems.
- Strengths and weaknesses of Neo4j
- Data modeling
- Creating a database
- Joining data sets
- Modeling data for joining data sets
- Searching a database
- CRUD operations
- Performing calculations