what is the {country} for {Lockheed Martin} has {headquarters location} as {Bethesda} ?
In which country is Lockheed Martin's Bethesda headquarters?
Which country has Lockheed Martin's headquarters located in Bethesda?
SELECT ?z WHERE { resource:Lockheed_Martin property:headquarters_location ?d . ?d property:headquarters_location resource:Bethesda . ?d property:country ?z }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q7240> .
?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/Q584451> .
?statement <http://www.wikidata.org/entity/P17> ?value. 
} 

SELECT ?value WHERE { wd:Q7240 p:P159 ?s . ?s ps:P159 wd:Q584451 . ?s pq:P17 ?value}