Only return same relationship once.

If providing the same RelationshipType more than once to the
getRelationships() method of Node, one would get relationships of that
type more than once. This change deduplicates the types, ensuring that
each relationship is returned no more than once.

This fixes #1477.