Question: What country holds the headquarters location of Hewlett-Packard in Palo Alto (that is headed by a mayor)?
Choices: Canada
Bangladesh
Indonesia
Monaco
Estonia
Pakistan
United Arab Republic
United States of America
Bhutan
Saudi Arabia
SPARQL: SELECT DISTINCT ?qpv WHERE { ?e_1 <pred:name> "Hewlett-Packard" . ?e_2 <pred:name> "Palo Alto" . ?e_2 <office_held_by_head_of_government> ?e_3 . ?e_3 <pred:name> "mayor" . ?e_1 <headquarters_location> ?e_2 . [ <pred:fact_h> ?e_1 ; <pred:fact_r> <headquarters_location> ; <pred:fact_t> ?e_2 ] <country> ?qpv .  }
Program:
function: Find
inputs: Hewlett-Packard
function: Find
inputs: mayor
function: Relate
dependencies: 1
inputs: office held by head of government
backward
function: Find
inputs: Palo Alto
function: And
dependencies: 2
3
function: QueryRelationQualifier
dependencies: 0
4
inputs: headquarters location
country
Answer: United States of America