What is {position held} of {Joh Bjelke-Petersen} that is {series ordinal} is {31} ?
Jon Bjelke-Petersen holds which position at number 31?
What position does Jon Bjelke-Petersen hold if his position number is 31?
SELECT ?u WHERE { resource:Joh_Bjelke-Petersen property:position_held ?n . ?n property:series_ordinal ?v . ?n property:position_held ?u . FILTER ( CONTAINS ( ?v , '31' ) ) }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q1528405> .
?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/P1545> <31>
} 

SELECT ?obj WHERE { wd:Q1528405 p:P39 ?s . ?s ps:P39 ?obj . ?s pq:P1545 ?x filter(contains(?x , '31')) }