Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Problem with Link Constraint (OCL)
Problem with Link Constraint (OCL) [message #480395] Sun, 16 August 2009 18:08 Go to next message
Ivo Petkov is currently offline Ivo PetkovFriend
Messages: 14
Registered: August 2009
Junior Member
Hi all,

If few words:
a CompositeMode is part of my model, it can contain subModes and conditionalConnectors, a connection between these two nodes exists, but I want to allow such connection if both nodes are in one and the same CompositeMode.

I tried with the following target link constraint in the GMFMAP:
CompositeMode.allInstances()->exists(cm| cm.subModes->exists(sm| sm = self) and cm.conditionalConnectors->exists(cc| cc = oppositeEnd))

and this doesn't work because allIntances doesn't work for me, here are the debug logs:

[OCL] Evaluate: remes::CompositeMode
[OCL] Result : org.eclipse.emf.ecore.impl.EClassImpl@9cd7cd (name: CompositeMode) (instanceClassName: null) (abstract: false, interface: false)
[OCL] Evaluate: remes::CompositeMode.allInstances()
[OCL] Result : null
[OCL] Evaluate: remes::CompositeMode.allInstances()->exists(cm : CompositeMode | cm.subModes->exists(sm : SubMode | sm.=(self)).and(cm.conditionalConnectors->exists(cc : ConditionalConnector | cc.=(oppositeEnd))))
[OCL] Result : OclInvalid
[OCL] Evaluate: remes::CompositeMode.allInstances()->exists(cm : CompositeMode | cm.subModes->exists(sm : SubMode | sm.=(self)).and(cm.conditionalConnectors->exists(cc : ConditionalConnector | cc.=(oppositeEnd))))
[OCL] Result : OclInvalid

Please help me to fix this problem.

Thanks in advance,
Ivo

Re: Problem with Link Constraint (OCL) [message #480782 is a reply to message #480395] Tue, 18 August 2009 13:04 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Ivo,

You have to add parentMode reference to a CompositeMode EClass. This reference
should be opposite to a containment reference from parent CompositeMode to
this one.
Then OCL constraint will be like: self.parentMode.conditionalConnectors->exists(cc|
cc = oppositeEnd)

-----------------
Alex Shatalin
Re: Problem with Link Constraint (OCL) [message #480839 is a reply to message #480782] Tue, 18 August 2009 16:05 Go to previous messageGo to next message
Ivo Petkov is currently offline Ivo PetkovFriend
Messages: 14
Registered: August 2009
Junior Member
Thanks Alex,

I thought of this way, but I didn't want to make modifications to the model.
Is this the only way?

Because in my case the SubMode can be contained in two totally different containers CompositeMode and RemesDiagram - so the parent cannot be unified.

Regards,
Ivo
Re: Problem with Link Constraint (OCL) [message #480853 is a reply to message #480839] Tue, 18 August 2009 16:56 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

--=-oIY2sPBPWmDKHQCIzBbb
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Ivo,

There is a GMF enhancement request open for GMF validation to apply the
OCL option to treat EObject as the implicit root class of model classes.
This would provide access to eContainer() and the other operations that
EObject defines.

Perhaps there is something that you can override/extend in your
application to apply this option?

Cheers,

Christian


On Tue, 2009-08-18 at 12:05 -0400, Ivo Petkov wrote:

> Thanks Alex,
>
> I thought of this way, but I didn't want to make modifications to the model.
> Is this the only way?
>
> Because in my case the SubMode can be contained in two totally different containers CompositeMode and RemesDiagram - so the parent cannot be unified.
>
> Regards,
> Ivo

--=-oIY2sPBPWmDKHQCIzBbb
Content-Type: text/html; charset="utf-8"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.24.1.1">
</HEAD>
<BODY>
Hi, Ivo,<BR>
<BR>
There is a GMF enhancement request open for GMF validation to apply the OCL option to treat EObject as the implicit root class of model classes.&nbsp; This would provide access to eContainer() and the other operations that EObject defines.<BR>
<BR>
Perhaps there is something that you can override/extend in your application to apply this option?<BR>
<BR>
Cheers,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Tue, 2009-08-18 at 12:05 -0400, Ivo Petkov wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Thanks Alex,

I thought of this way, but I didn't want to make modifications to the model.
Is this the only way?

Because in my case the SubMode can be contained in two totally different containers CompositeMode and RemesDiagram - so the parent cannot be unified.

Regards,
Ivo
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-oIY2sPBPWmDKHQCIzBbb--
Re: Problem with Link Constraint (OCL) [message #516458 is a reply to message #480853] Wed, 24 February 2010 00:08 Go to previous message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
For the interested, the enhancement request appears to be the following:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256461

Strangely enough, the documentation at
http://wiki.eclipse.org/index.php/GMF_Constraints#Link_Const raints
suggests that 'eContainer' etc. are actually available, when they are
not (for nodes, at least).

In the meantime, you can set the Constraint language to "java", set
"Inject Expression Body" to true in the gmfgen [1], and use a constraint
similar to the following:

return domainElement.eContainer() != null;

Hope this helps someone :-)

Jevon

[1]: http://wiki.eclipse.org/GMF_Constraints#Java

Christian W. Damus wrote:
> Hi, Ivo,
>
> There is a GMF enhancement request open for GMF validation to apply the
> OCL option to treat EObject as the implicit root class of model
> classes. This would provide access to eContainer() and the other
> operations that EObject defines.
>
> Perhaps there is something that you can override/extend in your
> application to apply this option?
>
> Cheers,
>
> Christian
>
>
> On Tue, 2009-08-18 at 12:05 -0400, Ivo Petkov wrote:
>> Thanks Alex,
>>
>> I thought of this way, but I didn't want to make modifications to the model.
>> Is this the only way?
>>
>> Because in my case the SubMode can be contained in two totally different containers CompositeMode and RemesDiagram - so the parent cannot be unified.
>>
>> Regards,
>> Ivo
Previous Topic:2 palettes in GMF
Next Topic:Potential bug in PathmapManager.notifyChanged(Notification msg)
Goto Forum:
  


Current Time: Tue Mar 19 08:38:46 GMT 2024

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

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

Back to the top