JSON-LD / RDF support
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 1.2k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 21
Description
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
Persontype from Schema.org (https://schema.org/Person) as it integrates with the rest of the Schema.org ontology - for example, theCreativeWork.characterproperty takes aPersonas its value to represent a character within a creative work. However, the Comic Book Ontology also provides a dedicatedCharactertype (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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository files, tests, or entry points. Start by tracing how the API handles Accept headers and response formats, then determine the JSON-LD representation and ontology scope. Done would require an agreed implementation plan and support for the requested JSON-LD form.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100