What is the {kingdom} for {capital of} of {Bucharest}
Bucharest is in what kingdom?
Which is the kingdom of the capital of Bucharest?
SELECT DISTINCT ?w WHERE { resource:Bucharest property:capital_of ?w . ?w rdf:type ontology:kingdom }
select distinct ?obj where { ?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q19660> . ?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P1376> . ?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj . ?obj <http://www.wikidata.org/entity/P31> <http://wikidata.dbpedia.org/resource/Q417175> } 
 select distinct ?obj where { wd:Q19660 wdt:P1376 ?obj . ?obj wdt:P31 wd:Q417175 } 