Added setter and getter functions to classes.

In addition, some more functions are added to be used by mapping
steps to keep the instance caching accurate during duplicate removal or
schema flattening.