Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Ocl Completion and stereotypes
Ocl Completion and stereotypes [message #66193] Thu, 29 January 2009 09:38 Go to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
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 16:31 Go to previous messageGo to next message
Eclipse UserFriend
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 16:45 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
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 13:26 Go to previous messageGo to next message
Eclipse UserFriend
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 15:11 Go to previous message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
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




Previous Topic:Collection union with distinct types
Next Topic:OCL and redefinition
Goto Forum:
  


Current Time: Fri Apr 26 22:30:55 GMT 2024

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

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

Back to the top