While examining the results of the official example query "Continents, countries, regions and capitals" (on https://query.wikidata.org/, limited to Germany for your convenience here: link), I noticed that some capitals of German federal states were missing. For example Wiesbaden as capital of Hesse. I noticed that Wiesbaden is an instance of big city
, but not of city
(see https://www.wikidata.org/wiki/Q1721), in contrast to some other cities. I was able to alleviate the problem by also including cities that are subclasses of city
by changing line 17 to ?city wdt:P31/wdt:P279? wd:Q515
.
One of the four cities that are still missing is Magdeburg, the capital of Saxony-Anhalt.
The diagnostic query
SELECT ?cityLabel ?props
WHERE {
?city wdt:P31 ?props.
FILTER(?city = wd:Q1733 || ?city = wd:Q1726).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
shows that Magdeburg is not even an instance of city
, although it clearly is according to its Wikidata page https://www.wikidata.org/wiki/Q1733.
I am new to Wikidata and SPARQL. However, this seems wrong to me. What can I do to get all capitals of the german federal states? And what is the reason for this behaviour?
SELECT * WHERE { wd:Q1733 wdt:P31 ?o }
should return all types, but it looks like something goes wrong. – OctamerousSELECT * WHERE { wd:Q1733 wdt:P17 ?o }
also returns just one value. On the other hand, if you look at statements forcapital of
withSELECT * WHERE { wd:Q1733 wdt:P1376 ?o }
it returns multiple values. – Octamerous