what is the {replaces} for {Michał Korybut Wiśniowiecki} has {position held} as {Kings of Poland} ?
Who supplanted Michal Korybut Wisniowiecki as the Ruler of Poland?
Who replaced Michal Korybut Wisniowiecki as the King of Poland?
SELECT ?r WHERE { resource:Michał_Korybut_Wiśniowiecki property:position_held ?m . ?m property:position_held resource:king_of_Poland . ?m property:replaces ?r }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q54041> .
?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> <http://wikidata.dbpedia.org/resource/Q3273712> .
?statement <http://www.wikidata.org/entity/P1365> ?value. 
} 

SELECT ?value WHERE { wd:Q54041 p:P39 ?s . ?s ps:P39 wd:Q3273712 . ?s pq:P1365 ?value}