Page MenuHomePhabricator

Query using wikibase:label returns the item id
Closed, ResolvedPublicBUG REPORT

Description

Execute the query found at https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries#Query_to_find_latitudes_and_longitudes_for_places_in_Paris, and add ORDER BY ?aLabel to better see the results.

Initial results will appear as "item IRI, item label, lat, long".
For example, "wd:Q100587045, Q100587045, 48.894902217468, 2.3648490384221"

To show the correct output, execute:
SELECT ?a ?aLabel ?lat ?long WHERE {

?a wdt:P131+ wd:Q90 .  # administrative territorial entity = Paris
?a p:P625 ?statement . # coordinate-location statement
?statement psv:P625 ?coordinate_node .
?coordinate_node wikibase:geoLatitude ?lat .
?coordinate_node wikibase:geoLongitude ?long .
?a rdfs:label ?aLabel .
FILTER (lang(?aLabel) = "en")

} ORDER BY ?aLabel

You will see fewer results and they seem to have legitimate labels.

Executed using the WDQS front-end on Firefox.

Event Timeline

I don’t see what the issue here is… if the item has no label in any of the listed languages, the label service falls back to the item ID. This is good and desirable. Whether an item has a label in a certain language or not is essentially arbitrary, so filtering out items that happen to have no label is not usually a good thing to do, in my opinion. (Unless you’re working with a maintenance query or are otherwise interested specifically in the existence of the label.)

AWesterinen claimed this task.

That explanation is reasonable. I missed the documentation that said that the service falls back to Q-id in case of no label.