# EIP-6239

每个合约必须实现`ISemanticSBT`接口

* 在有新的SBT产生的时候，需要发出`CreateRDF`事件
* 在更新已有SBT的RDF的时候，需要发出`UpdateRDF`事件
* 在销毁SBT的时候，需要发出`RemoveRDF`事件
* 合约需要提供`rdfOf`方法

```solidity
interface ISemanticSBT{
    /**
     * @dev This emits when minting a Semantic Soulbound Token.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfStatements The RDF statements for the Semantic Soulbound Token. An RDF statement is the statement made by an RDF triple.
     */
    event CreateRDF (
        uint256 indexed tokenId,
        string  rdfStatements
    );
    /**
     * @dev This emits when updating the RDF data of Semantic Soulbound Token. RDF data is a collection of RDF statements that are used to represent information about resources.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfStatements The RDF statements for the semantic soulbound token. An RDF statement is the statement made by an RDF triple.
     */
    event UpdateRDF (
        uint256 indexed tokenId,
        string  rdfStatements
    );
/**
     * @dev This emits when burning or revoking Semantic Soulbound Token.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfStatements The RDF statements for the Semantic Soulbound Token. An RDF statement is the statement made by an RDF triple.
     */
    event RemoveRDF (
        uint256 indexed tokenId,
        string  rdfStatements
    );
    /**
     * @dev Returns the RDF statements of the Semantic Soulbound Token. An RDF statement is the statement made by an RDF triple.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     */
    function rdfOf(uint256 tokenId) external view returns (string memory);
}
```

可以选择性的实现`ISemanticRDFSchema`接口，用于获取描述RDF数据的Schema URI。

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

可以选择性的实现`ISemanticSBTUpdate`接口，用于更新SBT的RDF数据

```Solidity
interface ISemanticSBTUpdate{
    /**
     * @notice Update the RDF data for Semantic Soulbound Token. Implementors can assign updaters as needed, for example, the token issuer.
     * @dev Emits the `UpdateRDF` event.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfData RDF data is a collection of RDF statements that are used to represent information about resources.
     */
    function updateRDF(uint256 tokenId, RDFData memory rdfData) external;
}
```

可以选择性的实现`ISemanticSBTPrivacy`接口

```solidity
interface ISemanticSBTPrivacy is ISemanticSBT {
    /**
     * @dev Returns if the `viewer` is allowed to view the `tokenId` .
     * @param viewer The viewer address
     * @param tokenId The token Id
     */
    function isViewerOf(address viewer, uint256 tokenId) external view returns (bool);
}
```


---

# 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/open-standard-api/eip6239.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.
