Question: Which has higher elevation above sea level, Rio de Janeiro (the one that shares border with Minas Gerais) or Sonora?
Choices:
England
Punjab
Lublin Voivodeship
Greater Poland Voivodeship
New South Wales
Podlaskie Voivodeship
Minas Gerais
Sonora
Rio de Janeiro
Upper Austria
Program:
function: Find
inputs: Minas Gerais
function: Relate
dependencies: 0
inputs: shares border with
forward
function: Find
inputs: Rio de Janeiro
function: And
dependencies: 1
2
function: Find
inputs: Sonora
function: SelectBetween
dependencies: 3
4
inputs: elevation above sea level
greater
SPARQL: SELECT ?e WHERE { { ?e <pred:name> "Rio de Janeiro" . ?e_1 <shares_border_with> ?e . ?e_1 <pred:name> "Minas Gerais" .   } UNION { ?e <pred:name> "Sonora" .  } ?e <elevation_above_sea_level> ?pv . ?pv <pred:value> ?v .  } ORDER BY DESC(?v) LIMIT 1
Answer: Rio de Janeiro