| OCL GMF LinkConstraint with Generalization [message #59638] | 
Tue, 22 July 2008 15:26   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hello, 
sorry for the Question, but I`m new in OCL. 
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. 
It is possible? 
Thanks for your Help. 
Peter
 |  
 |  
  | 
| Re: OCL GMF LinkConstraint with Generalization [message #59664 is a reply to message #59638] | 
Tue, 22 July 2008 16:11   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: cdamus.zeligsoft.com 
 
--=-Q/kc/o882zK6oMMAmlTl 
Content-Type: text/plain 
Content-Transfer-Encoding: 7bit 
 
Hi, Peter, 
 
Apart from the mechanics of specifying link constraints in GMF (which 
question would be better asked on the GMF newsgroup), I can possibly 
help with the "pure OCL" aspect of your problem. 
 
Do I read your syntax correctly, that Class1 and Class2 are model 
elements that are instances of the Instance metaclass? 
 
In that case, you could simply do: 
 
   context Link 
   inv: src->union(dst).name <> Set{'Class1', 'Class2'} 
 
What I am doing here is creating a Set(Instance) containing the objects 
referenced via the src and dst properties of the contextual Link object, 
collecting the names of the Instances in this set, and ensuring that the 
resulting set of names is different from the names that indicate 
badness. 
 
HTH, 
 
Christian 
 
 
On Tue, 2008-07-22 at 21:26 +0200, Peter wrote: 
 
> Hello, 
> sorry for the Question, but I`m new in OCL. 
> 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. 
> It is possible? 
> Thanks for your Help. 
> Peter 
 
--=-Q/kc/o882zK6oMMAmlTl 
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> 
Apart from the mechanics of specifying link constraints in GMF (which question would be better asked on the GMF newsgroup), I can possibly help with the "pure OCL" aspect of your problem.<BR> 
<BR> 
Do I read your syntax correctly, that Class1 and Class2 are model elements that are instances of the Instance metaclass?<BR> 
<BR> 
In that case, you could simply do:<BR> 
<BR> 
   context Link<BR> 
   inv: src->union(dst).name <> Set{'Class1', 'Class2'}<BR> 
<BR> 
What I am doing here is creating a Set(Instance) containing the objects referenced via the src and dst properties of the contextual Link object, collecting the names of the Instances in this set, and ensuring that the resulting set of names is different from the names that indicate badness.<BR> 
<BR> 
HTH,<BR> 
<BR> 
Christian<BR> 
<BR> 
<BR> 
On Tue, 2008-07-22 at 21:26 +0200, Peter wrote: 
<BLOCKQUOTE TYPE=CITE> 
<PRE> 
<FONT COLOR="#000000">Hello,</FONT> 
<FONT COLOR="#000000">sorry for the Question, but I`m new in OCL.</FONT> 
<FONT COLOR="#000000">I want to create a LinkConstraint for my GMF Editor.</FONT> 
<FONT COLOR="#000000">My Model look like this:</FONT> 
 
<FONT COLOR="#000000">Root</FONT> 
<FONT COLOR="#000000">    instances:Instance</FONT> 
<FONT COLOR="#000000">    links:Link</FONT> 
<FONT COLOR="#000000">Instance</FONT> 
<FONT COLOR="#000000">    name:EString</FONT> 
<FONT COLOR="#000000">Link</FONT> 
<FONT COLOR="#000000">    src:Instance</FONT> 
<FONT COLOR="#000000">    dst:Instance</FONT> 
<FONT COLOR="#000000">Class1 -> Instance</FONT> 
<FONT COLOR="#000000">Class2 -> Instance</FONT> 
<FONT COLOR="#000000">Class3 -> Instance</FONT> 
<FONT COLOR="#000000">...</FONT> 
 
<FONT COLOR="#000000">I want to forbid special Links, for example between Class1 and 2.</FONT> 
<FONT COLOR="#000000">It is possible?</FONT> 
<FONT COLOR="#000000">Thanks for your Help.</FONT> 
<FONT COLOR="#000000">Peter</FONT> 
</PRE> 
</BLOCKQUOTE> 
</BODY> 
</HTML> 
 
--=-Q/kc/o882zK6oMMAmlTl--
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.03523 seconds