Question: For the state that has a diplomatic relationship with Japan (the subject of this statement is Denmark–Japan relations), with which historical country does it share a border?
Choices: United Kingdom
Sweden
Swedish Empire
Kingdom of Hungary
Union of South Africa
European Union
German Empire
Germany
Second French Empire
Confederate States of America
SPARQL: SELECT DISTINCT ?e WHERE { ?e <pred:instance_of> ?c . ?c <pred:name> "historical country" . ?e <shares_border_with> ?e_1 . ?e_1 <pred:instance_of> ?c_1 . ?c_1 <pred:name> "state" . ?e_1 <diplomatic_relation> ?e_2 . ?e_2 <pred:name> "Japan" . [ <pred:fact_h> ?e_1 ; <pred:fact_r> <diplomatic_relation> ; <pred:fact_t> ?e_2 ] <statement_is_subject_of> ?qpv . ?qpv <pred:value> "Denmark–Japan relations" .   }
Program:
function: Find
inputs: Japan
function: Relate
dependencies: 0
inputs: diplomatic relation
backward
function: QFilterStr
dependencies: 1
inputs: statement is subject of
Denmark–Japan relations
function: FilterConcept
dependencies: 2
inputs: state
function: Relate
dependencies: 3
inputs: shares border with
backward
function: FilterConcept
dependencies: 4
inputs: historical country
function: What
dependencies: 5
Answer: German Empire