What is the {country} with the {MAX(median income)} whose {member of} is {United Nations Educational, Scientific and Cultural Organization}  ?
What is the country with the highest median income who is a member of the UN Educational, Scientific and Cultural Organization ?
What is the country with the highest median income whose member of is United Nations Educational, Scientific and Cultural Organization ?
SELECT ?b WHERE { ?b property:median_income ?q . ?b rdf:type ontology:country . ?b property:member_of resource:UNESCO }
select ?ent where {
?ent <http://www.wikidata.org/entity/P31> <http://wikidata.dbpedia.org/resource/Q6256>.

?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/P3529>.
?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/P463> .
?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q7809> .

}
ORDER BY DESC(?obj1)
LIMIT 5
select ?ent where { ?ent wdt:P31 wd:Q6256 . ?ent wdt:P3529 ?obj . ?ent wdt:P463 wd:Q7809 } ORDER BY DESC(?obj)LIMIT 5 
Canada Norway Sweden Australia Denmark