What is {position held} of {Henry V, Holy Roman Emperor} that is {replaced by} is {Lothair III, Holy Roman Emperor} ?
Lothair III replaced Henry V as Holy Roman Emperor in what year?
When was Henry V replaced by Lothair III as Holy Roman Emperor?
SELECT ?a WHERE { ?b property:replaced_by resource:Lothair_III . ?b property:position_held ?a . resource:Henry_V property:position_held ?b }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q151707> .
?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/Q77189>
} 

SELECT ?obj WHERE { wd:Q151707 p:P39 ?s . ?s ps:P39 ?obj . ?s pq:P1366 wd:Q77189 }