An ecological niche is the role an organism plays in a community in terms of the habitat it occupies, e.g., both a wolf and the wolf spider are predators. So they occupy the same ecological niche, albeit in a different habitat (even though they can live together in the same area, the habitat of the spider is of course much smaller than that of the wolf). While the lynx and the wolf could occupy the same ecological niche, which means they then would have to compete for the same resources (prey). So there can be ecological niches such as: predator, herbivore, detrivore, etc.