Question: What is the number of non-metropolitan districts that surrounds the Cambridge enclave (whose G55 code is E07000008 as of 2011) or that is located in Surrey (that contains the River Thames)?
Choices:
0
1
2
3
4
5
6
7
8
9
Answer: 3
SPARQL: SELECT (COUNT(DISTINCT ?e) AS ?count) WHERE { ?e <pred:instance_of> ?c . ?c <pred:name> "non-metropolitan district" .  { ?e_1 <enclave_within> ?e . ?e_1 <pred:name> "Cambridge" . ?e_1 <GSS_code_(2011)> ?pv . ?pv <pred:value> "E07000008" .  } UNION { ?e <located_in_the_administrative_territorial_entity> ?e_1 . ?e_1 <pred:name> "Surrey" . ?e_2 <located_in_the_administrative_territorial_entity> ?e_1 . ?e_2 <pred:name> "River Thames" .  } }
Program:
function: Find
inputs: Cambridge
function: FilterStr
dependencies: 0
inputs: GSS code (2011)
E07000008
function: Relate
dependencies: 1
inputs: enclave within
forward
function: FilterConcept
dependencies: 2
inputs: non-metropolitan district
function: Find
inputs: River Thames
function: Relate
dependencies: 4
inputs: located in the administrative territorial entity
forward
function: Find
inputs: Surrey
function: And
dependencies: 5
6
function: Relate
dependencies: 7
inputs: located in the administrative territorial entity
backward
function: FilterConcept
dependencies: 8
inputs: non-metropolitan district
function: Or
dependencies: 3
9
function: Count
dependencies: 10