What is {position held} of {Adrian IV} that is {replaced by} is {Alexander III} ?
In what capacity did Adrian IV serve before being succeeded by Alexander III?
Which position did Adrian IV hold before being replaced by Alexander III?
SELECT ?f WHERE { resource:Adrian_IV property:position_held ?l . ?l property:replaced_by resource:Alexander_III . ?l property:position_held ?f }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q132845> .
?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/Q160116>
} 

SELECT ?obj WHERE { wd:Q132845 p:P39 ?s . ?s ps:P39 ?obj . ?s pq:P1366 wd:Q160116 }