what is the {end time} for {Han dynasty} has {capital} as {Chang'an} ?
In the Han Dynasty end of time, which had the capital Chang'an?
What is the end of time for Han Dynasty has a capital as Chang'an?
SELECT ?l WHERE { ?u property:end_time ?l . ?u property:capital resource:Chang'an . resource:Han_dynasty property:capital ?u }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q7209> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P36> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q6501000> .
?statement <http://www.wikidata.org/entity/P582> ?value. 
} 

SELECT ?value WHERE { wd:Q7209 p:P36 ?s . ?s ps:P36 wd:Q6501000 . ?s pq:P582 ?value}