what is the {end time} for {Charles Grey, 2nd Earl Grey} has {position held} as {Secretary of State for Foreign and Commonwealth Affairs} ?
When did Charles Grey, 2nd Earl of Grey, Retire from the position of Secratary of State for Foreign and Common Wealth Affairs?
When did Charles Grey, 2nd Earl Grey, end his position as the Secretary of State for Foreign and Commonwealth Affairs?
SELECT ?a WHERE { resource:Charles_Grey,_2nd_Earl_Grey property:position_held ?l . ?l property:end_time ?a . ?l property:position_held resource:Secretary_of_State_for_Foreign_and_Commonwealth_Affairs }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q294662> .
?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/Q1371091> .
?statement <http://www.wikidata.org/entity/P582> ?value. 
} 

SELECT ?value WHERE { wd:Q294662 p:P39 ?s . ?s ps:P39 wd:Q1371091 . ?s pq:P582 ?value}