Question: Which has fewer people, Dorset (the one that shares border with Wiltshire) or Cambridgeshire (the one that shares border with Hertfordshire)?
Choices:
West Midlands
Essex
Cambridgeshire
Warwickshire
Somerset
Derbyshire
Norfolk
Cumbria
Northumberland
Dorset
Program:
function: Find
inputs: Wiltshire
function: Relate
dependencies: 0
inputs: shares border with
forward
function: Find
inputs: Dorset
function: And
dependencies: 1
2
function: Find
inputs: Hertfordshire
function: Relate
dependencies: 4
inputs: shares border with
forward
function: Find
inputs: Cambridgeshire
function: And
dependencies: 5
6
function: SelectBetween
dependencies: 3
7
inputs: population
less
SPARQL: SELECT ?e WHERE { { ?e <pred:name> "Dorset" . ?e_1 <shares_border_with> ?e . ?e_1 <pred:name> "Wiltshire" .   } UNION { ?e <pred:name> "Cambridgeshire" . ?e_2 <shares_border_with> ?e . ?e_2 <pred:name> "Hertfordshire" .  } ?e <population> ?pv . ?pv <pred:value> ?v .  } ORDER BY ?v LIMIT 1
Answer: Dorset