QualifiedAssociations

Qualified associations are many-ends of associations that can be reduced to 1 result of the many by sending in qualifier in the brackets at the end of the many-end:

SomeObject.SomeManyObjectsAssociation[someQualifier1,someQualifier2] : OneObject of type element type of the ManyAssociation.

The Qualification is done by locating a method following the pattern Qualify_<SomeManyObjectsAssociation>(someQualifier1,someQualifier2):ObjectType

If no such method is found a generic operator accepting integer as qualifier is used - and the result is corresponding to the at0 operator

Example

If I have this:

Documentation QualifiedAssociations 1739788976152.png

I can introduce a method on NewClassAddedNow:

Qualify_ThingWithQualifyTest(someQualifier:String):Thing

And I can define the body in EAL (or in c# if I want) to something like this:

self.ThingWithQualifyTest->select(a|a.Attribute1=someQualifier)->first

And if this in place, you can use the qualifier operator like this:

Documentation QualifiedAssociations 1739789157620.png

Gotchas: Remember to mark your Qualify_<> method as IsQuery=true if you want to use the the qualifier operator in OCL and not only EAL.

This page was edited 16 days ago on 02/28/2025. What links here