Online Course Introduction to Neo4j 4.0 Neo4j is a Graph Database The Neo4j Graph Platform Introduction to Cypher Using WHERE to Filter Queries Working with Patterns in Queries Working with Cypher Data Controlling the Query Chain Controlling Results Returned Creating… Read more →
The Neo4j Graph Platform
The Neo4j Graph Platform enables developers to create applications that are best architected as graph-powered systems that are built upon the rich connectedness of data.
At the end of this module, you should be able to:
- Describe the components and benefits of the Neo4j Graph Platform.
The Neo4j Graph Platform includes components that enable you to develop your graph-enabled application.
It is used by developers, administrators, data analysts, and data scientists to access application data. Developers create the data in the graph by either importing it into the graph or using the Cypher language to implement the data model. In addition, developers are responsible for integrating the graph with other systems and database management system (DBMS) installations. Admins manage the processes and files related to the Neo4j installation. Data scientists and data analysts typically use a combination Cypher queries, as well as tools to analyze the data. End-users typically use applications written by developers to access the graph data.
To better understand the Neo4j Graph Platform, you will learn about these components and the benefits they provide.
- Neo4j DBMS
- Neo4j Aura
- Neo4j Sandbox
- Neo4j Desktop
Neo4j graph applications
- Neo4j Browser
- Neo4j Bloom
- Neo4j libraries
- Neo4j drivers
- Neo4j integration
- Neo4j administration tools
The heart of the Neo4j Graph Platform is the Neo4j DBMS. The Neo4j DBMS includes processes and resources needed to manage a single Neo4j instance or a set of Neo4j instances that form a cluster. A Neo4j instance is a single process that runs the Neo4j server code. A Neo4j instance at a minimum contains two databases, the system database and the default database, neo4j.
The system database stores metadata about the databases for the installation, as well as security configuration. The default database (named neo4j by default) is the “user” database where you implement your graph data model.
In Neo4j Enterprise Edition 4.0, you may have more than one “user” database.
Here we have three “user” databases that hold the application data. You specify one of the databases as the default database.
Next, you will learn about some features of Neo4j DBMS that make it different from traditional relational database management system (RDBMS).
Image credit: Dan McCreary
Most people would follow these simple steps:
- Leave my house.
- Point myself towards Anne’s house.
- Walk to Anne’s house.
Here is an example of how index-free adjacency (IFA) works. Suppose you bake a pie for your friend Anne. You want to delivery it quickly, so she can enjoy it while it is still warm. How would you go about delivering it?
This takes maybe 30 seconds, and the pie is piping hot when you get there. No wasted time or effort. This is how index-free adjacency operates.
By contrast, a traditional RDBMS cannot do this. It must use a central index.
Image credit: Dan McCreary
In a RDBMS world, the pie-delivery process would go like this:
- Leave my house.
- Walk to the town hall. It contains a Central Index containing the addresses of everyone in town. Stand in line. Everyone looking for an address needs to do the same thing you are, so there is a wait.
- Tell the search agent whom you’re looking for. They will look up Anne’s address in the index (note that the larger the town, the longer it takes to do the search). The agent gives you Anne’s address.
- Enter the address into the map app on your phone, and follow the directions to Anne’s house.
This is obviously inefficient. You needed to walk twice as far, had to wait in line, and had to wait for a search process to complete. But to make matters even worse, there is no concept of “learning the route”, no matter how many times you take it. Every single time you want to visit Anne’s house, you need to follow these same steps!
With index-free adjacency, when a node or relationship is written to the database, it is stored in the database as connected and any subsequent access to the data is done using pointer navigation which is very fast. Since Neo4j is a native graph database (i.e. it has a graph as its core data model), it supports very large graphs where connected data can be traversed in constant time without the need for an index.
Transactionality is very important for robust applications that require an ACID (atomicity, consistency, isolation, and durability) guarantees for their data. If a relationship between nodes is created, not only is the relationship created, but the nodes are updated as connected. All of these updates to the database must all succeed or fail.
Neo4j supports clusters that provide high availability, scalability for read access to the data, and failover which is important to many enterprises. Neo4j clusters are only available with Neo4j Enterprise Edition.
The Neo4j graph engine is used to interpret Cypher statements and also executes kernel-level code to store and retrieve data, whether it is on disk, or cached in memory. The graph engine has been improved with every release of Neo4j to provide the most efficient access to an application’s graph data. There are many ways that you can tune the performance of the engine to suit your particular application needs.
Neo4j Aura is the simplest way to run the Neo4j DBMS in the cloud.
Completely automated and fully-managed, Neo4j Aura delivers the world’s most flexible, reliable and developer-friendly graph database as a service. With Neo4j Aura, you leave the day-to-day management of your database to the same engineers who built Neo4j, freeing you to focus on building rich graph-powered applications. Backups are done automatically for you and the database is available 24×7. In addition, the Neo4j Aura team will ensure that the database instance is always up-to-date with the latest version of Neo4j. To use Neo4j Aura, you must pay a monthly subscription fee which is based upon the size of your graph.
Once you create a Neo4j Database at the Neo4j Aura site, it will be managed by Neo4j.
Here is a short video that shows how to create a database in Neo4j Aura:
The Neo4j Sandbox is way that you can begin development with Neo4j. It is a free, temporary, and cloud-based instance of a Neo4j Server with its associated graph that you can access from any Web browser. The database in a Sandbox may be blank or it may be pre-populated. It is started automatically for you when you create the Sandbox.
By default, the Neo4j Sandbox is available for three days, but you can extend it for up to 10 days. If you do not want to install Neo4j Desktop on your system, consider creating a Neo4j Sandbox. You must make sure that you extend your lease of the Sandbox, otherwise you will lose your graph and any saved Cypher scripts you have created in the Sandbox. However, you can use Neo4j Browser Sync to save Cypher scripts from your Sandbox. We recommend you use the Neo4j Desktop or Neo4j Aura for a real development project. The Sandbox is intended as a temporary environment or for learning about the features of Neo4j as well as specific graph use-cases.
You create a Sandbox by creating an account at the Neo4j Sandbox site.
Here is a video that shows how to create a Neo4j Sandbox account and a Neo4j Sandbox instance:
Neo4j Desktop is intended for developers who want to develop a Neo4j application and test it on their local machine. It is free to use. Neo4j Desktop is a UI that enables you to create projects, each with their own Neo4j DBMS instances where you can easily add or remove graph applications and libraries for use with your Neo4j DBMS. It includes an application called Neo4j Browser which is the UI you use to access the started database using Cypher queries.
The Neo4j Desktop runs on image::, Linux, and Windows. You can download it from our download page.
These videos show how to install and get started using Neo4j Desktop.
If using OS X
If using Linux
If using Windows
|Before you install on Windows, make sure you have the latest version of PowerShell installed.|
Graph applications provide specific functionality to users that make their roles as developers, administrators, data scientists, or data analysts easier. Some of them are Web browser-based and some run in their own JVM. Graph applications are written by Neo4j engineers or Neo4j community members. Many of the graph applications supported by Neo4j are the work of Neo4j Labs. Some graph applications are supported by Neo4j and some are not, so you must be aware of the type of support you can receive for a particular graph application. You typically install graph applications from your Neo4j Desktop environment from https://install.graphapp.io/.
Here are some Neo4j graph applications:
Here are some of the graph applications you can use:
- Neo4j Browser: UI for testing Cypher queries and visualizing the graph.
- Neo4j Bloom: A tool for exploring graphs and generating Cypher code.
- Neo4j ETL Tool: UI for connecting to a data source to import into the graph.
- Halin: Monitor your Neo4j DBMS.
- Query Log Analyzer: Analyze queries that executed on your system.
- Neo4j Cloud Tool: Tools for working with Neo4j Aura.
- Graph Algos Playground: Run graph algorithms and generate code for them.
Neo4j Browser is a Neo4j-supported tool that enables you to access a Neo4j Database by executing Cypher statements to create or update data in the graph and to query the graph to return data. The data returned is typically visualized as nodes and relationships in a graph, but can also be displayed as tables. In addition to executing Cypher statements, you can execute a number of system calls that are related to the database being accessed by the Browser. For example, you can retrieve the list of queries that are currently running in the server.
There are two ways that you can use Neo4j Browser functionality:
- UI started by Neo4j Desktop.
- Web browser interface.
Neo4j Browser is a graph application that comes with Neo4j Desktop. You typically use it to access a database that is running locally, but you can use it to access a remote database.
If you save your frequently-used Cypher code in favorites, you can download them so you can use them elsewhere (like in your application code).
You can use the Web interface to access to access a local Neo4j DBMS, or a database in Neo4j Aura or Neo4j Sandbox.
Just as in the Neo4j Browser application, you can save frequently-used Cypher code in favorites, then you can download them so you can use them elsewhere (like in your application code). In addition, when using the Web browser interface to Neo4j Browser, you can use Browser Sync to keep your favorites in the Cloud.
Follow along with this video to become familiar with common tasks in Neo4j Browser.
|Before you perform the tasks shown in this video, you must have either created and started the database in the Neo4j Desktop, created a Database in Neo4j Aura, or created a Neo4j Sandbox.|
Neo4j Bloom is a Neo4j-supported graph application where you can experience:
- Visual presentation of your graph data tangibly reveals non-obvious connections.
- Easy-to-understand visualizations explain data connectedness to every colleague.
- Codeless search tools let you quickly explore your data without technical expertise.
- Browsing tools make it easy for you to discover new insights from your data.
Another way that you can try Neo4j Bloom is to create a Neo4j Bloom Sandbox that you can use for up to 10 days.
cypher-shell is part of the Neo4j installation and is located in the bin directory.
It is a command-line tool that you can use to connect to a Neo4j DBMS instance and run Cypher statements against the database.
It is useful if you want to create scripts that automatically run against the database(s). It is commonly used for advanced query tuning.
Even if you have not installed Neo4j, you can download and install cypher-shell as a stand-alone application if you want to connect to a running database and execute Cypher queries.
Just as there are graph applications written by Neo4j engineers and Neo4j community members, there are libraries you can incorporate into your application. A library is also called a plug-in as it is used to extend what you can do in Cypher. Some libraries are available in Neo4j Desktop, while you must download and install other libraries.
In early 2020, some functions and procedures from the Graph Algorithms Library will be officially supported by Neo4j as the Graph Data Science Library (GDS). Before that, support for this library has come from and will continue to come from Neo4j Labs for the algorithms that are not officially supported by Neo4j.
One of the most popular libraries that is used by most developers is Awesome Procedures of Cypher (APOC). This library has close to 500 procedures and functions that extend Cypher in ways that make your programming in Cypher much easier for complex tasks. Since APOC is so widely-used by developers, it comes already-installed in a Neo4j Sandbox and Neo4j Aura.
Another library that also comes with Neo4j Desktop is GraphQL. GraphQL is an open-source query language for querying parts of a graph. It is not as flexible or powerful as Cypher, but it is used by some applications.
A very popular library for graph visualization is neoviz.js, another project of Neo4j Labs.
Here are the plugins that come with Neo4j Desktop:
Here are some drivers that Neo4j supports:
Because Neo4j is open source, you can delve into the details of how the Neo4j Database is accessed, but most developers simply use Neo4j without needing a deeper understanding of the underlying code. Neo4j provides a full stack that implements all levels of access to the database and clustering layer where you can use our published APIs. The language used for querying the Neo4j database is Cypher, an open source language.
It is also possible for you to develop your own server-side extensions in Java that access the data in the database directly without using Cypher. The Neo4j community has developed drivers for a number of languages including Ruby, PHP, and R.
You can also extend the functionality of Neo4j by creating user defined functions and procedures that are callable from Cypher.
Neo4j has integrations with many systems in the IOT ecosystem. Neo4j can be part of a system that uses GRANDstack, Kettle, Docker, and many others. How you integrate Neo4j into a larger system will depend on how you intend to use Neo4j. Neo4j engineers and Community members have worked through some of the challenges of integration and their discussions and work can be found on the Neo4j User slack channel, the Neo4j online forum, stack overflow, and on Github.
One Neo4j-supported integration that you can download enables data to be streamed to/from Kafka.
Developers and administrators use command-line tools for managing the Neo4j DBMS. The three main tools used that are part of the Neo4j installation (located in the bin directory) include:
Create, start, stop, and drop a particular database as well as query the “user” database.
Start, stop and retrieve the status of the Neo4j DBMS instance.
Create, copy, remove, backup, restore and perform other administrative tasks.
|In Neo4j Desktop which is used by developers, you have the create, start, and stop administrative functionality.|
What are some of the benefits provided by the Neo4j DBMS?
Select the correct answers.
- Index-free adjacency
- Optimized graph engine
What libraries are available in Neo4j Desktop for developing your application?
Select the correct answers.
- Graph Algorithms
You should now be able to:
- Describe the components and benefits of the Neo4j Graph Platform.