# schema存储

由于schema作为数据模型的声明列表，其存储的数据大小是未知的。考虑到当数据过大时存储到EVM链上可能带来的gas过高以及gas limit超过限制的问题，我们没有选择EVM链存储schema。

同时在Relation Protocol中，要求schema与使用该schema的智能合约数据声明保持一致，即合约初始化后，对应的schema不能改动。

为此，我们将schema存储在分布式存储系统中，在主流的分布式存储系统中，[Arweave](https://www.arweave.org/)相比较[IPFS](https://ipfs.tech/)有以下优势：

* 持久性：Arweave 的数据永久存储，而 IPFS 的数据只有在被主动保留的情况下才会存储。在 IPFS 中，如果没有节点保存特定文件，则文件可能会被删除。这意味着在 Arweave 上存储的数据更加安全和可靠。
* 可访问性：Arweave 上的数据可以通过永久链接直接访问，而不需要访问特定节点。而在 IPFS 中，您需要知道存储文件的节点的地址才能访问文件。这使得 Arweave 在保证数据可访问性方面具有优势。

综合以上因素，我们将schema源数据存储在Arweave上，交易哈希作为schemaURI，在合约初始化时传入，后续不再允许修改。

如果合约实现了Semantic SBT规范里的ISemanticRDFSchema接口，可以通过schemaURI查询到schema地址

```solidity
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);
}
```


---

# 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/schema-standard/store-schema.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.
