Add /characters endpoint listing all Wikidata-linked characters#375
Open
cmil wants to merge 5 commits into
Open
Add /characters endpoint listing all Wikidata-linked characters#375cmil wants to merge 5 commits into
cmil wants to merge 5 commits into
Conversation
3c16ddd to
e8be7b8
Compare
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.
e8be7b8 to
275de56
Compare
`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.
6a16cad to
ec59b21
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Reuses dutil:get-character-wikidata-id (idno-first,
@anafallback) and dutil:get-plays-with-character, so both the canonical encoding and the deprecated@anaform are covered without duplication.Note that I have named the endpoint
/charactersinstead of/character/allfor several reasons. The plural is more in line with other endpoints, e.g./corporaor.../plays/..../character/allwould have been an odd mixture of singular and plural. A special case path segmentallthat is not a Wikidata ID, while not unusual, feels a bit ugly and unnecessary in this case.