What is {position held} of {Spencer Perceval} that is {end time} is {1812-1-1} ?
In 1812, Spencer Perceval position was?
What was spencer Perceval position in 1812?
SELECT ?p WHERE { resource:Spencer_Perceval property:position_held ?q . ?q property:end_time ?t . ?q property:position_held ?p . FILTER ( CONTAINS ( YEAR ( ?t ) , '1812' ) ) }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q233992> .
?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> <1812-1-1>
} 

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