Repository navigation
Add the relation type to relatedAnime - #3
AkitoTheGambler wants to merge 4 commits into
Conversation
relatedAnime entries are now objects: {uri, relation}. relation is the metadata provider's own label and is omitted if the provider doesn't name it. The old string format can still be read.
There was a problem hiding this comment.
🟡 Changes recommended
Comma-separated ANN header relations lose labels after the first, dropping the “compilation of” relation for anime 26; the parser needs a fix and a regression assertion for the affected fixture.
1 open issue
What changed in this PR
Adds provider-specific relation labels to relatedAnime throughout the metadata pipeline. JSON output changes from URL strings to objects, while readers retain support for legacy strings.
Changes:
- Introduces
RelatedAnime, JSON adapters, and URI-based deduplication that prefers labelled entries. - Updates provider converters and shared extractors to capture relation labels.
- Adapts downstream processing, tests, fixtures, and generated documentation to the new format.
| File | Description |
|---|---|
| simkl/src/test/kotlin/io/github/manamiproject/modb/simkl/SimklAnimeConverterTest.kt | Asserts Simkl relation labels. |
| simkl/src/main/kotlin/io/github/manamiproject/modb/simkl/SimklAnimeConverter.kt | Extracts labels alongside related links. |
| serde/src/test/kotlin/io/github/manamiproject/modb/serde/TestingAssets.kt | Migrates serialization fixtures to objects. |
| myanimelist/src/test/kotlin/io/github/manamiproject/modb/myanimelist/MyanimelistAnimeConverterTest.kt | Asserts table and tile relation labels. |
| myanimelist/src/main/kotlin/io/github/manamiproject/modb/myanimelist/MyanimelistAnimeConverter.kt | Extracts labelled table rows and tiles. |
| livechart/src/test/kotlin/io/github/manamiproject/modb/livechart/LivechartAnimeConverterTest.kt | Expects unlabelled relation objects. |
| livechart/src/main/kotlin/io/github/manamiproject/modb/livechart/LivechartAnimeConverter.kt | Wraps franchise links without labels. |
| lib/src/test/resources/readme/DefaultReadmeCreatorTest/zero-based-week.md | Updates documentation snapshot. |
| lib/src/test/resources/readme/DefaultReadmeCreatorTest/reviewed-isolated-entries.md | Updates documentation snapshot. |
| lib/src/test/resources/readme/DefaultReadmeCreatorTest/merge-locks.md | Updates documentation snapshot. |
| lib/src/test/resources/readme/DefaultReadmeCreatorTest/expected-default.md | Updates default documentation snapshot. |
| lib/src/test/resources/readme/DefaultReadmeCreatorTest/animecountdown-with-zero-entries.md | Updates documentation snapshot. |
| lib/src/test/kotlin/io/github/manamiproject/modb/app/TestingAssets.kt | Migrates application fixtures to objects. |
| lib/src/test/kotlin/io/github/manamiproject/modb/app/synonyms/DefaultAmbiguousSynonymRemoverTest.kt | Adapts synonym-removal fixtures. |
| lib/src/test/kotlin/io/github/manamiproject/modb/app/relatedanime/DefaultUnknownRelatedAnimeRemoverTest.kt | Adapts relation-removal expectations. |
| lib/src/test/kotlin/io/github/manamiproject/modb/app/merging/matching/DefaultMatchingProbabilityCalculatorTest.kt | Adapts matching fixtures. |
| lib/src/test/kotlin/io/github/manamiproject/modb/app/merging/goldenrecords/DefaultGoldenRecordAccessorTest.kt | Adapts merging fixtures and unordered assertions. |
| lib/src/test/kotlin/io/github/manamiproject/modb/app/merging/DefaultMergingServiceTest.kt | Adapts merging-service fixtures. |
| lib/src/test/kotlin/io/github/manamiproject/modb/app/downloadcontrolstate/DownloadControlStateEntryTest.kt | Adapts download-state fixtures. |
| lib/src/test/kotlin/io/github/manamiproject/modb/app/downloadcontrolstate/DefaultDownloadControlStateUpdaterTest.kt | Adapts updater fixtures. |
| lib/src/test/kotlin/io/github/manamiproject/modb/app/downloadcontrolstate/DefaultDownloadControlStateSchedulerTest.kt | Adapts scheduler fixtures. |
| lib/src/test/kotlin/io/github/manamiproject/modb/app/dataset/AnimeCountdownUrlAdderTest.kt | Tests relation-label preservation. |
| lib/src/main/kotlin/io/github/manamiproject/modb/app/synonyms/DefaultAmbiguousSynonymRemover.kt | Looks up related entries by URI. |
| lib/src/main/kotlin/io/github/manamiproject/modb/app/readme/DefaultReadmeCreator.kt | Documents relation objects and examples. |
| lib/src/main/kotlin/io/github/manamiproject/modb/app/dataset/AnimeCountdownUrlAdder.kt | Preserves labels on derived links. |
| kitsu/src/test/kotlin/io/github/manamiproject/modb/kitsu/KitsuAnimeConverterTest.kt | Asserts Kitsu relation roles. |
| kitsu/src/main/kotlin/io/github/manamiproject/modb/kitsu/KitsuAnimeConverter.kt | Reads relationship role attributes. |
| core/src/test/kotlin/io/github/manamiproject/modb/core/TestingAssets.kt | Migrates core serialization fixtures. |
| core/src/test/kotlin/io/github/manamiproject/modb/core/json/RelatedAnimeAdapterTest.kt | Tests legacy reads and object serialization. |
| core/src/test/kotlin/io/github/manamiproject/modb/core/json/JsonKtTest.kt | Updates expected JSON objects. |
| core/src/test/kotlin/io/github/manamiproject/modb/core/json/AnimeRawAdapterTest.kt | Adapts source-overlap fixture. |
| core/src/test/kotlin/io/github/manamiproject/modb/core/extractor/LabelledLinksTest.kt | Tests HTML snippets and label pairing. |
| core/src/test/kotlin/io/github/manamiproject/modb/core/extractor/DescendantTest.kt | Covers the html() terminator. |
| core/src/test/kotlin/io/github/manamiproject/modb/core/anime/RelatedAnimeTest.kt | Tests normalization, sorting, and formatting. |
| core/src/test/kotlin/io/github/manamiproject/modb/core/anime/AnimeRawTest.kt | Tests labelled additions, deduplication, and merging. |
| core/src/main/kotlin/io/github/manamiproject/modb/core/json/RelatedAnimeAdapter.kt | Reads both formats and writes objects. |
| core/src/main/kotlin/io/github/manamiproject/modb/core/json/Json.kt | Registers the relation adapter. |
| core/src/main/kotlin/io/github/manamiproject/modb/core/json/AnimeRawAdapter.kt | Uses the new relation-set adapter. |
| core/src/main/kotlin/io/github/manamiproject/modb/core/json/AnimeAdapter.kt | Uses the new relation-set adapter. |
| core/src/main/kotlin/io/github/manamiproject/modb/core/extractor/LabelledLinks.kt | Adds reusable label/link extraction. |
| core/src/main/kotlin/io/github/manamiproject/modb/core/extractor/JsoupXPathDataExtractor.kt | Supports outer-HTML extraction. |
| core/src/main/kotlin/io/github/manamiproject/modb/core/extractor/JsoupCssSelectorDataExtractor.kt | Supports outer-HTML extraction. |
| core/src/main/kotlin/io/github/manamiproject/modb/core/extractor/Descendant.kt | Recognizes the html() terminator. |
| core/src/main/kotlin/io/github/manamiproject/modb/core/anime/RelatedAnime.kt | Defines relation objects and normalization. |
| core/src/main/kotlin/io/github/manamiproject/modb/core/anime/AnimeRaw.kt | Adds relation-aware storage and deduplication. |
| core/src/main/kotlin/io/github/manamiproject/modb/core/anime/Anime.kt | Changes related entries to objects. |
| anisearch/src/test/kotlin/io/github/manamiproject/modb/anisearch/AnisearchAnimeConverterTest.kt | Asserts known and unknown labels. |
| anisearch/src/main/kotlin/io/github/manamiproject/modb/anisearch/AnisearchAnimeConverter.kt | Extracts row labels and omits ?. |
| animenewsnetwork/src/test/kotlin/io/github/manamiproject/AnimenewsnetworkAnimeConverterTest.kt | Asserts header and trailing labels. |
| animenewsnetwork/src/main/kotlin/io/github/manamiproject/AnimenewsnetworkAnimeConverter.kt | Parses relation text beside links. |
| anime-planet/src/test/kotlin/io/github/manamiproject/modb/animeplanet/AnimePlanetAnimeConverterTest.kt | Asserts optional relation subtitles. |
| anime-planet/src/main/kotlin/io/github/manamiproject/modb/animeplanet/AnimePlanetAnimeConverter.kt | Extracts relation subtitles. |
| anilist/src/test/kotlin/io/github/manamiproject/modb/anilist/AnilistAnimeConverterTest.kt | Asserts AniList relation types. |
| anilist/src/main/kotlin/io/github/manamiproject/modb/anilist/AnilistAnimeConverter.kt | Reads relation types from edges. |
| anidb/src/test/kotlin/io/github/manamiproject/modb/anidb/AnidbApiAnimeConverterTest.kt | Asserts the API relation label. |
| anidb/src/test/kotlin/io/github/manamiproject/modb/anidb/AnidbAnimeConverterTest.kt | Asserts website relation labels. |
| anidb/src/main/kotlin/io/github/manamiproject/modb/anidb/AnidbApiAnimeConverter.kt | Reads relation type attributes. |
| anidb/src/main/kotlin/io/github/manamiproject/modb/anidb/AnidbAnimeConverter.kt | Extracts labels from related-entry blocks. |
Review effort: Balanced
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
TL;DR: Currently running a full recreation of the metadata. |
|
@cedya77 The archive contains the downloads, output, dcs folders and schemas with all entries rechecked (except AniDB), so it can be used for the next run when this is merged instead of rebuilding everything. I will try to increase the min time between AniDB API requests to finish rebuilding the last list for AniDB. |

