I am trying to retrieve some municipalities from Wikidata using SPARQL but several items returned have much of their fields empty despite these items having these data. I do not understand what is wrong with the query below (link to WQS). For example, the municipality Almelo has its coordinates (P625
), and parent place (P131
) erroneously missing in the results:
SELECT ?mun ?munLabel ?coords ?parentPlace ?area WHERE {
?mun p:P31 ?instanceOf # Get statement because we need this later
.
?instanceOf ps:P31/wdt:279* wd:Q2039348.
OPTIONAL {
?mun wdt:P625 ?coords;
wdt:P131 ?parentPlace;
wdt:P2046 ?area
.
}
MINUS { ?instanceOf pq:P582 ?endTime. } # Don't show municipalities that have an end time
service wikibase:label { bd:serviceParam wikibase:language "en". }
} ORDER BY ?munLabel