This article was created with the help of AI.
Last night we added a daily Europe quiz, in six languages, to our Wikidata trivia pages: the country highlighted on a map, its capital, its flag, with every wrong answer also taken from Europe. The question we thought would take five minutes was the first line of the spec: which countries count as European?
Here is what Wikidata answered, and the rules we ended up writing down.
Continent (P30) is a property, not a definition
Our country list is every sovereign state (wd:Q3624078) with its continent statements (wdt:P30). For most countries there is exactly one value. The query below, run on 25 October 2026, returns the exceptions:
SELECT ?c ?cLabel (COUNT(DISTINCT ?cont) AS ?n) WHERE {
?c wdt:P31 wd:Q3624078 .
?c wdt:P30 ?cont .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} GROUP BY ?c ?cLabel HAVING (?n > 1)
It lists Turkey and Kazakhstan (Europe and Asia), Russia with three values (Europe, Asia and Eurasia), four Pacific states recorded in both "Oceania" and "Insular Oceania", which we merge, and the Russian Empire, a historical item that we filter out. So the real question is three countries: Russia, Turkey and Kazakhstan.
The borderline cases you might expect are not borderline in the data. Georgia and Cyprus have Europe as their only continent. Armenia and Azerbaijan have Asia only.
Wikidata is right to keep several values for the three transcontinental states. A quiz still has to decide. Our rule: a country is in the Europe quiz if Europe is its only continent, or if it spans several continents and its capital lies in Europe. That puts Russia in (Moscow) and leaves Turkey (Ankara) and Kazakhstan (Astana) out. The rule is written on the page, in each language, because someone will ask. The result is 46 countries.
Wrong answers have to stay on the continent
A flag question with Norway as the answer and Bolivia as a decoy is not a question. Every capital, flag and map question draws its three decoys from the same 46 countries. That works because the pool is large enough: even the flag family, the smallest, keeps 40 countries.
Why 40? Six European countries have more than one current flag file in P41 (no end date): Belgium, Bulgaria, Hungary, Spain, Switzerland and Vatican City. Our generator only asks about a flag when there is exactly one, so those six are left out of flag questions and stay in capital and map questions.
Germany's 16 states: two have no capital at all
We added a quiz on the German Länder at the same time (wd:Q1221156). Three surprises:
- Berlin and Hamburg have no capital statement (
P36). They are city-states, so the state and the city are one item. A capital question would show the answer in the question anyway. - Bremen's item is "Freie Hansestadt Bremen", the state, whose capital is the city of Bremen, a different item. We display the state as "Bremen" and skip its capital question for the same reason as above.
- Bavaria has two current flags, the lozenge flag and the striped flag, both official. Here we keep one (the first by file name) rather than drop the state, because 16 is already a small pool.
With 16 items, a day's quiz asks 16 questions, each state once, and rotates the question type so a state does not come back with the same question the next day.
The query that timed out
Our first Länder query asked for labels of the state and of its capital in one go, using the usual OPTIONAL label pattern with a fallback to the mul label. It returned HTTP 504 twice. The bare query (items, capital, flag, locator map) returns in under a second, and the labels in six languages come back from a second query over a VALUES list. For small classes, two light queries beat one clever one.
Labels are not display names
Portuguese labels (we use the Brazilian ones first) gave "República da Irlanda" for Ireland and "Cidade de Bruxelas" for Brussels. Both are correct and both look odd as quiz choices. We keep a short override table for display names, the same way we already show "China" rather than "People's Republic of China".
Try it
- Europe quiz: English, French, Spanish, German, Italian, Portuguese
- Bundesländer-Quiz (German)
- How the questions are generated: method page
The facts come from Wikidata (CC0) and the images from Wikimedia Commons. If you have a better rule for transcontinental countries, I would like to hear it.
Top comments (0)