Home » Modeling » OCL » Ocl Completion and stereotypes 
| Ocl Completion and stereotypes [message #66193] | 
Thu, 29 January 2009 04:38   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi 
i've used for a personal project the OCLSourceViewer available in  
org.eclipse.emf.ocl.example 
I used it on level M1 for UML models to help users to write OCL Rules. 
 
I already test my feature and the OCLsourceViewer works very well. 
 
- But I made an UML profile with one stereotype S1 extending class and  
containing one property. 
 
I applied this profile on an UML model, i applied stereotype S1 on a  
class C1 
when I used the oclSourceViewer with context set to C1. I don't see Auto  
completion proposal for stereotypes attributes 
 
Is it a normal behavior ? If yes is it plan to add it ? 
 
- Other question in auto completion for ocl rule in class i have auto  
completion for properties but not for operations is it normal too ?
 |  
 |  
  |  
| Re: Ocl Completion and stereotypes [message #66276 is a reply to message #66193] | 
Thu, 29 January 2009 11:31    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: cdamus.zeligsoft.com 
 
Hi, Tristan, 
 
See comments in-line, below. 
 
HTH, 
 
Christian 
 
 
Tristan FAURE wrote: 
> Hi 
> i've used for a personal project the OCLSourceViewer available in  
> org.eclipse.emf.ocl.example 
> I used it on level M1 for UML models to help users to write OCL Rules. 
>  
> I already test my feature and the OCLsourceViewer works very well. 
 
I'm glad you like it!  Note that this example is soon to be superseded  
by a considerably more capable example:  http://bugs.eclipse.org/259922 
 
 
> - But I made an UML profile with one stereotype S1 extending class and  
> containing one property. 
>  
> I applied this profile on an UML model, i applied stereotype S1 on a  
> class C1 
> when I used the oclSourceViewer with context set to C1. I don't see Auto  
> completion proposal for stereotypes attributes 
>  
> Is it a normal behavior ? If yes is it plan to add it ? 
 
Yes and no. 
 
 From an OCL (and generally a structural) perspective, applying S1 to C1  
creates a new instance of s1 of S1 (like a metaclass) and associates it  
with C1.  So, you have s1 referencing C1 via its S1::base_Class  
attribute.  The Class metaclass is immutable, so C1 is unchanged by this  
operation. 
 
What OCL can do is to navigate the S1-Class metaclass extension (an  
association) in reverse.  By default (and convention) the navigable end  
of the extension is named "base_Class", so that gets you from the s1 to  
C1.  The other end is "extension_S1", so assuming that S1 defines an  
attribute p1, you can do: 
 
   context Class 
   inv: self.extension_S1.p1 = <some test> 
 
Of course, the stereotype may or may not be applied to any particular  
class, so in general I recommend a formulation like: 
 
   context Class 
   inv: self.extension_S1->notEmpty() implies self.extension_S1.p1 ... 
 
Once you have typed "self.extension_S1" you will get completion on that  
expression.  Content assist does not suggest the non-navigable ends of  
associations, only the navigable ends.  There is not currently any plan  
to change that. 
 
 
> - Other question in auto completion for ocl rule in class i have auto  
> completion for properties but not for operations is it normal too ? 
 
Content-assist should be showing completions for operations, too.  Do  
you not see, for example, the oclXyz() operations? 
 
Note that OCL can only call query operations, because for these the  
model asserts that they are side-effect-free (a basic condition of the  
OCL language).  You will not be able to use (and content-assist will not  
suggest) operations that have isQuery = false.
 |  
 |  
  |  
| Re: Ocl Completion and stereotypes [message #66294 is a reply to message #66276] | 
Thu, 29 January 2009 11:45    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi Christian ! Thank you for your answer ! 
 
Christian W. Damus a écrit : 
> Hi, Tristan, 
>  
> See comments in-line, below. 
>  
> HTH, 
>  
> Christian 
>  
>  
> Tristan FAURE wrote: 
>> Hi 
>> i've used for a personal project the OCLSourceViewer available in  
>> org.eclipse.emf.ocl.example 
>> I used it on level M1 for UML models to help users to write OCL Rules. 
>> 
>> I already test my feature and the OCLsourceViewer works very well. 
>  
> I'm glad you like it!  Note that this example is soon to be superseded  
> by a considerably more capable example:  http://bugs.eclipse.org/259922 
>  
 
Glad to know ! It should be good to be an integrated feature in  
eclipse.ocl  no ? 
 
>  
>> - But I made an UML profile with one stereotype S1 extending class and  
>> containing one property. 
>> 
>> I applied this profile on an UML model, i applied stereotype S1 on a  
>> class C1 
>> when I used the oclSourceViewer with context set to C1. I don't see  
>> Auto completion proposal for stereotypes attributes 
>> 
>> Is it a normal behavior ? If yes is it plan to add it ? 
>  
> Yes and no. 
>  
>  From an OCL (and generally a structural) perspective, applying S1 to C1  
> creates a new instance of s1 of S1 (like a metaclass) and associates it  
> with C1.  So, you have s1 referencing C1 via its S1::base_Class  
> attribute.  The Class metaclass is immutable, so C1 is unchanged by this  
> operation. 
>  
> What OCL can do is to navigate the S1-Class metaclass extension (an  
> association) in reverse.  By default (and convention) the navigable end  
> of the extension is named "base_Class", so that gets you from the s1 to  
> C1.  The other end is "extension_S1", so assuming that S1 defines an  
> attribute p1, you can do: 
>  
>   context Class 
>   inv: self.extension_S1.p1 = <some test> 
>  
> Of course, the stereotype may or may not be applied to any particular  
> class, so in general I recommend a formulation like: 
>  
>   context Class 
>   inv: self.extension_S1->notEmpty() implies self.extension_S1.p1 ... 
>  
> Once you have typed "self.extension_S1" you will get completion on that  
> expression.  Content assist does not suggest the non-navigable ends of  
> associations, only the navigable ends.  There is not currently any plan  
> to change that. 
 
I understand 
it's a pity (i think) to not define shortcuts in OCL specification 
 
>  
>  
>> - Other question in auto completion for ocl rule in class i have auto  
>> completion for properties but not for operations is it normal too ? 
>  
> Content-assist should be showing completions for operations, too.  Do  
> you not see, for example, the oclXyz() operations? 
>  
> Note that OCL can only call query operations, because for these the  
> model asserts that they are side-effect-free (a basic condition of the  
> OCL language).  You will not be able to use (and content-assist will not  
> suggest) operations that have isQuery = false. 
 
You are right sorry for the question
 |  
 |  
  |  
| Re: Ocl Completion and stereotypes [message #66309 is a reply to message #66294] | 
Fri, 30 January 2009 08:26    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: cdamus.zeligsoft.com 
 
Hi, Tristan, 
 
More replies in-line. 
 
cW 
 
Tristan FAURE wrote: 
> Hi Christian ! Thank you for your answer ! 
 
No trouble. 
 
 
>> I'm glad you like it!  Note that this example is soon to be superseded  
>> by a considerably more capable example:  http://bugs.eclipse.org/259922 
>> 
>  
> Glad to know ! It should be good to be an integrated feature in  
> eclipse.ocl  no ? 
 
Well, perhaps, but then it would have to be supported as a first-class  
feature.  There aren't sufficient resources for that. 
 
 
>> Once you have typed "self.extension_S1" you will get completion on  
>> that expression.  Content assist does not suggest the non-navigable  
>> ends of associations, only the navigable ends.  There is not currently  
>> any plan to change that. 
>  
> I understand 
> it's a pity (i think) to not define shortcuts in OCL specification 
 
Do you mean, aliases?  I would settle for a contribution that extends  
the content-assist to suggest non-navigable association ends on a second  
invocation of Ctrl+Space, in a JDT-style cycle of completion categories. 
 
:-) 
 
 
>> Note that OCL can only call query operations, because for these the  
>> model asserts that they are side-effect-free (a basic condition of the  
>> OCL language).  You will not be able to use (and content-assist will  
>> not suggest) operations that have isQuery = false. 
>  
> You are right sorry for the question 
 
No!  Never apologize for asking a question!  Unless, of course, it's  
impolite ...  :-D
 |  
 |  
  |  
| Re: Ocl Completion and stereotypes [message #66347 is a reply to message #66309] | 
Fri, 30 January 2009 10:11   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi ! 
 
comment below 
 
Christian W. Damus a écrit : 
> Hi, Tristan, 
>  
> More replies in-line. 
>  
> cW 
>  
> Tristan FAURE wrote: 
>> Hi Christian ! Thank you for your answer ! 
>  
> No trouble. 
>  
>  
>>> I'm glad you like it!  Note that this example is soon to be  
>>> superseded by a considerably more capable example:   
>>> http://bugs.eclipse.org/259922 
>>> 
>> 
>> Glad to know ! It should be good to be an integrated feature in  
>> eclipse.ocl  no ? 
>  
> Well, perhaps, but then it would have to be supported as a first-class  
> feature.  There aren't sufficient resources for that. 
>  
>  
>>> Once you have typed "self.extension_S1" you will get completion on  
>>> that expression.  Content assist does not suggest the non-navigable  
>>> ends of associations, only the navigable ends.  There is not  
>>> currently any plan to change that. 
>> 
>> I understand 
>> it's a pity (i think) to not define shortcuts in OCL specification 
>  
> Do you mean, aliases?  I would settle for a contribution that extends  
> the content-assist to suggest non-navigable association ends on a second  
> invocation of Ctrl+Space, in a JDT-style cycle of completion categories. 
>  
> :-) 
 
It could be very good Yes ! 
 
>  
>  
>>> Note that OCL can only call query operations, because for these the  
>>> model asserts that they are side-effect-free (a basic condition of  
>>> the OCL language).  You will not be able to use (and content-assist  
>>> will not suggest) operations that have isQuery = false. 
>> 
>> You are right sorry for the question 
>  
> No!  Never apologize for asking a question!  Unless, of course, it's  
> impolite ...  :-D 
 
Thank you :p
 |  
 |  
  |   
Goto Forum:
 
 Current Time: Tue Nov 04 03:11:39 EST 2025 
 Powered by  FUDForum. Page generated in 0.23975 seconds  
 |