Question: Relative to which location is the border of Frederick County (the one that borders Loudoun County) with Montgomery County (that borders Prince George's County) ?
Choices: north
south
consolidated city-county
north-northwest
southeast
south-southeast
southwest
west
northwest
west-northwest
SPARQL: SELECT DISTINCT ?qpv WHERE { ?e_1 <pred:name> "Montgomery County" . ?e_1 <shares_border_with> ?e_3 . ?e_3 <pred:name> "Prince George's County" . ?e_2 <pred:name> "Frederick County" . ?e_2 <shares_border_with> ?e_4 . ?e_4 <pred:name> "Loudoun County" . ?e_1 <shares_border_with> ?e_2 . [ <pred:fact_h> ?e_1 ; <pred:fact_r> <shares_border_with> ; <pred:fact_t> ?e_2 ] <direction_relative_to_location> ?qpv .  }
Program:
function: Find
inputs: Prince George's County
function: Relate
dependencies: 0
inputs: shares border with
backward
function: Find
inputs: Montgomery County
function: And
dependencies: 1
2
function: Find
inputs: Loudoun County
function: Relate
dependencies: 4
inputs: shares border with
backward
function: Find
inputs: Frederick County
function: And
dependencies: 5
6
function: QueryRelationQualifier
dependencies: 3
7
inputs: shares border with
direction relative to location
Answer: northwest