Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Cascade deletes for link modeled as EClass
Cascade deletes for link modeled as EClass [message #724548] Mon, 12 September 2011 15:13 Go to next message
Hernan Gonzalez is currently offline Hernan GonzalezFriend
Messages: 188
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
I'm using Ecore, my model (simplified here) consists of nodes connected with directional links. I chose to model each link as an EClass (instead of just a reference) because it might include some extra attributes.

Hence, I have :

        [MyNode]                         [MyNode]
         myNodeA  ---------------------> myNodeB
               (src)    myLink1  (target)
                        [MyLink]


Each link must have a valid source and target.
The target node is the node who contains the links.

My ecore definition is basically:

 MyNode (EClass) 
    attribute: links     (0..* containment=true )

 MyLink (EClass)
    attribute: src    
       (lowerBound=upperBound=1) 
    attribute: target 
       (lowerBound=upperBound=1 container=true opposite=links)


It works as expected, except that I'd like that when the src node (myNodeA) is removed, the link also is removed. I expected that having lowerBound=1 in MyLink.src would imply this, but it doesnt, the link survices, with an empty src.
Any ideas?

[Updated on: Mon, 12 September 2011 15:14]

Report message to a moderator

Re: Cascade deletes for link modeled as EClass [message #724570 is a reply to message #724548] Mon, 12 September 2011 15:25 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Hernan,
Cascade deletes seem to imply that you use CDO or Teneo, is that correct? Can you give some more information on the
toolset you are using?

gr. Martin

On 09/12/2011 05:13 PM, Hernan wrote:
> I'm using Ecore, my model (simplified here) consists of nodes connected with directional links. I chose to model each
> link as an EClass (instead of just a reference) because it might include some extra attributes.
>
> Hence, I have :
>
> [MyNode] [MyNode]
> myNodeA ---------------------> myNodeB
> (src) myLink1 (target)
> [MyLink]
>
> The target node is the node who contains the links. Each link must have a valid source and target.
>
> MyNode (EClass) attribute: links (0..* containment=true )
>
> MyLink (EClass)
> attribute: src (lowerBound=upperBound=1) attribute: target (lowerBound=upperBound=1 container=true opposite=lines)
>
> It works as expected, except that I'd like that when the src node (myNodeA) is removed, the link also is removed. I
> expected that having lowerBound=1 in MyLink.src would imply this, but it doesnt, the link survices, with an empty src.
> Any ideas?


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Cascade deletes for link modeled as EClass [message #724574 is a reply to message #724570] Mon, 12 September 2011 15:31 Go to previous messageGo to next message
Hernan Gonzalez is currently offline Hernan GonzalezFriend
Messages: 188
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
Martin taal wrote on Mon, 12 September 2011 12:25
Hi Hernan,
Cascade deletes seem to imply that you use CDO or Teneo, is that correct? Can you give some more information on the
toolset you are using?


No, I'm using plain EMF (with Graphiti). By "cascade delete" I just mean to describe the expected behaviour: as well as, when I delete a "Target" (container) node the link is implicitly removed, I wish that the same happens when I delete the "Source".
Re: Cascade deletes for link modeled as EClass [message #724607 is a reply to message #724548] Mon, 12 September 2011 15:37 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Hernan,

It sounds like you'd need to specialize what DeleteCommand does.
Normally it follows all the containment references of the things to be
deleted and also remove all references to any object in that subtree.
In your case, you'd want it to follow this non-containment reference as
if it were a containment reference, or you could explicitly include the
link object as part of the set of objects to be removed so that it's
traversed and included in the usual way.


On 12/09/2011 8:13 AM, Hernan wrote:
> I'm using Ecore, my model (simplified here) consists of nodes
> connected with directional links. I chose to model each link as an
> EClass (instead of just a reference) because it might include some
> extra attributes.
>
> Hence, I have :
>
> [MyNode] [MyNode]
> myNodeA ---------------------> myNodeB
> (src) myLink1 (target)
> [MyLink]
>
> The target node is the node who contains the links. Each link must
> have a valid source and target.
>
> MyNode (EClass) attribute: links (0..* containment=true )
>
> MyLink (EClass)
> attribute: src (lowerBound=upperBound=1) attribute:
> target (lowerBound=upperBound=1 container=true opposite=lines)
>
> It works as expected, except that I'd like that when the src node
> (myNodeA) is removed, the link also is removed. I expected that having
> lowerBound=1 in MyLink.src would imply this, but it doesnt, the link
> survices, with an empty src. Any ideas?


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] Examples for CDO/Hibernate Store/Quick Start
Next Topic:Two CDO servers on one DB
Goto Forum:
  


Current Time: Mon Sep 23 10:41:19 GMT 2024

Powered by FUDForum. Page generated in 0.03282 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top