Question: How many independent cities are located in Virginia, a state sharing a border with West Virginia?
Choices:
17
18
19
20
21
22
23
24
25
26
Answer: 19
SPARQL: SELECT (COUNT(DISTINCT ?e) AS ?count) WHERE { ?e <pred:instance_of> ?c . ?c <pred:name> "independent city" . ?e <located_in_the_administrative_territorial_entity> ?e_1 . ?e_1 <pred:name> "Virginia" . ?e_2 <shares_border_with> ?e_1 . ?e_2 <pred:name> "West Virginia" .   }
Program:
function: Find
inputs: West Virginia
function: Relate
dependencies: 0
inputs: shares border with
forward
function: Find
inputs: Virginia
function: And
dependencies: 1
2
function: Relate
dependencies: 3
inputs: located in the administrative territorial entity
backward
function: FilterConcept
dependencies: 4
inputs: independent city
function: Count
dependencies: 5