what is the {end time} for {Severus Snape} has {position held} as {headmaster of Hogwarts} ?
on what serverus snape stop being the headmaster of hogwarts?
When did Severus Snape stop being the headmaster of Hogwarts?
SELECT ?t WHERE { ?g property:end_time ?t . resource:Severus_Snape property:position_held ?g . ?g property:position_held resource:Headmaster_of_Hogwarts }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q176772> .
?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/Q2473303> .
?statement <http://www.wikidata.org/entity/P582> ?value. 
} 

SELECT ?value WHERE { wd:Q176772 p:P39 ?s . ?s ps:P39 wd:Q2473303 . ?s pq:P582 ?value}