identities: divide getRelations into few functions.