● Accept the license agreement and go forward to install. After successful installation, a shortcut to Neo4j will be available on the start menu.

neo4-screen4

(Fig 5: Changing the database location)

● The database location may be changed in the installation wizard. Once complete, start the server.

(Fig 6: Screenshot – Neo4j is ready for use via http://localhost:7474/)

● The default database directory is populated and it can be seen in the chosen location.
● You may start working on Neo4j via http://localhost:7474/
● Log in to Neo4j server using the default password ‘admin’.

 

fig 7

(Fig 7: Neo4j Community Edition after installation and ready to use)

How to Setup Neo4j as an admin console application


Download the required Neo4j zip file via https://neo4j.com/download/other-releases/ and select the compatible version for your operating system.
● Extract the zip file and go to Bin Directory.

fig 8

(Fig 8: Extract the downloaded zip file and go to the Bin Directory)

● Through the admin console go to the Bin Directory and start the server using the command ‘neo4j console’.

 

fig 9

(Fig 9: Starting Neo4j Server using the command ‘etc\bin>neo4j console’)

How to Setup Neo4j as a windows service

● Extract the zip file
● Using admin console start Neo4j as Neo4j service
● Go to the Bin folder and execute the commands (neo4j install-service -> neo4j start).

How to Setup Neo4j in Ubuntu

● Go to root mode in terminal
●Then add the repository key to keychain
●# wget -no-check-certificate -O – https://debian.neo4j.org/neotechnology.gpg.key | apt-key add –
●Then add the repository to the list of apt sources
●# echo ‘deb http://debian.neo4j.org/repo stable/’ >/etc/apt/sources.list.d/neo4j.list
●Finally update the repository information and install Neo4j
●# apt update
●# apt install neo4j
●# The server should have started automatically and should also be restarted at boot. If necessary the server can be stopped with – # service neo4j stop
●And to start – # service neo4j start
●Now it is possible to access the database server via http://localhost:7474/browser/

Understanding the main building blocks of Neo4j

fig 10

(Fig 10: A node representing a record on Neo4j Graph Database)

Node: Nodes are the fundamental units of Graph Databases. Each Node contains properties as key value pairs. An example is given below and the Node ‘Employee’ contains the following properties (empId : 1, name: Namal, age: 35) as key value pairs.

Relationship: The links between Nodes are called ‘Edges’ or ‘Relationships’ and are fundamental building blocks of Graph Databases. The ‘Relationship’ connects two nodes or even can be the same node in recursive relationships. The ‘Relationship’ may have properties as key value pairs, similar to how it is done in associative entities in the ‘many-to-many’ relationship.

An example is given below:

fig 11

(Fig 11: A relationship with properties, between ‘employee’ and ‘Project’ nodes)

Here, we find an additional property for ‘EMP_WORKS_FOR_PRO’ as ‘workHour’, which is specific for relationships between each ‘Employee’ Node and ‘Project’ Node since each employee can work on many projects, and each project can have many employees.
Important: In addition to the above there is an auto incremented id number as ‘id’ for each and every Nodes and Relationships, which is an auto generated unique number according to the Node or Relationship by Neo4j.
Labels: Labels associate a common name to a set of Nodes or Relationships. A Nodes or Relationship can contain one or more Labels. We can create new Labels to existing Nodes or Relationships. We may also remove the existing Labels from the existing Nodes or Relationships.

Database Information

Clicking on the top left ‘database’ icon reveals database information. It will display brief information about the Node labels, Relationships, Keys, and how many Nodes and Relationships there are.

fig 12

(Fig 12: Database information can be viewed by clicking on the top left ‘database’ icon)

Neo4j Data Browser

The Neo4j data browser can be accessed via ‘http://localhost:7474/browser/’. It is used to execute CQL commands and view outputs. The top of the interface displays the CQL editor with a ‘$’ sign. Using the ‘enter’ key, press or execute button, queries can be executed and the results will be displayed in the UI view located below the editor.

 

fig 13


(Fig 13: CQL command console on Neo4j)

● The ‘Rows’ view displays properties for selected type of Nodes.

fig 14


(Fig 14: The ‘Rows’ view displays properties for selected types of nodes)

●The ‘Text’ view displays the text structure of Nodes.

fig 15


(Fig 15: The ‘Text’ mode displays text structure of nodes)

●The ‘Code’ view shows full json which is generated by query via bolt connection. Json generates the graph.

fig 16


(Fig 16: ‘Code’ view displays full json code generated by query via bolt connection. This bit of json generates the graph)

Quick controls

The top right set of buttons in ‘view’ mode helps to enable the Fullscreen, Collapse, Cancel and Export options. Query results may also be exported as CSV, json or other given formats.

Colour coding your Nodes

Node colours and sizes can be changed by clicking on Node name on top of the view panel.

fig 17


(Fig 17: Colour coding and resizing nodes)