|
|
|
Re: How to restrict multiple edge between two nodes [message #1795494 is a reply to message #1795488] |
Mon, 24 September 2018 09:52 |
Prajna VG Messages: 54 Registered: July 2018 |
Member |
|
|
Hi Laurent,
Thanks for replying..
I am using element based edge between two nodes.
Same edge I can create multiple times. But I want it like, it should not allow user to connect to that same target twice. From that source to other target node user can connect, but between same nodes it should not be able to create.
I thought it is possible by connection complete precondition.
[Updated on: Mon, 24 September 2018 09:56] Report message to a moderator
|
|
|
Re: How to restrict multiple edge between two nodes [message #1795581 is a reply to message #1795494] |
Tue, 25 September 2018 14:01 |
|
Hi Prajna,
To restrict number of edge on the target node, you should complete the connection Complete precondition by using preTarget variable.
For example, with an ecore model, you can write the following precondition :
aql:preTarget.eReferences->size()==0 where eReference is the object represented by the already created edge
If you want to check edge on target to not duplicate an other one, you can use a filter on the list of references. You can also call a service in your precondition expression according to complexity of your metamodel.
Regards,
Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Re: How to restrict multiple edge between two nodes [message #1795662 is a reply to message #1795593] |
Wed, 26 September 2018 13:41 |
|
Hi Prajna,
Indeed, you can use a service if you feel more confident than using aql expression
Nevertheless, in your Connection complete precondition, you should use preSource and preTarget variables instead of self variable.
Then, in your case, I think that aql:preSource.connectors->size()==0 do the same work as your precondition.
If you want to restrict creation of edge with other target, you can complete your precondition by checking if preTarget is already used as target of your connector by using select or excludes methods .
For example, with an ecore model, you can write the following precondition :
aql:preSource.eReferences->select(c|c.eType=preTarget)->size()==0 where eReference is the object represented by the created edge.
Regards,
Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Powered by
FUDForum. Page generated in 0.02022 seconds