Gallery is a type of Building. Building is related to Palace. Palace is a type of Residence. 
Knock is related to Door. 
Gallery --IsA--> Building <--RelatedTo--> Palace --IsA--> Residence 
Knock <--RelatedTo--> Door 