Domanda

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?

È stato utile?

Soluzione

What about using property.type?

Altri suggerimenti

Why don't you try with the OCL console as explained in this post

http://lowcoupling.com/post/47845805110/ocl-and-the-eclipse-ocl-console

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top