Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » LinkConstraint
LinkConstraint [message #198512] Wed, 23 July 2008 11:27 Go to next message
Peter Mising name is currently offline Peter Mising nameFriend
Messages: 95
Registered: July 2009
Member
Hello,
I want to create a LinkConstraint for my GMF Editor.
My Model look like this:
Root
instances:Instance
links:Link
Instance
name:EString
Link
src:Instance
dst:Instance
Class1 -> Instance
Class2 -> Instance
Class3 -> Instance
...

I want to forbid special Links, for example between Class1 and 2.
The OCL expression is:
context Link
inv: src->union(dst).name <> Set{'Class1', 'Class2'}

What is the expression for GMF?
Thanks for your Help.
Peter
Re: LinkConstraint [message #198546 is a reply to message #198512] Wed, 23 July 2008 12:51 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Peter,

source end link constraint:
self->union(oppositeEnd).name <> Set{'Class1', 'Class2'}


-----------------
Alex Shatalin
Re: LinkConstraint [message #198569 is a reply to message #198546] Wed, 23 July 2008 13:26 Go to previous messageGo to next message
Peter Mising name is currently offline Peter Mising nameFriend
Messages: 95
Registered: July 2009
Member
Hello Alex,

then I get the Validation Error:
Cannot find operation (union(Instance))


> Hello Peter,
>
> source end link constraint:
> self->union(oppositeEnd).name <> Set{'Class1', 'Class2'}
>
>
> -----------------
> Alex Shatalin
>
>
Re: LinkConstraint [message #198585 is a reply to message #198569] Wed, 23 July 2008 13:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

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

Hi, Peter,

Sorry, my original reply on the OCL newsgroup should have used
"including" instead of "union".

Try this:

self->including(oppositeEnd).name <> Set{'Clas1', 'Class2'}

The union operation requires another collection, whereas including
requires a scalar value.

Cheers,

Christian


On Wed, 2008-07-23 at 15:26 +0200, Peter wrote:

> Hello Alex,
>
> then I get the Validation Error:
> Cannot find operation (union(Instance))
>
>
> > Hello Peter,
> >
> > source end link constraint:
> > self->union(oppositeEnd).name <> Set{'Class1', 'Class2'}
> >
> >
> > -----------------
> > Alex Shatalin
> >
> >

--=-gT52ZEd9Umim27Xh1lDz
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.16.0">
</HEAD>
<BODY>
Hi, Peter,<BR>
<BR>
Sorry, my original reply on the OCL newsgroup should have used &quot;including&quot; instead of &quot;union&quot;.<BR>
<BR>
Try this:<BR>
<BR>
self-&gt;including(oppositeEnd).name &lt;&gt; Set{'Clas1', 'Class2'}<BR>
<BR>
The union operation requires another collection, whereas including requires a scalar value.<BR>
<BR>
Cheers,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Wed, 2008-07-23 at 15:26 +0200, Peter wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Hello Alex,</FONT>

<FONT COLOR="#000000">then I get the Validation Error:</FONT>
<FONT COLOR="#000000">Cannot find operation (union(Instance))</FONT>


<FONT COLOR="#000000">&gt; Hello Peter,</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; source end link constraint:</FONT>
<FONT COLOR="#000000">&gt; self-&gt;union(oppositeEnd).name &lt;&gt; Set{'Class1', 'Class2'}</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; -----------------</FONT>
<FONT COLOR="#000000">&gt; Alex Shatalin</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; </FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-gT52ZEd9Umim27Xh1lDz--
Re: LinkConstraint [message #198592 is a reply to message #198569] Wed, 23 July 2008 13:50 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Peter,

> then I get the Validation Error:
> Cannot find operation (union(Instance))
This is because in OCL "->union()" operation has "Colection" parameter type.
You can use "self->union(oppositeEnd->asSet())" instead.

-----------------
Alex Shatalin
Re: LinkConstraint [message #198606 is a reply to message #198585] Wed, 23 July 2008 14:04 Go to previous messageGo to next message
Peter Mising name is currently offline Peter Mising nameFriend
Messages: 95
Registered: July 2009
Member
Hi Christian,
no problem! Thanks for your Help.
I changed it to including, but the I get the Error:

Cannot find operation (<>(Set(String))) for the type (Bag...

then the Message is cut.



> Hi, Peter,
>
> Sorry, my original reply on the OCL newsgroup should have used
> "including" instead of "union".
>
> Try this:
>
> self->including(oppositeEnd).name <> Set{'Clas1', 'Class2'}
>
> The union operation requires another collection, whereas including
> requires a scalar value.
>
> Cheers,
>
> Christian
>
>
> On Wed, 2008-07-23 at 15:26 +0200, Peter wrote:
>> Hello Alex,
>>
>> then I get the Validation Error:
>> Cannot find operation (union(Instance))
>>
>>
>> > Hello Peter,
>> >
>> > source end link constraint:
>> > self->union(oppositeEnd).name <> Set{'Class1', 'Class2'}
>> >
>> >
>> > -----------------
>> > Alex Shatalin
>> >
>> >
Re: LinkConstraint [message #198639 is a reply to message #198606] Wed, 23 July 2008 14:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

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

Hi, Peter,

Right. The implicit "collect" iterator in the ".name" navigation from a
set results in a bag.

So, one last try (this really should work):

self->including(oppositeEnd).name <> Bag{'Class1', 'Class2'}

or, if you like,

self->including(oppositeEnd).name->asSet() <> Set{'Class1',
'Class2'}

Cheers,

Christian

On Wed, 2008-07-23 at 16:04 +0200, Peter wrote:

> Hi Christian,
> no problem! Thanks for your Help.
> I changed it to including, but the I get the Error:
>
> Cannot find operation (<>(Set(String))) for the type (Bag...
>
> then the Message is cut.
>
>
>
> > Hi, Peter,
> >
> > Sorry, my original reply on the OCL newsgroup should have used
> > "including" instead of "union".
> >
> > Try this:
> >
> > self->including(oppositeEnd).name <> Set{'Clas1', 'Class2'}
> >
> > The union operation requires another collection, whereas including
> > requires a scalar value.
> >
> > Cheers,
> >
> > Christian
> >
> >
> > On Wed, 2008-07-23 at 15:26 +0200, Peter wrote:
> >> Hello Alex,
> >>
> >> then I get the Validation Error:
> >> Cannot find operation (union(Instance))
> >>
> >>
> >> > Hello Peter,
> >> >
> >> > source end link constraint:
> >> > self->union(oppositeEnd).name <> Set{'Class1', 'Class2'}
> >> >
> >> >
> >> > -----------------
> >> > Alex Shatalin
> >> >
> >> >

--=-v79oxYa7cPpLN1AH02Yk
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.16.0">
</HEAD>
<BODY>
Hi, Peter,<BR>
<BR>
Right.&nbsp; The implicit &quot;collect&quot; iterator in the &quot;.name&quot; navigation from a set results in a bag.<BR>
<BR>
So, one last try (this really should work):<BR>
<BR>
&nbsp;&nbsp;&nbsp; <FONT COLOR="#000000">self-&gt;including(oppositeEnd).name &lt;&gt; </FONT>Bag<FONT COLOR="#000000">{'Clas</FONT>s<FONT COLOR="#000000">1', 'Class2'}</FONT><BR>
<BR>
or, if you like,<BR>
<BR>
&nbsp;&nbsp;&nbsp; <FONT COLOR="#000000">self-&gt;including(oppositeEnd).name</FONT >-&gt;asSet()<FONT COLOR="#000000"> &lt;&gt; Set{'Clas</FONT>s<FONT COLOR="#000000">1', 'Class2'}</FONT><BR>
<BR>
Cheers,<BR>
<BR>
Christian<BR>
<BR>
On Wed, 2008-07-23 at 16:04 +0200, Peter wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Hi Christian,</FONT>
<FONT COLOR="#000000">no problem! Thanks for your Help.</FONT>
<FONT COLOR="#000000">I changed it to including, but the I get the Error:</FONT>

<FONT COLOR="#000000">Cannot find operation (&lt;&gt;(Set(String))) for the type (Bag...</FONT>

<FONT COLOR="#000000">then the Message is cut.</FONT>



<FONT COLOR="#000000">&gt; Hi, Peter,</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; Sorry, my original reply on the OCL newsgroup should have used </FONT>
<FONT COLOR="#000000">&gt; &quot;including&quot; instead of &quot;union&quot;.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; Try this:</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; self-&gt;including(oppositeEnd).name &lt;&gt; Set{'Clas1', 'Class2'}</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; The union operation requires another collection, whereas including </FONT>
<FONT COLOR="#000000">&gt; requires a scalar value.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; Cheers,</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; Christian</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; On Wed, 2008-07-23 at 15:26 +0200, Peter wrote:</FONT>
<FONT COLOR="#000000">&gt;&gt; Hello Alex,</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; then I get the Validation Error:</FONT>
<FONT COLOR="#000000">&gt;&gt; Cannot find operation (union(Instance))</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; &gt; Hello Peter,</FONT>
<FONT COLOR="#000000">&gt;&gt; &gt; </FONT>
<FONT COLOR="#000000">&gt;&gt; &gt; source end link constraint:</FONT>
<FONT COLOR="#000000">&gt;&gt; &gt; self-&gt;union(oppositeEnd).name &lt;&gt; Set{'Class1', 'Class2'}</FONT>
<FONT COLOR="#000000">&gt;&gt; &gt; </FONT>
<FONT COLOR="#000000">&gt;&gt; &gt; </FONT>
<FONT COLOR="#000000">&gt;&gt; &gt; -----------------</FONT>
<FONT COLOR="#000000">&gt;&gt; &gt; Alex Shatalin</FONT>
<FONT COLOR="#000000">&gt;&gt; &gt; </FONT>
<FONT COLOR="#000000">&gt;&gt; &gt; </FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-v79oxYa7cPpLN1AH02Yk--
Re: LinkConstraint [message #198647 is a reply to message #198639] Wed, 23 July 2008 14:33 Go to previous message
Peter Mising name is currently offline Peter Mising nameFriend
Messages: 95
Registered: July 2009
Member
Yes this works!
Thanks!


> Hi, Peter,
>
> Right. The implicit "collect" iterator in the ".name" navigation from a
> set results in a bag.
>
> So, one last try (this really should work):
>
> self->including(oppositeEnd).name <> Bag{'Class1', 'Class2'}
>
> or, if you like,
>
> self->including(oppositeEnd).name->asSet() <> Set{'Class1', 'Class2'}
>
> Cheers,
>
> Christian
>
> On Wed, 2008-07-23 at 16:04 +0200, Peter wrote:
>> Hi Christian,
>> no problem! Thanks for your Help.
>> I changed it to including, but the I get the Error:
>>
>> Cannot find operation (<>(Set(String))) for the type (Bag...
>>
>> then the Message is cut.
>>
>>
>>
>> > Hi, Peter,
>> >
>> > Sorry, my original reply on the OCL newsgroup should have used
>> > "including" instead of "union".
>> >
>> > Try this:
>> >
>> > self->including(oppositeEnd).name <> Set{'Clas1', 'Class2'}
>> >
>> > The union operation requires another collection, whereas including
>> > requires a scalar value.
>> >
>> > Cheers,
>> >
>> > Christian
>> >
>> >
>> > On Wed, 2008-07-23 at 15:26 +0200, Peter wrote:
>> >> Hello Alex,
>> >>
>> >> then I get the Validation Error:
>> >> Cannot find operation (union(Instance))
>> >>
>> >>
>> >> > Hello Peter,
>> >> >
>> >> > source end link constraint:
>> >> > self->union(oppositeEnd).name <> Set{'Class1', 'Class2'}
>> >> >
>> >> >
>> >> > -----------------
>> >> > Alex Shatalin
>> >> >
>> >> >
Previous Topic:Mark Nodes in a Model after Validation
Next Topic:Printing with out opening a diagram
Goto Forum:
  


Current Time: Sat Jun 06 11:08:17 GMT 2020

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

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

Back to the top