Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

JSON-LD / RDF support

未关闭
#1,483 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
冷清

调研方向

该 issue 未指明仓库文件、测试或入口点。首先追踪 API 如何处理 Accept 标头和响应格式,然后确定 JSON-LD 表示形式以及本体范围。完成的要求是形成一致认可的实现计划,并支持所请求的 JSON-LD 形式。

由索引模型根据 Issue 内容生成。

描述

I think it would be valuable to be able to use a PokéAPI endpoint as a canonical URL within RDF linked data, so other RDF documents can refer to Pokémon concepts. For example, someone could make character bios using JSON-LD that look like:

{
  "@context": {
    "@vocab": "https://schema.org/",
    "pkmn": "https://pokemonkg.org/ontology/version/1.0.0"
  },
  "@id": "<...>",
  "@type": "Person",
  "name": "Meowth",
  "description": "Team Rocket's Meowth",
  "url": "https://bulbapedia.bulbagarden.net/wiki/Meowth_(Team_Rocket)",
  "pkmn:species": { "@id": "https://pokeapi.co/api/v2/pokemon-species/meowth" },
  "gender": { "@id": "https://schema.org/Male" },
  "memberOf": {
    "@type": "Organization",
    "name": "Team Rocket",
    "url": "https://bulbapedia.bulbagarden.net/wiki/Team_Rocket"
  },
  "knows": {
    "@id": "<...>",
    "@type": "Person",
    "name": "Meowzie",
    "url": "https://bulbapedia.bulbagarden.net/wiki/Meowzie",
    "pkmn:species": { "@id": "https://pokeapi.co/api/v2/pokemon-species/meowth" },
    "gender": { "@id": "https://schema.org/Female" }
  }
}

This would be very useful for creating original characters in a somewhat-standard machine-readable format, e.g. for use in TTRPG campaigns.

Some notes:

  • There is a readily available Pokémon ontology for RDF, but we could extend it or make our own for PokéAPI if it doesn't have all the features we need.
  • In the example above, I used the Person type from Schema.org (https://schema.org/Person) as it integrates with the rest of the Schema.org ontology - for example, the CreativeWork.character property takes a Person as its value to represent a character within a creative work. However, the Comic Book Ontology also provides a dedicated Character type (https://comicmeta.org/cbo/#Character).

Similar to MusicBrainz, a client could request the JSON-LD for a Pokémon concept by modifying its HTTP request in the following form:

GET /api/v2/pokemon-species/meowth HTTP/2
Host: pokeapi.co
Accept: application/ld+json

or alternatively append ?format=json-ld to the resource URL.

主要语言
Python
星标
5.4k
派生
1.2k
平均合并
2 天 4 小时
30 天内合并 PR
18

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PokeAPI/pokeapi 的其他 Issue

查看 PokeAPI/pokeapi 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。