Question: Which area is smaller, Karnataka or Kerala (the one that shares border with Karnataka)?
Choices:
West Bengal
Andhra Pradesh
Himachal Pradesh
Odisha
Jharkhand
Kerala
Haryana
Punjab
Maharashtra
Gujarat
Program:
function: Find
inputs: Karnataka
function: Find
inputs: Karnataka
function: Relate
dependencies: 1
inputs: shares border with
backward
function: Find
inputs: Kerala
function: And
dependencies: 2
3
function: SelectBetween
dependencies: 0
4
inputs: area
less
SPARQL: SELECT ?e WHERE { { ?e <pred:name> "Karnataka" .  } UNION { ?e <pred:name> "Kerala" . ?e <shares_border_with> ?e_1 . ?e_1 <pred:name> "Karnataka" .   } ?e <area> ?pv . ?pv <pred:value> ?v .  } ORDER BY ?v LIMIT 1
Answer: Kerala