What is {position held} of {Gough Whitlam} that is {replaced by} is {Malcolm Fraser} ?
Name the position for which Malcolm Fraser replaced Gough Whitlam.
What was the position held by Gough Whitlam, which was replaced by Malcolm Fraser?
SELECT ?m WHERE { ?x property:replaced_by resource:Malcolm_Fraser . resource:Gough_Whitlam property:position_held ?x . ?x property:position_held ?m }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q23333> .
?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/P1366> <http://wikidata.dbpedia.org/resource/Q315979>
} 

SELECT ?obj WHERE { wd:Q23333 p:P39 ?s . ?s ps:P39 ?obj . ?s pq:P1366 wd:Q315979 }