what is the {end time} for {Ban Ki-moon} has {position held} as {United Nations Secretary-General} ?
When did Ban Ki-moon hold the position of UN Secretary-General?
when was   Ban Ki-moon has position held as United Nations Secretary-General ?
SELECT ?c WHERE { resource:Ban_Ki-moon property:position_held ?j . ?j property:position_held resource:Secretary-General_of_the_United_Nations . ?j property:end_time ?c }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q1253> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P39> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q81066> .
?statement <http://www.wikidata.org/entity/P582> ?value. 
} 

SELECT ?value WHERE { wd:Q1253 p:P39 ?s . ?s ps:P39 wd:Q81066 . ?s pq:P582 ?value}