Supports multiple disjoint id spaces within the same IdMapper

Each id given to IdMapper is accompanied a Group with an id. Looking up a
value in the IdMapper requires to pass a predicate for matching ids.

Currently this functionality isn't yet used by Input implementations, but
that can be viewed as a separate concern, where this commit is just for
enabling the feature.