what is the {end time} for {William Petty, 2nd Earl of Shelburne} has {position held} as {Prime Minister of the United Kingdom} ?
On what date did William Petty concluded his role as the UK Prime Minister?
When did William Petty stop being UK Prime Minister?
SELECT ?x WHERE { ?x property:position_held resource:Prime_Minister_of_the_United_Kingdom . resource:William_Petty,_2nd_Earl_of_Shelburne property:position_held ?x . ?x property:end_time ?x }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q312573> .
?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/Q14211> .
?statement <http://www.wikidata.org/entity/P582> ?value. 
} 

SELECT ?value WHERE { wd:Q312573 p:P39 ?s . ?s ps:P39 wd:Q14211 . ?s pq:P582 ?value}