Garlic is the opposite of Onion. Onion is related to Vegetable. Pepper is a type of Vegetable. Pepper is related to Companion. 
Purpose is related to Function. 
Garlic <--Antonym--> Onion <--RelatedTo--> Vegetable <--IsA-- Pepper <--RelatedTo--> Companion 
Purpose <--RelatedTo--> Function 