Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Delete relation in model if source/target node is deleted
Delete relation in model if source/target node is deleted [message #1733617] Mon, 30 May 2016 12:36 Go to next message
Axel Guckelsberger is currently offline Axel GuckelsbergerFriend
Messages: 354
Registered: July 2009
Senior Member
Hi,

when a node is deleted from the diagram it is also properly removed in
the model file. Any relations connected with this node are also removed
from the diagram. But in the model they are still existing, just their
source/target attribute (referencing the meta model element which was
represented by the node) is reset. This causes validation problems later on.
I would need to remove also all relation elements together with the
deleted node. Is there any way to achieve this?

Thanks!

Axel
Re: Delete relation in model if source/target node is deleted [message #1733618 is a reply to message #1733617] Mon, 30 May 2016 12:45 Go to previous messageGo to next message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 300
Registered: July 2009
Senior Member
Le 30/05/2016 à 14:36, Axel Guckelsberger a écrit :
> Hi,
>

Hi,

> when a node is deleted from the diagram it is also properly removed in
> the model file. Any relations connected with this node are also removed
> from the diagram. But in the model they are still existing, just their
> source/target attribute (referencing the meta model element which was
> represented by the node) is reset. This causes validation problems later
> on.
> I would need to remove also all relation elements together with the
> deleted node. Is there any way to achieve this?
>

You can use a "Delete Element" tool for this or maybe associate the
"relation" in the "associated elements expression" of your node mapping.
You can read the documentation [1] for more details.


> Thanks!
>
> Axel

Regards,

[1]
http://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#delete_tool

--
Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius


Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Delete relation in model if source/target node is deleted [message #1733628 is a reply to message #1733618] Mon, 30 May 2016 14:05 Go to previous messageGo to next message
Axel Guckelsberger is currently offline Axel GuckelsbergerFriend
Messages: 354
Registered: July 2009
Senior Member
Hi Laurent,

thanks for this hint. I am trying to get a custom Delete Element tool working.
I added a "For" operation which contains a "Remove" operation. The For loop has the following expression: aql:element.application.relations->select(source = element or target = element) trying to select all relationship elements pointing to the node element being deleted.
With this addition it is not possible to remove a node at all anymore (like if I had set the precondition to false).
Is there any example available where I can take a look at how things must be configured?
Re: Delete relation in model if source/target node is deleted [message #1733641 is a reply to message #1733628] Mon, 30 May 2016 15:34 Go to previous messageGo to next message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 300
Registered: July 2009
Senior Member
Le 30/05/2016 à 16:05, Axel Guckelsberger a écrit :
> Hi Laurent,
>
> thanks for this hint. I am trying to get a custom Delete Element tool
> working.
> I added a "For" operation which contains a "Remove" operation. The For
> loop has the following expression:
> aql:element.application.relations->select(source = element or target =
> element) trying to select all relationship elements pointing to the node
> element being deleted.
> With this addition it is not possible to remove a node at all anymore
> (like if I had set the precondition to false).
> Is there any example available where I can take a look at how things
> must be configured?

You have some examples of DeleteElementDescription in EcoreTools [1] and
in UmlDesigner [2].

[1]
http://git.eclipse.org/c/ecoretools/org.eclipse.ecoretools.git/tree/org.eclipse.emf.ecoretools.design/description/ecore.odesign
[2]
https://github.com/ObeoNetwork/UML-Designer/blob/master/plugins/org.obeonetwork.dsl.uml2.design/description/uml2.odesign

--
Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius


Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Delete relation in model if source/target node is deleted [message #1733738 is a reply to message #1733641] Tue, 31 May 2016 10:13 Go to previous message
Axel Guckelsberger is currently offline Axel GuckelsbergerFriend
Messages: 354
Registered: July 2009
Senior Member
Thank you Laurent,

I got it working by doing the following amendments:

1. Added a missing "Change context" operation as a first one containing all other operations.
2. Added a "Remove" operation after the "For" loop for deleting the node element itself.
3. Changed to "For" expression to aql:element.application.relations->select(rel | rel.source = element or rel.target = element)
Previous Topic:Sirius Palette: problems in edge creation
Next Topic:Type/Style/Class not found during VSM validation
Goto Forum:
  


Current Time: Fri Mar 29 06:13:52 GMT 2024

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

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

Back to the top