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
  • Schema
  • The contract
  1. Contract Open Standard
  2. Publication

Content

Last updated 2 years ago

The Content contract allows a user to publish content openly on the Relation Protocol. Users can share articles, pictures, videos, and more with it. Meanwhile, it is based on blockchain technology, so the content published is immutable and traceable.

With the PublicContent contract, users can publish and read their own contents. They can also comment and like the contents generated by other users.

Schema

The of a content to be published is saved to Arweave in the form of a ttl file. The transaction hash will serve as a schemaURI to be passed as a parameter when initializing the contract. The following is an example:

ar://HENWTh3esXyAeLe1Yg_BrBOHhW-CcDQoU5inaAx-yNs

A schema consists of the following three parts:

  • The list of prefixes.

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#>
  • Class

Soul is used to represent an address entity.

:Soul a rdfs:Class ;
    rdfs:label "Soul" ;
    rdfs:comment "A soul." .
  • Predicate

The predicate p:publicContent describes the content to be published.

p:publicContent a rdf:Property ;
    rdfs:label "publicContent" ;
    rdfs:comment "The public content." ;
    rdfs:domain :Soul ;
    rdfs:range xsd:string .

The contract

interface IContent is ISemanticSBT {
    
    /**
     * Post a content.
     * @param content  The content should be the hash on arweave. The actual encrypted content and authorization records are stored on arweave.
     */
    function post(string memory content) external;
    
    /**
     * View the hash on arweave corresponding to the token.
     * @param tokenId
     * @return content 
     */
    function contentOf(uint256 tokenId) external view returns (string memory);
}

The content uploaded to Arweave is structured as follows:

{
  "content": {
    "body": "${The body of content}",
    "title": "${The title of content}"
  }
}

Full source code:

schema
Content