Skip to content

Add /characters endpoint listing all Wikidata-linked characters#375

Open
cmil wants to merge 5 commits into
mainfrom
161-characters-endpoint
Open

Add /characters endpoint listing all Wikidata-linked characters#375
cmil wants to merge 5 commits into
mainfrom
161-characters-endpoint

Conversation

@cmil

@cmil cmil commented Jul 5, 2026

Copy link
Copy Markdown
Member

Resolves #161. The endpoint returns all characters that have an assigned Wikidata ID across all corpora, grouped by QID and sorted by play count descending, to make ranking easy.

Each entry has:

  • id: Wikidata ID
  • count: number of plays containing the character
  • plays: array of PlayWithWikidataCharacter (id, uri, title, authors, characterName) — same shape as /character/{id}

Reuses dutil:get-character-wikidata-id (idno-first, @ana fallback) and dutil:get-plays-with-character, so both the canonical encoding and the deprecated @ana form are covered without duplication.

Note that I have named the endpoint /characters instead of /character/all for several reasons. The plural is more in line with other endpoints, e.g. /corpora or .../plays/.... /character/all would have been an odd mixture of singular and plural. A special case path segment all that is not a Wikidata ID, while not unusual, feels a bit ugly and unnecessary in this case.

@cmil cmil force-pushed the 161-characters-endpoint branch from 3c16ddd to e8be7b8 Compare July 5, 2026 20:42
Implements #161. The endpoint returns all characters that have an
assigned Wikidata ID across all corpora, grouped by Q-number and
sorted by play count descending, to make ranking easy.

Each entry has:
- id: Wikidata Q-number
- count: number of plays containing the character
- plays: array of PlayWithWikidataCharacter (id, uri, title, authors,
  characterName) — same shape as /character/{id}

Reuses dutil:get-character-wikidata-id (idno-first, @ana fallback), so both the canonical <idno type="wikidata">
encoding and the deprecated @ana form are covered without duplication.
@cmil cmil force-pushed the 161-characters-endpoint branch from e8be7b8 to 275de56 Compare July 5, 2026 21:31
cmil added 4 commits July 6, 2026 18:13
`personGrp` has a `name` child, not a `persName` which needs to
be included in the query.
and remove the hint to the deprecated `@ana` fallback. Thus we
don't make any promises for `@ana` at least in this endpoint and
may drop support before a new major version.
@cmil cmil force-pushed the 161-characters-endpoint branch from 6a16cad to ec59b21 Compare July 6, 2026 16:18
@cmil cmil added this to the 1.4.0 milestone Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New API function /character/all

1 participant