What is {position held} of {Gerald Ford} that is {series ordinal} is {40} ?
Which position did Gerald Ford have at 40?
What position did Gerald Ford hold as 40?
SELECT ?v WHERE { resource:Gerald_Ford property:position_held ?a . FILTER ( ?c = 40 ) . ?a property:series_ordinal ?c . ?a property:position_held ?v }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q9582> .
?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> <40>
} 

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