I am trying to get the country of a Wikidata item using SPARQL. I am quite new and I am not able to obtain only the property country (P17) and its label.
I used this example and I am able to obtain all properties. Link.
In this case using the output of a previous query, for example, I get the item Q1492 corresponding to Barcelona. How can I obtain its country, Spain?