Suppose I have the following model ;
model Test
&nbps;&nbps;&nbps; class A
&nbps;&nbps;&nbps; end
&nbps;&nbps;&nbps; class B
&nbps;&nbps;&nbps; end
&nbps;&nbps;&nbps; composition contains
&nbps;&nbps;&nbps; between
&nbps;&nbps;&nbps;&nbps;&nbps;&nbps;&nbps; A[1..1] role a
&nbps;&nbps;&nbps;&nbps;&nbps;&nbps;&nbps; B[1..*] role bs ordered
&nbps;&nbps;&nbps; end
When I insert several links in the association, the insertion ordered is not preserved
!new A('A')
!new B('B1')
!new B('B2')
!insert (@A,@B1) into contains
!insert (@A,@B2) into contains
I would expect the following to be true
?@A.bs->first() = @B1
but the behavior is not consistent, sometimes it works some other doesn't.
see attached image for illustration
Hello,
the support for 'ordered' is unfortunately broken in USE.
This is a bug and has to be fixed. However, it looks that this might take a little while (as far as I can tell at the moment).
The only workaround I can suggest right now is to replace the ordered association by a Sequence-typed attribute. So for the instantiation you would replace 'insert' by 'set'. However, multiplicity checking and inverse end navigation will be missing and would need to be replaced by additional constraints resp. a query operation modeling the the inverse navigation.
Best regards
Fabian
- Insertion order is kept
- Adding at specific index is still not working (Feature request to SOIL)
- The issue was fixed in 3.0.3 but not marked as resolved