(Created page with "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") |
No edit summary |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Edited|July|12|2025}} | |||
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: | 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: | ||
Line 4: | Line 5: | ||
The Qualification is done by locating a method following the pattern Qualify_<SomeManyObjectsAssociation>(someQualifier1,someQualifier2):ObjectType | 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 [[Documentation:OCLOperators at0|at0 operator]] | |||
==== Example ==== | |||
If I have this: | |||
[[File:Documentation QualifiedAssociations 1739788976152.png|none|thumb|836x836px]] | |||
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: | |||
[[File:Documentation QualifiedAssociations 1739789157620.png|none|thumb|769x769px]] | |||
'''Gotchas''': Remember to mark your Qualify_<> method as <code><span class="col-black">'''IsQuery=true'''</span></code> if you want to use the the qualifier operator in OCL and not only EAL. | |||
[[Category:Associations]] |
Latest revision as of 05:55, 28 February 2025
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:
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:
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.