Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to restrict multiple edge between two nodes
How to restrict multiple edge between two nodes [message #1795475] Mon, 24 September 2018 05:09 Go to next message
Prajna VGFriend
Messages: 54
Registered: July 2018
Member
Hi May I know how to restrict creation of multiple edges between two nodes. what expression to give in connection complete precondition to avoid creation of multiple edge.
Re: How to restrict multiple edge between two nodes [message #1795487 is a reply to message #1795475] Mon, 24 September 2018 08:20 Go to previous messageGo to next message
Jessy Mallet is currently offline Jessy MalletFriend
Messages: 10
Registered: July 2018
Junior Member
Hi Prajna,

If you want to restrict creation of multiple edges between two nodes, you can add Connection Start Precondition on edge tool which check that there is no edge created.
For example, on ecore model, you can use :
aql:preSource.eReferences->size()==0
if you edge create eReference

Regards,
Re: How to restrict multiple edge between two nodes [message #1795488 is a reply to message #1795475] Mon, 24 September 2018 09:15 Go to previous messageGo to next message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 174
Registered: October 2014
Senior Member
Hello

First, what edge do you use? Relation-based mapping or Element based mapping?
Then, the number of edges that will be displayed will depend on the SemanticCandiates Expression and /or the Target Finder expression

Regards
Laurent


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 #1795494 is a reply to message #1795488] Mon, 24 September 2018 09:52 Go to previous messageGo to next message
Prajna VGFriend
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 Go to previous messageGo to next message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 174
Registered: October 2014
Senior Member
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 #1795593 is a reply to message #1795581] Wed, 26 September 2018 04:38 Go to previous messageGo to next message
Prajna VGFriend
Messages: 54
Registered: July 2018
Member
Hi Laurent,

But that expression not working in my design. I tried using eReference, eCrossReference, filter, select, one, any aql keywords.

Only the following expression restricted the edge.

aql:self.eInverse().eContents(test::Connector)->size()=0

But it will restrict creating edge with other target also which I needed!!

So I think I need to use service method or some different tricky aql query!!
Re: How to restrict multiple edge between two nodes [message #1795662 is a reply to message #1795593] Wed, 26 September 2018 13:41 Go to previous message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 174
Registered: October 2014
Senior Member
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
Previous Topic:[ANN] Sirius 6.0.2 (with an important bugfix under Windows)
Next Topic:how can you navigate from a diagram to a table?
Goto Forum:
  


Current Time: Mon Jan 18 02:30:48 GMT 2021

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

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

Back to the top