what is the {end time} for {Sichuan} has {located in the administrative territorial entity} as {Tang dynasty} ?
On what date did the Tang dynasty end for Sichuan?
When did the Tang dynasty end for Sichuan?
SELECT ?u WHERE { ?u property:located_in_the_administrative_territorial_entity resource:Tang_Empire . resource:Sichuan property:located_in_the_administrative_territorial_entity ?u . ?u property:end_time ?u }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q19770> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P131> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q9683> .
?statement <http://www.wikidata.org/entity/P582> ?value. 
} 

SELECT ?value WHERE { wd:Q19770 p:P131 ?s . ?s ps:P131 wd:Q9683 . ?s pq:P582 ?value}