Bug 418494 - [Flock] Support cascading deletes
Summary: [Flock] Support cascading deletes
Status: REOPENED
Alias: None
Product: Epsilon
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Louis Rose CLA
QA Contact:
URL:
Whiteboard: interim
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-02 06:53 EDT by Louis Rose CLA
Modified: 2014-08-07 12:18 EDT (History)
4 users (show)

See Also:


Attachments
Test Case (3.10 KB, application/zip)
2014-08-07 12:18 EDT, Horacio Hoyos CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Louis Rose CLA 2013-10-02 06:53:01 EDT
Horacio and Dimitris have identified a need for deleting a model element and all of its children as part of a model migration strategy. Whilst this can be achieved via a post block, it would be helpful to have first-class support for this in the language.
Comment 1 Louis Rose CLA 2013-10-02 07:02:04 EDT
My proposed syntax for this feature is:

@cascade
delete Type

I've pushed an initial implementation in SVN r2411.

The test cases are in SVN and also here:
https://gist.github.com/louismrose/6792033

Before I mark this as fixed and add user documentation, do you have any thoughts? I'll ping Horacio too.
Comment 2 Dimitris Kolovos CLA 2013-10-10 17:58:53 EDT
@cascade looks good. +1 from me!
Comment 3 Antonio Garcia-Dominguez CLA 2013-10-10 19:06:44 EDT
Looks good to me as well :-).
Comment 4 Louis Rose CLA 2013-10-11 03:05:46 EDT
Thanks chaps. I'm going to mark this as fixed for now, but might reopen after speaking with Horacio about his use case.
Comment 5 Horacio Hoyos CLA 2013-10-15 07:31:41 EDT
I have finally managed to test this and in my use case it seems to be working ok. I will continue to use is and see how it goes. I will report any issues here. Any idea on when this will go into release?
Comment 6 Louis Rose CLA 2013-10-15 08:04:12 EDT
Great -- thanks Horacio. Do keep us posted.

This will make it into the next release, though we're not quite sure when that will be yet.
Comment 7 Dimitris Kolovos CLA 2013-11-12 17:35:51 EST
Fixed in the latest interim version.
Comment 8 Horacio Hoyos CLA 2014-01-28 08:32:36 EST
Hi,

I have found a case where the cascade behavior seems to be not working. I haven't been able to pinpoint the cause. So far the only difference I find with the cases were it is working is the  multiplicity of the containment associations. 

I'll do more testing to see if I can figure out the cause. Sorry that I can't provide a test case, but the current state of the project makes it very hard to setup in someone else's environment. 

Regards,
Comment 9 Louis Rose CLA 2014-03-07 06:46:44 EST
Are there any updates on this?
Comment 10 Horacio Hoyos CLA 2014-06-05 12:50:48 EDT
Hi, haven't had much time to go over this. However, it seems to be related to delete and migrate rules for the same type not being exclusive. But I don't know how Flock decides between delete and merge in such cases.
Comment 11 Horacio Hoyos CLA 2014-08-06 10:27:34 EDT
Louis,

Can you comment on how this works for types with super types. It seems the issues I am having are related with the cascade operation not deleteting attributes inherited from super classes but only the ones defined in the type. 

Regards,
Comment 12 Horacio Hoyos CLA 2014-08-07 12:18:38 EDT
Created attachment 245809 [details]
Test Case

Finally managed to put an example togethere. The metamodel is a striped down version of the QVTc metamodel I actually use. I have to simple rules, one to delete nested (local) Mappings and one to delete unnamed domains. If you run the migration you will see that the nameless domian in Mapping CToD is correctly deleted in cascade (its guard and bottom patterns are deleted too). However, altough the nested mapping in AToB is deleted, its guard and bottom patterns are not and end up at the root level. 

I am convinced is something related to inheritance, but not sure what exactly. Maybe multiple inheritance?

Hope the example helps.