By   June 19, 2016

Neo4j – An Introduction

A graph database allows data to be saved in terms of nodes and edges and their properties. This type of database suits the business cases where entities and their relationships defines the whole concept. They are faster to query too. In addition to storing data as nodes and relationships, they provide extra-ordinary query and visualization tool using non-sql query languages. So in that way, it can be regarded as a NoSQL database.

Neo4J is a graph analytics tool capable of analyzing extremely complex graph networks. The data stored as graphs can be queried using CYPHER.

Where to get Neo4J from?

Neo4J can be directly downloaded from neo4j.com.

Neo4J download

Neo4J download

There are a number of releases available for different platforms. Since I am running it on Mac, I am getting a Mac version. After downloading the dmg file, we can simply drop it to the application folder to install it like regular Mac apps.

There is a free community edition available which I found very useful for my studies but there is also an enterprise edition available for business customers. There is also a free trial for the enterprise edition.

Running Neo4J

On windows platform, Neo4J can run as a console application. It can also run as a windows service. The web server runs on port 7474 by default.

neo4j server launch

After running the server, you can simply launch the default client. It is a browser based application which can just be launched by clicking the link available on the server window above.

neo4j browser client

Learning Cypher

A very good introduction to CYPHER syntax is available on neo4j’s website. Please refer to the following:

learn_cypher

Importing Data to Neo4j

Let’s import some data. Here we have a simpleton comma separated file with data for an institute. It lists student and their course assignments.

Let’s use the following command to load data into Neo4j and hit execute.

If all data is loaded successfully, you should see the following view:

Data_Import

The data can be queried using match command in cypher. Here we are returning all students and courses with their relationships:

The result is provided both in text and visual format in different tabs. Here is how the data is provided in terms of nodes and their relationships.

data - graph view