# Content

Content合约允许用户在Relation Protocol网络上发布公共内容。用户可以通过此合约在网络上分享文章、图片、视频等多种类型的内容。同时，由于该合约基于区块链技术，因此其发布的内容具有不可篡改和可追溯的特点，保证了内容的可信度和可靠性。

在PublicContent合约中，用户可以发布内容、查看已发布的内容、评论和点赞其他用户的内容等。

## Schema

内容发布的[schema](https://arweave.net/HENWTh3esXyAeLe1Yg_BrBOHhW-CcDQoU5inaAx-yNs) 以ttl文件的形式保存至Arweave，交易哈希将作为schemaURI，在初始化合约时传入，参数示例：

```
ar://HENWTh3esXyAeLe1Yg_BrBOHhW-CcDQoU5inaAx-yNs
```

schema由以下三部分组成：

* schema 前缀列表

```
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用于表示地址实体

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

* Predicate

谓词p:publicContent表述发布的内容

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

## 合约

```solidity
interface IContent is ISemanticSBT {
    /**
     * 发布内容
     * @param content 发布的内容对应的Arweave交易哈希，可通过此交易哈希访问到原始发布内容
     */
    function post(string memory content) external;
    /**
     * 查询发布内容
     * @param tokenId
     * @return content 发布的内容对应的Arweave交易哈希，可通过此交易哈希访问到原始发布内容
     */
    function contentOf(uint256 tokenId) external view returns (string memory);
}
```

上传至Arweave的内容格式定义如下：

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

完整的合约代码可访问：

* [Content](https://github.com/relationlabs/semanticSBT/blob/main/contracts/template/Content.sol)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://relationlabs.gitbook.io/protocol/protocol-zh/contract-open-standard/publication/content.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
