Reflexive many-to-many relationships

This adds support for reflexive many-to-many relationships.