Question: What port city is from the part of the peninsula having the country of Portugal?
Choices:
Barcelona
Tianjin
İzmir
Alexandria
Andorra
Odessa
Gibraltar
Fremantle
Basra
Busan
Program:
function: Find
inputs: Portugal
function: Relate
dependencies: 0
inputs: country
backward
function: FilterConcept
dependencies: 1
inputs: peninsula
function: Relate
dependencies: 2
inputs: has part
forward
function: FilterConcept
dependencies: 3
inputs: port city
function: What
dependencies: 4
SPARQL: SELECT DISTINCT ?e WHERE { ?e <pred:instance_of> ?c . ?c <pred:name> "port city" . ?e_1 <has_part> ?e . ?e_1 <pred:instance_of> ?c_1 . ?c_1 <pred:name> "peninsula" . ?e_1 <country> ?e_2 . ?e_2 <pred:name> "Portugal" .   }
Answer: Gibraltar