Developer Hub
Relation ProtocolRelation ONE APIRelation Graph API
English
English
  • Overview
  • QUICK START
    • Deploy a Semantic SBT contract leveraging Relation Protocol
    • Deploying query services using Graph Indexer
  • KEY CONCEPTS
    • RDF
    • Semantic SBTs
    • Social Graph
  • Architecture
  • Schema Standard
    • Overview
    • How schemas limit smart contracts
    • Store schema
    • List of schemas
  • Contract Open Standard
    • Overview
    • Identity
      • Name Service
    • Relationship
      • Follow
      • Dao
    • Publication
      • Content
      • Privacy Content
  • Open Standard API
    • Introduction
    • EIP-6239
    • Business Interface
      • Identity
      • Relationship
      • Publication
  • Graph Indexer
    • Definition and usage
    • Listen to events
    • To parse RDF data
    • To build a social graph
  • Integrations
    • Quick start
    • Construct a social graph with Relation Protocol
    • List of resources
    • NameService contract guide
    • Follow contract guide
    • Dao contract guide
    • Content contract guide
    • PrivacyContent contract guide
  • Relation Name Service
    • Name Service Api
  • Use Case
  • APPENDIX
    • Deploy a contract using Hardhat
    • SemanticSBT Deployment tool
Powered by GitBook
On this page
  • Data filtering
  • Procedures for parsing
  1. Graph Indexer

To parse RDF data

Last updated 1 year ago

The last chapter introduced how to acquire RDF data from the blockchain. This chapter will show how to parse these RDF data.

Data filtering

covers a lot more ground than the Relation Protocol does. So, we will filter the events shown in the last chapter.

Graph Indexer will parse the RDF data conforming to .

This is to say that the address returned by the contract's schemaURI() method must exist in for it to be parsed by the Graph Indexer.

In the , the process to acquire a Schema is defined:

interface ISemanticRDFSchema {
	/**
 	* @notice Get the URI of schema for this contract.
 	* @return The URI of the contract which points to a configuration profile.
 	*/
	function schemaURI() external view returns (string memory);
}

Procedures for parsing

Acquire the prefix definition from :

PREFIX : <http://relationlabs.ai/entity/>
PREFIX p: <http://relationlabs.ai/property/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

Put it together with the RDF data parsed from Event:

:Soul_0x0109c8ee3151bde7b6b5d9f37e9d2c4bc16930fe p:following :Soul_0x6247123ec0fe0d25feb811e3c4d4a760c1f2e63e .

We now have a complete RDF:

PREFIX : <http://relationlabs.ai/entity/>
PREFIX p: <http://relationlabs.ai/property/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

:Soul_0x0109c8ee3151bde7b6b5d9f37e9d2c4bc16930fe a :Soul;
p:name "Alice" .

:Soul_0x6247123ec0fe0d25feb811e3c4d4a760c1f2e63e a :Soul;
p:name "Bob" .

:Soul_0x0109c8ee3151bde7b6b5d9f37e9d2c4bc16930fe p:following :Soul_0x6247123ec0fe0d25feb811e3c4d4a760c1f2e63e .
EIP6239
Schema specification
Schema specification
EIP6239 specification
Schema