Quite new to OCL, thanks for the help.
So I have a profile with the stereotypes as shown:
Can someone tell me how to write an invariant constraint that says any association that is Coloured means that all connected classes must have the same colour value in their colour property?
I had this so far:
Context UML::InfrastructureLibrary::Core::Constructs::Association
inv: Association.allInstances() -> forAll(a:Association|a.oclIsTypeOf(Coloured) implies
a.associatedElement.colour = a.colour)
Pretty sure this is wrong because a.associatedElement does not exist.. but I do not understand how to access this 'all connected classes' or what that means. Perhaps I need something like
a.[association].colour
?
Thanks