Determining whether a relationship is a function