Deploying query services using Graph Indexer

Here we will introduce how to quickly build a graph-indexer.

Prepare the environment

  1. Install JDK(Requires JDK11 and above)

brew install openjdk@11

Check the installation:

java -version
  1. Install nodejs

To complete this tutorial successfully, you must have Node.js installed on your machine.

  • Install Node.js with NVM

Install jena-fuseki

Install and run:

wget  https://dlcdn.apache.org/jena/binaries/apache-jena-fuseki-4.7.0.tar.gz
tar xvf apache-jena-fuseki-4.7.0.tar.gz
cd apache-jena-fuseki-4.7.0
sh fuseki-server

Create a dataset

You can access http://localhost:3030, and create a demo dataset(Figure 1-1, Figure 1-2)

Figure 1-1 Add a dataset
Figure 1-2 Create demo dataset

A simple Graph Indexer

Here, we will use Node.js to accomplish this process.

This example will listen to RDF data on the Mumbai network, between blocks 32362681 and 32362699.

  1. Create a new project and install the ethers (v5), axios, and qs.

  1. Create an app.js file with the following content:

  1. Run the Graph Indexer

After the data has been inserted, it can be queried at http://localhost:3030/#/dataset/demo/query.

Figure 1-3 Query results using SPARQL

Last updated