ot-node icon indicating copy to clipboard operation
ot-node copied to clipboard

Blazegraph setup instructions

Open NZT48 opened this issue 2 years ago • 2 comments

As an extension to the @origin_trail v6 data layer, we are introducing support for Blazegraph! Blazegraph is the second out of many triple stores to be integrated and supported by OriginTrail v6, after the initial integration with Ontotext GraphDB.

Following the OriginTrail development principle of #neutrality, this opens up doors for further integrations with the likes of Amazon Neptune, Stardog and other great graph solutions out there.

If you want your nodes to automatically start using Blazegraph from the new release (beta 1.23), you should follow these instructions.

Installation

Download Blazegraph on Ubuntu machine:

wget https://github.com/blazegraph/database/releases/download/BLAZEGRAPH_2_1_6_RC/blazegraph.deb

Install Blazegraph:

dpkg -i blazegraph.deb

Start Blazegraph:

systemctl start blazegraph

To verify that Blazegraph is running you can use next command:

systemctl status blazegraph

Testing

Now that you have running Blazegraph you can test it out to and if everything works fine, you OT-Node v6 will automatically connect to Blazegraph after beta 1.23.

Create a testTriples.nq file and place these triples in it:

<did:dkg:95b5b8929e92859f40d1d8d3729080a3eb9721537e0e18bc64758b0bc972c473> <http://schema.org/hasKeyword> "default" .
<did:dkg:95b5b8929e92859f40d1d8d3729080a3eb9721537e0e18bc64758b0bc972c473> <http://schema.org/hasKeyword> "scientist" .
<did:dkg:95b5b8929e92859f40d1d8d3729080a3eb9721537e0e18bc64758b0bc972c473> <http://schema.org/hasRootHash> "74f701ee49af0976f58c7cf9cc690f7a456b25b21e81761f70f290c8ee85bafc" .
<did:dkg:95b5b8929e92859f40d1d8d3729080a3eb9721537e0e18bc64758b0bc972c473> <http://schema.org/hasBlockchain> "polygon::testnet" .

Upload the file to Blazegraph:

curl -X POST -H 'Content-Type:text/x-nquads' --data-binary '@testTriples.nq' http://localhost:9999/blazegraph/sparql

Query the Blazegraph to see uploaded triples:

curl -X POST http://localhost:9999/blazegraph/sparql --data-urlencode 'query=SELECT * { ?s ?p ?o } LIMIT 4' -H 'Accept:application/rdf'

Final step, to get you OT-Node v6 ready to automatically switch to Blazegraph, you need to add lines with parameters for implementation name and url of graph database (in this case Blazegraph) to your .origintrail_noderc file :

"implementation": "Blazegraph",
"url": "http://localhost:9999/blazegraph",

At the end your .origintrail_noderc will be similar to this one:

{
  "blockchain":[
    {
      "blockchainTitle": "Polygon",
      "networkId": "polygon::testnet",
      "rpcEndpoints": ["https://rpc-mumbai.maticvigil.com/"],
      "publicKey": "...",
      "privateKey": "..."
    }
  ],
  "graphDatabase": {
    "implementation": "Blazegraph",
    "url": "http://localhost:9999/blazegraph",
    "username": "admin",
    "password": ""
  },
  "logLevel": "trace",
  "rpcPort": 8900,
  "network": {
  },
  "ipWhitelist": [
  "::1",
    "127.0.0.1"
  ]
}

Your Blazegraph is ready and OT-Node v6 will start using it after the new 1.23 release!

#TraceOn

NZT48 avatar Feb 10 '22 17:02 NZT48

DKG v6 beta.1.23 is now live on the network. If you want your node to switch to Blazegraph, after performing steps above, run next command to restart your node:

systemctl restart otnode

NZT48 avatar Feb 11 '22 15:02 NZT48

Alternatively, for non-Debian-based Linux distros, you can run: wget https://github.com/blazegraph/database/releases/download/BLAZEGRAPH_2_1_6_RC/blazegraph.jar

and start the following service: #/lib/systemd/system/blazegraph.service

[Unit] Description=blazegraph - OriginTrail V6 Stage 1 Beta Node Documentation=https://github.com/OriginTrail/ot-node After=network.target

[Service] Type=simple User=root WorkingDirectory=/root/ ExecStart=/bin/java -server -Xmx4g -jar /root/blazegraph.jar Restart=on-failure

[Install] WantedBy=multi-user.target

Valcyclovir avatar Feb 13 '22 15:02 Valcyclovir