Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » OCL - Link Constraint
OCL - Link Constraint [message #650225] Sun, 23 January 2011 12:32 Go to next message
Thorsten Koch is currently offline Thorsten KochFriend
Messages: 5
Registered: January 2011
Junior Member
I want to avoid links between some classes.
In my model i defined a superclass A which contains a reference sourceConnections in order to save all the connections. This superclass is an abstract one.
I defined another three classes (B,C,D) which have all class A as a superclass.

Now I want to avoid links between C and D and B and C.
I have read the article about the link constraint ( http://wiki.eclipse.org/index.php/GMF_Constraints#Link_Const raints). But this does not really help me. I do not know how to define the constraint.

I tried:

self <> oppositeEnd and ( (self.oclIsTypeOf(C) and oppositeEnd.oclIsTypeOf(D)) or (self.oclIsTypeOf(B) and oppositeEnd.oclIsTypeOf(C)) )

But then i got the error message, that the variables C, D and B are not recognized.
This there another way to define such a constraint.

[Updated on: Sun, 23 January 2011 12:33]

Report message to a moderator

Re: OCL - Link Constraint [message #650309 is a reply to message #650225] Mon, 24 January 2011 10:44 Go to previous messageGo to next message
Romain Bioteau is currently offline Romain BioteauFriend
Messages: 65
Registered: August 2009
Location: Grenoble
Member
What about using Java to define those constraints ?
I'm sure you're more familar with this language, Am I right ?

However your ocl type must have this format :

oclIsType(EcorePackageName::TypeName), it's maybe the reason of the variable not found

HTH
Romain


R&D Engineer at BonitaSoft
Re: OCL - Link Constraint [message #650738 is a reply to message #650225] Wed, 26 January 2011 10:43 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

your code is looking ok. I have similar coder running that checks for a type and works fine. Maybe you should try you OCL statement part by part with the OCL Interpreter View. Take a look at this link on how to use it: http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. ocl.doc/references/examples/oclInterpreterExample.html

Ralph

[Updated on: Wed, 26 January 2011 11:02]

Report message to a moderator

Re: OCL - Link Constraint [message #651933 is a reply to message #650225] Wed, 02 February 2011 06:43 Go to previous message
Abhijit Gurav is currently offline Abhijit GuravFriend
Messages: 25
Registered: November 2010
Junior Member
Hi Thorsten,

U can try

"if oclIsKindOf(A) then not oppositeEnd.oclIsKindOf(A) else true endif"

in link constraint for Target End constraint

Regards,
-AG
Previous Topic:Teneo/Hibernate/GMF
Next Topic:automaticallly adding figure
Goto Forum:
  


Current Time: Fri Apr 19 22:06:47 GMT 2024

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

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

Back to the top