Question: What number of towns have a common border with Sheffield (which has a border with Barnsley) or is Oldham's capital, which has UKK1 as a FIPS 10-4 (countries and regions)?
Choices:
0
1
2
3
4
5
6
7
8
9
Answer: 2
SPARQL: SELECT (COUNT(DISTINCT ?e) AS ?count) WHERE { ?e <pred:instance_of> ?c . ?c <pred:name> "town" .  { ?e_1 <shares_border_with> ?e . ?e_1 <pred:name> "Sheffield" . ?e_2 <shares_border_with> ?e_1 . ?e_2 <pred:name> "Barnsley" .  } UNION { ?e <capital_of> ?e_1 . ?e_1 <pred:name> "Oldham" . ?e_1 <FIPS_10-4_(countries_and_regions)> ?pv . ?pv <pred:value> "UKK1" .  } }
Program:
function: Find
inputs: Barnsley
function: Relate
dependencies: 0
inputs: shares border with
forward
function: Find
inputs: Sheffield
function: And
dependencies: 1
2
function: Relate
dependencies: 3
inputs: shares border with
forward
function: FilterConcept
dependencies: 4
inputs: town
function: Find
inputs: Oldham
function: FilterStr
dependencies: 6
inputs: FIPS 10-4 (countries and regions)
UKK1
function: Relate
dependencies: 7
inputs: capital of
backward
function: FilterConcept
dependencies: 8
inputs: town
function: Or
dependencies: 5
9
function: Count
dependencies: 10