AQL for deleting edges to/from alias [message #1824186] |
Thu, 09 April 2020 08:25  |
Akira Tanaka Messages: 98 Registered: March 2010 |
Member |
|
|
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 435 times)
Attachment: Diagram2.png
(Size: 36.97KB, Downloaded 254 times)
Attachment: Diagram3.png
(Size: 16.44KB, Downloaded 227 times)
Attachment: Diagram4.png
(Size: 22.65KB, Downloaded 224 times)
Attachment: Diagram0.png
(Size: 37.23KB, Downloaded 232 times)
[Updated on: Thu, 09 April 2020 08:32] Report message to a moderator
|
|
|
|
|
Re: AQL for deleting edges to/from alias [message #1824234 is a reply to message #1824198] |
Fri, 10 April 2020 13:26   |
|
Hello Akira,
II found a solution but I had to modify your metamodel.
In your tool when you try to remove the link associated with the alias with the request : aql:self.eContainer().eContents().eCrossReferences()->filter(network::Alias)->select(i|i.representing.name=self.target.name)->asOrderedSet()
Your context is on an alias and when you make this request aql:j.oclAsType(DNode).incomingEdges.target+ j.oclAsType(DNode).outgoingEdges.target ->asOrderedSet(), j corresponds to an allias and not to an DNode is therefore the reason why it does not delete the link in the model.
I modified your metamodel to add a reference opposite to the representation reference.
I attach the new metamodel and the odesign.
Regards,
|
|
|
|
Powered by
FUDForum. Page generated in 0.01800 seconds