what is the {end time} for {William III} has {work location} as {The Hague} ?
William III stopped working in The Hague in which year?
When did William III end his time working in The Hague?
SELECT ?n WHERE { ?q property:end_time ?n . resource:William_III property:work_location ?q . ?q property:work_location resource:The_Hague }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q129987> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P937> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q36600> .
?statement <http://www.wikidata.org/entity/P582> ?value. 
} 

SELECT ?value WHERE { wd:Q129987 p:P937 ?s . ?s ps:P937 wd:Q36600 . ?s pq:P582 ?value}