What is the {elected office} with the {MAX(term length of office)} ?
Which elected office has the longest term?
What is the elected office with the longest term length?
SELECT ?r WHERE { ?r property:term_length_of_office ?u . ?r rdf:type ontology:elective_office }
select ?ent where {
?ent <http://www.wikidata.org/entity/P31> <http://wikidata.dbpedia.org/resource/Q17279032>.
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?ent .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P2097>.
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj .}
ORDER BY DESC(?obj)
LIMIT 5
select ?ent where { ?ent wdt:P31 wd:Q17279032 . ?ent wdt:P2097 ?obj } ORDER BY DESC(?obj)LIMIT 5 
President of Syria President of the Confederate States President of Bolivia President of Vietnam Governor of Saint Petersburg