What is {position held} of {Rajiv Gandhi} that is {end time} is {1989-12-2} ?
What position did Rajiv Gandhi hold that finished on December 2, 1989?
What position did Rajiv Gandhi hold that ended on December 2, 1989?
SELECT ?r WHERE { resource:Rajiv_Gandhi property:position_held ?b . FILTER ( CONTAINS ( YEAR ( ?t ) , '1989' ) ) . ?b property:position_held ?r . ?b property:end_time ?t }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q4593> .
?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> <1989-12-2>
} 

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