What is {position held} of {Stanisław Koniecpolski} that is {replaced by} is {Mikołaj Potocki} ?
What position did Mikolaj Potock replace that was held by Stainslaw Konicpolski.
What position did Stanisław Koniecpolski held where he was replaced by Mikołaj Potock?
SELECT ?a WHERE { resource:Stanisław_Koniecpolski property:position_held ?k . ?k property:position_held ?a . ?k property:replaced_by resource:Mikołaj_Potocki }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q722463> .
?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/Q2626598>
} 

SELECT ?obj WHERE { wd:Q722463 p:P39 ?s . ?s ps:P39 ?obj . ?s pq:P1366 wd:Q2626598 }