Question: Which has less area, Hampshire that borders Berkshire or Wiltshire?
Choices:
West Midlands
Norfolk
Somerset
Hampshire
Staffordshire
Wiltshire
Derbyshire
Warwickshire
Northumberland
Essex
Program:
function: Find
inputs: Berkshire
function: Relate
dependencies: 0
inputs: shares border with
forward
function: Find
inputs: Hampshire
function: And
dependencies: 1
2
function: Find
inputs: Wiltshire
function: SelectBetween
dependencies: 3
4
inputs: area
less
SPARQL: SELECT ?e WHERE { { ?e <pred:name> "Hampshire" . ?e_1 <shares_border_with> ?e . ?e_1 <pred:name> "Berkshire" .   } UNION { ?e <pred:name> "Wiltshire" .  } ?e <area> ?pv . ?pv <pred:value> ?v .  } ORDER BY ?v LIMIT 1
Answer: Wiltshire