Unconventional and overkilled use of Wikidata: get a machine-readable list of Touhou games that maps release numbers to titles, for canonicalizing album metadata fields. In hindsight, my script was bloated and unnecessary. The whole thing could just be a simple SPARQL query.
Here it is. A refactored and proper #SPARQL query to #Wikidata for getting a machine-readable list of Touhou games that maps release numbers to titles, without the bloated and inefficient Python code in the last post. Runs in milliseconds instead of half a minute. Interactive query at https://query-main.wikidata.org
SELECT ?game ?thRelease ?titleJa ?titleEn ?titleZh ?titleZhHans WHERE {
wd:Q907907 p:P527 [
ps:P527 ?game ;
pq:P1545 ?thReleaseValue
] .
BIND(CONCAT("TH", ?thReleaseValue) as ?thRelease)
OPTIONAL { ?game rdfs:label ?titleJa FILTER(LANG(?titleJa) = "ja") }
OPTIONAL { ?game rdfs:label ?titleEn FILTER(LANG(?titleEn) = "en") }
OPTIONAL { ?game rdfs:label ?titleZh FILTER(LANG(?titleZh) = "zh") }
OPTIONAL { ?game rdfs:label ?titleZhHans FILTER(LANG(?titleZhHans) = "zh-hans") }
}
ORDER BY xsd:float(?thReleaseValue)










After listening to these soundtracks for 10+ years, I'm finally able to tell the games, characters and locations associated with them (still need to tune the release priority, newer soundtrack versions are currently overrepresented).










