Question: How many counties of Massachusetts border Norfork County or Essex County (the one whose Dewey Decimal Classification is 2--7445) ?
Choices:
2
3
4
5
6
7
8
9
10
11
Answer: 5
SPARQL: SELECT (COUNT(DISTINCT ?e) AS ?count) WHERE { ?e <pred:instance_of> ?c . ?c <pred:name> "county of Massachusetts" .  { ?e_1 <shares_border_with> ?e . ?e_1 <pred:name> "Norfolk County" .  } UNION { ?e <shares_border_with> ?e_1 . ?e_1 <pred:name> "Essex County" . ?e_1 <Dewey_Decimal_Classification> ?pv . ?pv <pred:value> "2--7445" .  } }
Program:
function: Find
inputs: Norfolk County
function: Relate
dependencies: 0
inputs: shares border with
forward
function: FilterConcept
dependencies: 1
inputs: county of Massachusetts
function: Find
inputs: Essex County
function: FilterStr
dependencies: 3
inputs: Dewey Decimal Classification
2--7445
function: Relate
dependencies: 4
inputs: shares border with
backward
function: FilterConcept
dependencies: 5
inputs: county of Massachusetts
function: Or
dependencies: 2
6
function: Count
dependencies: 7