Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » OCL Link constraints for a link
OCL Link constraints for a link [message #223975] Thu, 02 April 2009 06:52 Go to next message
Sheela is currently offline SheelaFriend
Messages: 52
Registered: July 2009
Member
Hi,
We have developed a GMF based class editor.
Our class has two types of variables i.e input and output variables.
Now our requirement is to

1> link output variable of one class to input variable of other class.
2> output variable can link to only one input variable
3> input variable can be linked by only one output variable
4> no other linking should be allowed

can somebody suggest me the ocl expresson for this condition or any other
pointers?

thanks in advance

Sheela
Re: OCL Link constraints for a link [message #224046 is a reply to message #223975] Thu, 02 April 2009 10:52 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Sheela,

source constraint: self.vriableType = <pkg>::VatiableType::IN and self.connectedOut.oclIsUndefined()
target constraint: self.vriableType = <pkg>::VatiableType::OUT and self.connectedIn.oclIsUndefined()

To make it working you have to add connectedOut and connectedIn references
into IN/OUT elements of your model + make connectedIn reference an opposite
one to connectedOut.

-----------------
Alex Shatalin
Re: OCL Link constraints for a link [message #224572 is a reply to message #224046] Tue, 07 April 2009 05:39 Go to previous messageGo to next message
Sheela is currently offline SheelaFriend
Messages: 52
Registered: July 2009
Member
Hi,
Thanks for ur reply.
I have few more doubts .

1> Is it possible to know, how many links coming in and going out from a
particular node ?

2> Is it possible to get this info in the "canExecute()" method of class
LinkCreateCommand ?

3> If i dont want to manually validate this then What will be the OCL
constraints to check that there must be only one incoming and outgoing link
for a particular node,no other linking must be allowed?

4> Is there any tutorial for learning more on "How to use OCL constraints in
GMF" ?

Regards,
sheela
Re: OCL Link constraints for a link [message #224718 is a reply to message #224572] Tue, 07 April 2009 13:39 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Sheela,

> 1> Is it possible to know, how many links coming in and going out from
> a particular node ?
Only if this information is exposed in the domain model (usually it is).

> 2> Is it possible to get this info in the "canExecute()" method of
> class LinkCreateCommand ?
Yes. In LinkCreateCommand you have both source/target model elements so you
can access their properties (from the domain model).

> 3> If i dont want to manually validate this then What will be the OCL
> constraints to check that there must be only one incoming and outgoing
> link for a particular node,no other linking must be allowed?
something like:
SRC: self.ougtoingLinks.size() == 0
DST: self.incomingLinks.size() == 0

(there should be ougtoingLinks/incomingLinks references specified in link
src/dst domain model elements)

-----------------
Alex Shatalin
Previous Topic:label place
Next Topic:Conditionally enable/disable palette ..
Goto Forum:
  


Current Time: Fri Apr 19 22:27:59 GMT 2024

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

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

Back to the top