What is {position held} of {James Monroe} that is {end time} is {1794-3-29} ?
What post did James Monroe leave on March 29, 1794?
What was the post that James Monroe left on March 29, 1794?
SELECT ?j WHERE { ?h property:position_held ?j . FILTER ( CONTAINS ( YEAR ( ?x ) , '1794' ) ) . resource:James_Monroe property:position_held ?h . ?h property:end_time ?x }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q11815> .
?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> ?obj .
?statement <http://www.wikidata.org/entity/P582> <1794-3-29>
} 

SELECT ?obj WHERE { wd:Q11815 p:P39 ?s . ?s ps:P39 ?obj . ?s pq:P582 ?x filter(contains(YEAR(?x),'1794')) }