What is {position held} of {Henry Temple, 3rd Viscount Palmerston} that is {end time} is {1841-6-23} ?
Henry Temple, 3rd Viscount Palmerston held what position until June 23, 1841?
What position did Henry Temple, 3rd Viscount Palmerston hold until June 23, 1841?
SELECT ?j WHERE { resource:Henry_Temple,_3rd_Viscount_Palmerston property:position_held ?v . ?v property:position_held ?j . ?v property:end_time ?s . FILTER ( CONTAINS ( YEAR ( ?s ) , '1841' ) ) }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q193656> .
?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> <1841-6-23>
} 

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