Retrieving coordinates linked to values
In the previous query, coordinates were directly linked to the items we selected. But coordinates are not always directly linked to the items of interest to us. The following query shows the filming locations for each film in the Star Wars series.
The query gives back the value of P915 property (filming location) for each film. Once you have learned how to retrieve data linked to values, it is quite a straightforward task to retrieve the coordinates for each location:
# A little bit of syntax
A shorter way of formulating the above query is using square brackets to join the two statements on lines 7 and 8. So instead of:
?item wdt:P915 ?location.
?location wdt:P625 ?coords.
We write:
?item wdt:P915 [wdt:P625 ?coords].
What has changed in the results? Why?
The map shows the same locations but because this syntax omits the ?location variable ?locationLabel is empty and the location’s label does not appear.