To build a social graph
This protocol supports all graph databases conforming to the RDF specification.
We can have a simple social graph by importing the RDF data constructed from the last chapter.

To use Neptune
Amazon Neptune is a fast and scalable graph database service. It can efficiently store and navigate highly interconnected data. Its query processing engine is optimized for leading graph query languages such as Apache TinkerPopâ„¢ Gremlin and W3C's RDF SPARQL. Neptune provides high performance via these open graph frameworks and standard APIs.
With Amazon Neptune we can build a social graph using users' behavioral data on the blockchain.
Steps:
Launch a Neptune instance via the aws console.
Composite the sparql constructed from the last chapter into an "insert" command in Neptune:
Call the Neptune service interface to save RDF:
By now we have indexed the data Alice follow Bob into the graph database. We can query the data via the Neptune service interface:
To use Jena
For demonstration purposes, we will use docker to launch a Jena service:
If successful, please visit http://localhost:3030/ using the account "admin" and password "pw123".
First please create a dataset:


Then import the data from the last step into the graph database.


Finally, switch to the Query tag to query which people Alice has followed:


The query result is : Alice's address 0x0109c8ee3151bde7b6b5d9f37e9d2c4bc16930fe followed Bob's address 0x6247123ec0fe0d25feb811e3c4d4a760c1f2e63e.
To use Neo4j
For demonstration purposes, we will use docker to launch a Neo4j service:
Install plugins to support RDF
Configure Plugin
Open file: conf/neo4j.conf and append dbms.unmanaged_extension_classes=n10s.endpoint=/rdf.
then restart Neo4j Service:
Open Neo4j Browser: http://localhost:7474/browser/ Default login is username 'neo4j' and password 'neo4j'.
Configure Graph
Execute the following commands in the Neo4j browser input box:
Importing RDF Data
Execute the following commands in the Neo4j browser input box:
Querying
Execute the following commands in the Neo4j browser input box:

Last updated