How to build a Knowledge Graph : part-1

What is a Knowledge graph ?

A knowledge graph is typically built on top of the existing databases to link all data together at web-scale combining both structured information or unstructured. It describes the entities and their interrelations represent in a graph.

Components of Knowledge graph

There are three components to build a knowledge graph :

Graph database

A Graph database is a database designed to represent the relationships between data. The graph relates the data items in the store to a collection of nodes and edges, the edges representing the relationships between the nodes.

The above diagram represent a graph database where circle part represents nodes and the arrow represents the edges which provide relation between nodes.

For this project, we are using Neo4j as our graph database.

Loading Knowledge graph

This part covers modelling the data in a graphical way so that we can push the data to our graphical database.

Rest API

In this part, we will create Rest API to expose Knowledge graph data to apps and end users as JSON.

Part 1 : Getting started with Knowledge graph

In this part, we will learn how to install graph database. Here we will Neo4j as graph database in docker. We can also install graph database on our local system or in Amazon EC2 instance.


Docker is just like a virtual machine that make it easier to create, deploy, and run applications by using containers.

Installing docker into your local system :

brew cask install docker

After installing, we will run/start docker in our local system.


Neo4j as a Graph Database

Neo4j  is a popular graph database that provides results based on real-time data. In Neo4j, we can add or remove properties as per our requirement.

Installing Neo4j in docker :

docker run \
    --name testneo4j \
    -p7474:7474 -p7687:7687 \
    -d \
    -v $HOME/neo4j/data:/data \
    -v $HOME/neo4j/logs:/logs \
    -v $HOME/neo4j/import:/var/lib/neo4j/import \
    -v $HOME/neo4j/plugins:/plugins \
    --env NEO4J_AUTH=neo4j/test \ 

Note :  We are passing the user id and password to docker run command. Modify if required.

--env NEO4J_AUTH=neo4j/test \

After Installing Neo4j, our database is all ready to work . We will open neo4j in browser : http://localhost:7474/browser/

Hope you like this post, in the next post we will discussed how we extract information in a graphical way and push the data to our graphical database (Neo4j).

Code and instruction can be found here :


Leave a Reply

Your email address will not be published. Required fields are marked *