Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » URGENT: Edge delete on Element deletion(deadline for my project is 16/08)
URGENT: Edge delete on Element deletion [message #1770042] Mon, 07 August 2017 17:29 Go to next message
sonny selhorst is currently offline sonny selhorstFriend
Messages: 60
Registered: May 2015
Member
Dear,

In my metamodel, I have an Entity, Role and BinaryRelationship class. All these are connected so that in my diagram, I can create two entities and create a BinaryRelationship between these. Now, when I delete the entity container, the relationship edge is deleted from the diagram, but not from the model.

index.php/fa/30305/0/

I have tried working with a delete tool and then having a remove with a "change context: aql:self.eInverse().binaryrelationship" upon which another remove is performed, as I thought that that would be the solution, but nothing seems to be working. I have tried quite some statements in the change context.

Any help would be greatly appreciated.



Kind regards,
Sonny Selhorst

[Updated on: Sun, 13 August 2017 13:26]

Report message to a moderator

Re: Edge delete on Element deletion [message #1770147 is a reply to message #1770042] Tue, 08 August 2017 15:29 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 270
Registered: August 2010
Senior Member
Hi Sonny,

I don't know all the details of your odesign but the BinaryRelationship seems contained in a role, your delete tool has to retrieve the role connected to your entity and remove it ?

Regards,
Florian
Re: Edge delete on Element deletion [message #1770154 is a reply to message #1770147] Tue, 08 August 2017 16:15 Go to previous messageGo to next message
sonny selhorst is currently offline sonny selhorstFriend
Messages: 60
Registered: May 2015
Member
Dear Florian,

Thank you for your reply.

I think that it might be a better question for me to ask when an edge gets deleted from the model? Shouldn't it be deleted as soon as the source/target gets deleted? If not, how would I go around deleting it?

Let me simplify this by asking it about a simpler version of the metamodel as in the picture:
When a RelationshipNode (target) or Entity (source) gets deleted, the Relationship is also automatically deleted.

Thank you very much for your help.

Kind regards,
Sonny
Re: Edge delete on Element deletion [message #1770219 is a reply to message #1770154] Wed, 09 August 2017 07:37 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 270
Registered: August 2010
Senior Member
If a source or a target figure is deleted, the edge is no more visible even if the semantic element on which it relies on is still there. It is the responsibility of your delete tool to let the model in a consistent state. So if a source (semantic) is deleted, you have to clean (in the same delete tool) all impacted model elements.

Regards,

Florian
Re: Edge delete on Element deletion [message #1770275 is a reply to message #1770219] Wed, 09 August 2017 14:54 Go to previous messageGo to next message
sonny selhorst is currently offline sonny selhorstFriend
Messages: 60
Registered: May 2015
Member
Dear,

Thank you for your answer, I already thought that that was the case. So I make a Delete Element tool for the EntityContainer mapping. In the begin function I add a remove (to delete the Entity semantic element) and then a change context right? Now what do I refer to in my Browse expression for the change context? And do I then include an unset or a remove? This is what I'm trying out now, but it's not working.

Kind regards,

Sonny Selhorst


Re: Edge delete on Element deletion [message #1770508 is a reply to message #1770275] Sun, 13 August 2017 13:25 Go to previous messageGo to next message
sonny selhorst is currently offline sonny selhorstFriend
Messages: 60
Registered: May 2015
Member
Dear,

The deadline for this project is 16/08 and I would like to have this fixed. I've tried all sorts of things but can't seem to find the right solution. If anyone could help me that would be greatly appreciated!

Kind regards,
Sonny Selhorst
Re: Edge delete on Element deletion [message #1770548 is a reply to message #1770275] Mon, 14 August 2017 09:18 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi Sonny,
I don't know your metamodel but the process should be the following in your delete tool of entity mapping:

1-first you set a context that point out to all your relationships to remove with something like "aql:self.eContainer().relationship" where self is the entity model element and eContainer().relationship is the path to access the relationship concerned about your entity removal. I don't know your metamodel so it is up to you to find the right AQL expression to get your target relationship.

To help you you can use the Sirius interpreter view:
index.php/fa/30364/0/

If the result is not your relationship then your wrong.

If you can't manage to have the right AQL expression another solution is to use a service https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html#service_methods

to retrieve the relationship with java code


2- Then just add a remove operations under your context that will remove it from its container. To know what to use, you can read the documentation about operations https://www.eclipse.org/sirius/doc/specifier/general/Model_Operations.html#unset

3-you deleted your relationship. You can now delete your entity by changing context to element (var:element) that is your entity model element.

4-add a remove operation and your done.

Regards


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Edge delete on Element deletion [message #1770561 is a reply to message #1770548] Mon, 14 August 2017 12:49 Go to previous messageGo to next message
sonny selhorst is currently offline sonny selhorstFriend
Messages: 60
Registered: May 2015
Member
Dear,

First of all, I wish that I knew how the interpreter worked when I began with developing my tool, it would have helped me a lot. It might be a good idea to incorporate it in the documentation of AQL or one of the tutorials.

That said, I have found the elements to which I am referring with the following statement: aql:self.incomingEdges.semanticElements

Now, when I incorporate it in my design, it doesn't delete the elements, what would I be doing wrong?
index.php/fa/30366/0/

I hope this gets to you in time.

Kind regards,
Sonny Selhorst
Re: Edge delete on Element deletion [message #1770563 is a reply to message #1770561] Mon, 14 August 2017 13:22 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
your expression returns all semantic elements of all incoming edges. Remove applies on one element not on a list. So you should have a for loop with aql:self as expression and the remove inside.

Anyway your approach seems not the best to me because you take all edges even some that can not be the one you want if you add or already have different edges mappings pointing on entities. Generally we prefer cross the semantic model from element.

You also can use the sirius interpreter on your model opened with default ecore editor.


For the documentation part, the interpreter is described in https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html#general

But it could have its own title I agree.

For the tutorial part, yes it could also be good to have it inside. I will spread the word. Thanks for feedback


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

[Updated on: Mon, 14 August 2017 13:50]

Report message to a moderator

Re: Edge delete on Element deletion [message #1770638 is a reply to message #1770563] Tue, 15 August 2017 13:31 Go to previous message
sonny selhorst is currently offline sonny selhorstFriend
Messages: 60
Registered: May 2015
Member
Dear Pierre,

Thank you very much for all the help. It has worked by using a for loop that selects the correct edges and deletes them.
Previous Topic:Table Editors
Next Topic:[Solved] Edge Routing Style
Goto Forum:
  


Current Time: Thu Apr 18 12:34:21 GMT 2024

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

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

Back to the top