Each entry in
relatedAnimenow contains the kind of relation as the metadata provider labels it.Format
Before:
After:
relationis the provider's own label, only whitespace is normalised (e.g.Sequelon MAL,SEQUELon AniList,sequelon Kitsu). Labels are not unified across providers.relationis omitted if the provider doesn't name the relation: LiveChart (no labels at all), AniDB "indirectly related" entries and aniSearch entries labelled?.Where the labels come from
relations.edges[].relationTyperelatedanime/anime/@typediv.typeof directly related entriesattributes.roleRelatedEntry__subtitleth spanof the relations table,?is treated as unknowntvdetailrelationsitemimagetypeCode changes
RelatedAnime(uri, relation).AnimeRawandAnimeuseHashSet<RelatedAnime>. The URI-basedaddRelatedAnimeoverloads are kept.RelatedAnimeAdapter(Moshi). Reads strings and objects, writes objects.html()terminating function for both extractors and theextractLabelledLinkshelper, which pair each label with its links.AnimeCountdownUrlAdderkeeps the relation when deriving animecountdown links from Simkl.DefaultAmbiguousSynonymRemoveradapted to the new type.RelatedAnimeobject and shows it in the example.RelatedAnime,RelatedAnimeAdapterandextractLabelledLinks.relatedAnimesets no longer depend on iteration order.Breaking change
Consumers which expect
relatedAnimeto be a list of strings have to be updated. The JSON schemas of the dataset need the items changed from a string to an object:🤖 Generated with Claude Code