I'm trying to navigate UML associations in OCL, using the eclipse OCL implementation. I know that UML Associations are treated as Attributes, and the getAttributes() function called on a Class will return a set containing the Attributes as well as a Property object for each Association. What I need however, is not the Property, but the Class on the other end of the Association.
For bidirectional Associations, the following code works, although it doesn't seem very elegant:
self.getAllAttributes().opposite.class
Not only is it not elegant, it also doesn't work on directed Associations (there is not opposite Property there). Is there a better way of navigating Associations in OCL?
What about using property.type?