Role learning in artificial intelligence