Cascade deletes for link modeled as EClass [message #724548] |
Mon, 12 September 2011 15:13 |
Hernan Gonzalez 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 |
Martin Taal 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 #724607 is a reply to message #724548] |
Mon, 12 September 2011 15:37 |
Ed Merks 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/
|
|
|
Powered by
FUDForum. Page generated in 0.03282 seconds