I'm using this SPARQL query to obtain a list of European countries:
SELECT ?item $itemLabel
WHERE {
?item wdt:P31 wd:Q6256.
#?item wdt:P30 wd:Q46
#?item wdt:P361* wd:Q46.
?item wdt:P30|wdt:P361* wd:Q46.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ASC($itemLabel)
- Line 3 limits the results to instances of Q6256, i.e. countries.
- Line 4 (currently commented out) limits the results to items which are on the continent Q46 (Europe).
- Line 5 (currently commented out) limits the results to items which are part of Europe, or which are part of something that is part of Europe, etc.
- Line 6 is an OR-clause which combines line 4 and 5.
I'm running the query with one of the lines 4-6 active, and the other two commented out.
No matter which predicate is active, Austria is not part of the results (other countries are missing as well). However, looking at https://www.wikidata.org/wiki/Q40, we can see that
- Austria is an instance of Q6256.
- Austria's continent (P30) is Europe.
- Austria is part of Central Europe (Q27509), which is part of Europe.
What am I doing wrong?
Here's the relevant query.