Schema.org 开发者指南

Schema.org 开发者指南

本页提供关于 Schema.org 的基本面向开发者的信息。特别是,它提供了我们模式的机器可读表示的访问。

机器可读术语定义

有各种方式访问 Schema.org 术语的机器可读定义。

  • 底层源文件都在我们的 GitHub 仓库 中可用。编辑工作以 Turtle 格式进行,并使用基于 RDF Schema 的方法定义。
  • 定期发布在 Schema.org 站点上,在 staging.schema.org 上暂存。相应的数据文件如下链接,也可在 GitHub 获取。
  • 单个术语的机器可读定义也可作为 JSON-LD 嵌入到术语页面 HTML 中。请注意,在许多情况下,将 schema.org 视为整体更有用。
  • FAQ 中所述,Schema.org URI 有时写为 ‘http’,有时写为 ‘https’。消费应用程序被鼓励接受两种表示,我们现在生成两种”风格”的下载以方便。在编辑工作”磁盘上”我们使用 ‘https’ 形式。然而,其他站点和应用程序可能使用 ‘http’,尤其是在 RDF 表示中。虽然我们鼓励转向 ‘https’,但请特别注意 Schema.org 的 JSON-LD 上下文文件使用 ‘http’,我们不太可能在没有长期警告期的情况下更改此设置,因为这会对已部署安装产生影响。欢迎对此提供反馈,例如在此 GitHub issue 中。
  • JSON-LD 上下文可从 https://schema.org/docs/jsonldcontext.json 获取。Schema.org 通常部署在 JSON-LD 1.0 中,但我们的上下文文件的位置通过 JSON-LD 1.1 约定作为 HTTP 链接头公开(命令行工具 ‘curl’ 可能有用,例如与 -I -i 参数一起使用)。无论上下文是使用 http 还是 https 检索,我们都提供相同的上下文描述。

词汇定义文件

为了协助开发者,包含当前版本 Schema.org 词汇定义的文件可下载为常见 RDF 格式。除了下面的链接,旧版本可在 GitHubdata/releases/ 下找到。

选择所需的文件和格式,然后点击下载。CSV 格式下载分为两个文件:Types 包括类型和枚举值的定义,包括关联属性的列表;Properties 包含属性定义。

文件 schemaorg-current-https 包含词汇中所有部分的术语定义。文件 schemaorg-all-https 包含词汇中所有部分的术语定义,加上从词汇中退出的术语(请参阅阁楼部分以获取详细信息)。

对于那些更喜欢使用基于 http 的 Schema.org 术语定义的人,这些等效定义可在 schemaorg-current-httpschemaorg-all-http 文件中获取。有关使用基于 https 或 http 的术语的更多信息,请参阅 FAQ 以获取详细信息。

文件 格式 对于
schemaorg-current-https JSON-LD -
schemaorg-current-https Turtle -
schemaorg-current-https Triples -
schemaorg-current-https Quads -
schemaorg-current-https RDF/XML -
schemaorg-current-https CSV Types
schemaorg-current-https CSV Properties
schemaorg-all-https JSON-LD -
schemaorg-all-https Turtle -
schemaorg-all-https Triples -
schemaorg-all-https Quads -
schemaorg-all-https RDF/XML -
schemaorg-all-https CSV Types
schemaorg-all-https CSV Properties
schemaorg-current-http JSON-LD -
schemaorg-current-http Turtle -
schemaorg-current-http Triples -
schemaorg-current-http Quads -
schemaorg-current-http RDF/XML -
schemaorg-current-http CSV Types
schemaorg-current-http CSV Properties
schemaorg-all-http JSON-LD -
schemaorg-all-http Turtle -
schemaorg-all-http Triples -
schemaorg-all-http Quads -
schemaorg-all-http RDF/XML -
schemaorg-all-http CSV Types
schemaorg-all-http CSV Properties

实验性

以下表示是实验性的,可能在未来版本中更改或移除。

D3 RDFS in JSON-LD

Schema.org 类型层次结构的简化,其中每个类型最多有一个超类型,以混合格式表示,该格式结合了 JSON-LD、RDFSD3tree.jsonld

此文件可用于支持使用 D3 JavaScript 库根据数据操作文档的开发者。它使用 JSON-LD 声明 D3 的默认”children”JSON 字段表示”subClassOf”关系,但以相反方向表达(示例用法)。

OWL

作为实验性功能,OWL 定义文件 schemaorg.owl 可用。它包括词汇的核心和所有当前扩展。

该文件的结构不同于上述词汇定义文件,因为 schema:domainIncludesschema:rangeIncludes 值使用 owl:unionOf 转换为 rdfs:domainrdfs:range 值,以捕获值的多样性。范围值中包括词汇中隐含的默认值 TextURLRole

此文件已提供,以在一些基于 OWL 的建模工具中表示词汇。映射到 OWL 是一个近似值,不应被视为 Schema.org 术语的权威定义;请参阅数据模型页面以获取详细信息。作为实验性功能,对任何第三方工具对其的解释没有期望。


Schema.org 开发者指南
https://www.gjxx.dev/schema/documents/developers/
作者
gjxx
发布于
2025年10月16日
许可协议