In SPARQL you write statements in the form
<thing> <relation> <thing>
But the cool part is that any of those three parts can be extracted, so you can ask things like "what are the cities in <country>", or "what country harbors the city <city>", but most importantly, "how does <city> relate to <country>".For example, if you wanted to find out all the historical monuments in state capitals of a country (using my home country as an example, also pseudocode for your time's sake):
fetch ?monumentName, ?cityName given
?monument "is called" ?monumentName.
?monument "is located within" ?city.
?city "is capital of" ?state.
?city "is called" ?cityName.
?city "is located within" "Brazil".