AQL for deleting edges to/from alias [message #1824186] |
Thu, 09 April 2020 04:25  |
Eclipse User |
|
|
|
Dear Sirius experts/users,
I am working on aql for deleting edges to/from alias model element. I would very much appreciate any suggestion or comment from you.
Since the real project is complex, I created a simplified version of ecore model and odesign file, which are for slightly extended network (node+link) diagramming tool based on Sirius.
[Ecore model]

Interesting part is an introduction of Alias pointing to original Node. Since diagram size increases, it is sometimes very useful to have alias element to represent common or important concepts to connect to at various places in the large diagram.
[Model Diagram]

Above sample diagram shows 3 nodes (A, B, and C) and 1 allias, representing node A, and links among them.
[The objective]
I would like to achieve the following. When deleting the original node (in this case, node A), any number of aliases representing original node should also be deleted with incoming/outgoing edges associated with them.
[Curent status]
I am able to delete diagram elements, but am not able to delete semantic element. In this case, if I delete node A, the result looks like:

However the model file looks like this, and I get error messages when trying to save the file (because of those undeleted elements).

[Delete tool for Node]

Code for loop i, j, k are:
i: aql:elementView.incomingEdges.target + elementView.outgoingEdges.target ->asOrderedSet()
j: aql:self.eContainer().eContents().eCrossReferences()->filter(network::Alias)->select(i|i.representing.name=self.name)->asOrderedSet()
k: aql:j.oclAsType(DNode).incomingEdges.target+ j.oclAsType(DNode).outgoingEdges.target ->asOrderedSet()
It seems i works but j and k do not work. I would appreciate any comment or suggestion.
Thank you very much in advance.
Akira
Attachment: Diagram1.png
(Size: 41.76KB, Downloaded 594 times)
Attachment: Diagram2.png
(Size: 36.97KB, Downloaded 385 times)
Attachment: Diagram3.png
(Size: 16.44KB, Downloaded 371 times)
Attachment: Diagram4.png
(Size: 22.65KB, Downloaded 367 times)
Attachment: Diagram0.png
(Size: 37.23KB, Downloaded 371 times)
[Updated on: Thu, 09 April 2020 04:32] by Moderator
|
|
|
|
|
|
Re: AQL for deleting edges to/from alias [message #1824241 is a reply to message #1824234] |
Fri, 10 April 2020 10:44  |
Eclipse User |
|
|
|
Dear Julien,
Thank you very much for the solution. I really appreciate it. Actually I thought about this (i.e. adding opposite reference) but did not try, since Node A in my real project plays an important role with lots of properties and I did not want to add further properties (opposite references [compatibility with legacy tool was another reason]) at that time. That's why I tried rather complex AQL statements. However, by looking at how things work, I think this approach is simpler, requires no human interaction(input) to add opposite direction properties to Node A, and so I should take your approach.
Thank you very much for your help.
Best regards,
Akira
|
|
|
Powered by
FUDForum. Page generated in 0.07313 seconds