what is the {country} for {Stanford University} has {headquarters location} as {Stanford} ?
What country houses Stanford University's headquarters?
In what country is Stanford University's Stanford headquarters?
SELECT ?r WHERE { ?u property:country ?r . ?u property:headquarters_location resource:Stanford . resource:Stanford_University property:headquarters_location ?u }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q41506> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P159> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q173813> .
?statement <http://www.wikidata.org/entity/P17> ?value. 
} 

SELECT ?value WHERE { wd:Q41506 p:P159 ?s . ?s ps:P159 wd:Q173813 . ?s pq:P17 ?value}