What is {country} of {Baghdad} that is {end time} is {1621-0-0} ?
On what date did the country of Baghdad end in 1621
when did the country of Baghdad end in 1621?
SELECT ?y WHERE { ?c property:country ?y . resource:Baghdad property:country ?c . ?c property:end_time ?f . FILTER ( CONTAINS ( YEAR ( ?f ) , '1621' ) ) }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q1530> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P17> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj .
?statement <http://www.wikidata.org/entity/P582> <1621-0-0>
} 

SELECT ?obj WHERE { wd:Q1530 p:P17 ?s . ?s ps:P17 ?obj . ?s pq:P582 ?x filter(contains(YEAR(?x),'1621')) }