QualifiedAssociations
This page was created by Hans.karlsen@mdriven.net on 2025-01-19. Last edited by Stephanie@mdriven.net on 2025-02-28.

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.

MDriven Chat

How would you like to chat today?

Setting up your conversation…

This may take a few moments