What is the {title of honor} with the {MAX(term length of office)} whose {instance of} is {position}  ?
Who has the longest term in office?
What title of honor has the longest term in office?
SELECT ?n WHERE { ?n rdf:type ontology:position . ?n rdf:type ontology:title_of_honor . ?n property:term_length_of_office ?i }
select ?ent where {
?ent <http://www.wikidata.org/entity/P31> <http://wikidata.dbpedia.org/resource/Q3320743>.

?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?ent .
?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P2097>.
?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj1.

?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?ent .
?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P31> .
?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q4164871> .

}
ORDER BY DESC(?obj1)
LIMIT 5
select ?ent where { ?ent wdt:P31 wd:Q3320743 . ?ent wdt:P2097 ?obj . ?ent wdt:P31 wd:Q4164871 } ORDER BY DESC(?obj)LIMIT 5 
National Ambassador for Young People's Literature Children's Laureate Australian Children's Laureate