Question: Which Massachusetts county that shares a border with Middlesex County, whose capital is Lowell, has the smallest area?
Choices:
Plymouth County
Franklin County
Essex County
Worcester County
Bristol County
Barnstable County
Berkshire County
Hampshire County
Middlesex County
Norfolk County
Answer: Worcester County
SPARQL: SELECT ?e WHERE { ?e <pred:instance_of> ?c . ?c <pred:name> "county of Massachusetts" . ?e <shares_border_with> ?e_1 . ?e_1 <pred:name> "Middlesex County" . ?e_2 <capital_of> ?e_1 . ?e_2 <pred:name> "Lowell" .  ?e <area> ?pv . ?pv <pred:value> ?v .  } ORDER BY ?v LIMIT 1
Program:
function: Find
inputs: Lowell
function: Relate
dependencies: 0
inputs: capital of
forward
function: Find
inputs: Middlesex County
function: And
dependencies: 1
2
function: Relate
dependencies: 3
inputs: shares border with
backward
function: FilterConcept
dependencies: 4
inputs: county of Massachusetts
function: SelectAmong
dependencies: 5
inputs: area
smallest