What is {position held} of {Archibald Primrose, 5th Earl of Rosebery} that is {replaces} is {John Wodehouse, 1st Earl of Kimberley} ?
John Wodehouse, 1st Earl of Kimberley was replaced by Archibald Primrose, 5th Earl of Rosebery in which position?
Which position was held by Archibald Primrose, 5th Earl of Rosebery who replaced John Wodehouse, 1st Earl of Kimberley?
SELECT ?m WHERE { ?e property:position_held ?m . resource:Archibald_Primrose,_5th_Earl_of_Rosebery property:position_held ?e . ?e property:replaces resource:John_Wodehouse,_1st_Earl_of_Kimberley }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q244620> .
?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/P1365> <http://wikidata.dbpedia.org/resource/Q335342>
} 

SELECT ?obj WHERE { wd:Q244620 p:P39 ?s . ?s ps:P39 ?obj . ?s pq:P1365 wd:Q335342 }