🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Parsed/QualifiedAssociations
This page was created by PageReplicator on 2025-09-01. Last edited by PageReplicator on 2025-09-01.

Template:Notice



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 <a href="/Documentation:OCLOperators_at0" title="Documentation:OCLOperators at0" data-bs-title="Documentation:OCLOperators_at0">at0 operator</a>

Example[<a href="/index.php?title=Documentation:QualifiedAssociations&veaction=edit&section=1" class="mw-editsection-visualeditor" title="Edit section: Example" data-bs-title="Documentation:QualifiedAssociations">edit</a> | <a href="/index.php?title=Documentation:QualifiedAssociations&action=edit&section=1" title="Edit section: Example" data-bs-title="Documentation:QualifiedAssociations">edit source</a>]

If I have this:

<a href="/File:Documentation_QualifiedAssociations_1739788976152.png" class="image" data-bs-title="File:Documentation_QualifiedAssociations_1739788976152.png" data-bs-filetimestamp="20250217104256"><img alt="Documentation QualifiedAssociations 1739788976152.png" src="/images/1/15/Documentation_QualifiedAssociations_1739788976152.png" decoding="async" width="836" height="279" class="thumbimage" /></a>
<a href="/File:Documentation_QualifiedAssociations_1739788976152.png" class="internal" title="Enlarge"></a>

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:

<a href="/File:Documentation_QualifiedAssociations_1739789157620.png" class="image" data-bs-title="File:Documentation_QualifiedAssociations_1739789157620.png" data-bs-filetimestamp="20250217104558"><img alt="Documentation QualifiedAssociations 1739789157620.png" src="/images/thumb/a/a3/Documentation_QualifiedAssociations_1739789157620.png/769px-Documentation_QualifiedAssociations_1739789157620.png" decoding="async" width="769" height="309" class="thumbimage" srcset="/images/a/a3/Documentation_QualifiedAssociations_1739789157620.png 1.5x" /></a>
<a href="/File:Documentation_QualifiedAssociations_1739789157620.png" class="internal" title="Enlarge"></a>

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.