| --- |
| license: apache-2.0 |
| pretty_name: 2009scape wiki knowledge base |
| language: |
| - en |
| tags: |
| - 2009scape |
| - runescape |
| - knowledge-graph |
| - sqlite |
| - mcp |
| size_categories: |
| - 10K<n<100K |
| viewer: false |
| --- |
| |
| # 2009scape wiki knowledge base |
|
|
| The built dataset behind |
| [2009scape-wiki-api](https://github.com/arsalan-anwari/2009scape-wiki-api): the raw |
| 2009scape game sources (items, NPCs, shops, drop tables, quests) turned into one |
| immutable, searchable SQLite file, served over an HTTP JSON API and an MCP server. |
|
|
| Nothing here is edited by hand. Every release is written by that repository's pipeline |
| and uploaded whole, so a given `data_version` is one file that can be served again |
| later. |
|
|
| > This project is a work in progress. Items, NPCs, shops, drop tables and quests are in. |
| > Locations, scenery and quest rewards are staged but nothing reads them yet, so the |
| > dataset has no answers about them. |
|
|
| ## What is in it |
|
|
| | file | what it holds | |
| | --- | --- | |
| | `knowledge.sqlite3` | the dataset a deployment serves | |
| | `tests/knowledge.sqlite3` | the hand made build the test suite uses | |
|
|
| Both files carry the same schema, so anything that reads one reads the other. |
|
|
| ## What a build holds |
|
|
| Counted from build `2026.08.07.122241`, which is the first one made from the whole game |
| rather than a sample of it: |
|
|
| | kind | rows | |
| | --- | --- | |
| | items | 11,990, of which 3,192 are noted and 220 bound | |
| | npcs | 8,033 | |
| | shops | 243 | |
| | quests | 150 | |
| | relationships | 58,504: 54,505 drops, 2,461 sells, 1,276 uses_ammunition, 262 staffed_by | |
| | prices | 797,362 daily values over 7,057 items, 2024-06-08 to 2026-08-01 | |
|
|
| Around 12,700 entities carry the examine text the game shows, and shop lines now carry |
| what the shop charges at full stock. |
|
|
| ## Reading it |
|
|
| ```python |
| import sqlite3 |
| from huggingface_hub import hf_hub_download |
| |
| path = hf_hub_download( |
| "arsalan-anwari/2009scape-wiki-api-data", |
| "knowledge.sqlite3", |
| repo_type="dataset", |
| ) |
| db = sqlite3.connect(f"file:{path}?mode=ro", uri=True) |
| print(dict(db.execute("select key, value from meta"))) |
| print(db.execute("select name from entity where type = 'item' limit 5").fetchall()) |
| ``` |
|
|
| The file is a plain SQLite database with an FTS5 index, so `sqlite3` on the command |
| line reads it too, and nothing in this repository has to be installed to look at it. |
|
|
| ## Schema |
|
|
| | table | what it holds | |
| | --- | --- | |
| | `entity` | one row per item, NPC, shop, quest or location, with its slug, description, icon, JSON attributes and where it came from | |
| | `edge` | one row per relationship between two entities: `drops`, `sells`, `staffed_by`, `rewards`, `uses_ammunition`, `located_in`, `part_of` | |
| | `entity_alias` | retired slugs, shorthand and alternate names, so a name that moved still resolves | |
| | `entity_fts` | the FTS5 index behind search and near name matching | |
| | `price_history` | daily Grand Exchange values per item, dated ISO-8601 | |
| | `meta` | which build this is | |
|
|
| The schema is wider than any build so far. A relationship or an entity kind the tables |
| allow is simply empty until a source is read for it. |
|
|
| Variants are recorded rather than dropped: a noted, bound, placeholder or duplicate row |
| points at its canonical entity through `canonical_id`, and `visibility` says whether a |
| row is published or hidden. A variant may only point at a real entity, and never at |
| another variant, so one hop always lands. Every row names its `source`, `source_file` |
| and `game_version`. |
|
|
| ## Which build this is |
|
|
| `meta` carries five keys, which is how a client tells builds apart: |
|
|
| | key | what it means | |
| | --- | --- | |
| | `data_version` | the build's identity, and what the API reports and caches against | |
| | `content_hash` | the hash of the content, equal for two builds that say the same thing | |
| | `schema_version` | the shape of the tables above | |
| | `game_version` | the game sources the build was made from | |
| | `built_at` | when it was written | |
|
|
| ## Where it comes from |
|
|
| Built from the 2009scape server's own configuration files, its code, its game cache, |
| Grand Exchange price snapshots, and a small set of hand written overlays. Each row says |
| which of those it came from in its `source` column. |
|
|
| The cache is the newest of them. The pipeline decodes it during staging, the same way |
| the game's own client does, so names, examine text, values, alchemy values, buy limits, |
| weights and the note and lend variants come from the game rather than from a guess. How |
| much of a cache may fail to decode is written down per source, and a build that goes |
| over its allowance stops instead of shipping a quieter dataset. |
|
|
| The pipeline and this card are Apache-2.0; the game data it derives from belongs to the |
| [2009scape](https://2009scape.org) project and is covered by that project's terms. |
|
|