Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Re: Can we implement an operation in pure OCL
Re: Can we implement an operation in pure OCL [message #474263] Mon, 16 July 2007 16:15 Go to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Fran├žois,

The UML2 2.1 release has added support for generating operation bodies from
OCL specified in your UML model (in much the same way as my article). This
applies to operations defined on Stereotypes, as well, if you take
advantage of another new feature in the 2.1 release: static profile
definition. You can generate the Java code implementing your Profile
(converting it to an EPackage), and that generated code is enhanced with
OCL-specified constraints and operations.

I think that James is currently working on documentation of both of these
features. In any case, the UML2 newsgroup (which I have included in this
reply) can help you to get started. Also, if you search that newsgroup, I
think you will find some previous postings on this subject that would help.

HTH,

Christian


Fran├žois Lagarde wrote:

> Hello,
>
> I read the article "implementing model integrity" to get a flavour of what
> can we do..
>
> I would like to create an operation in a Stereotype (despite I know that
> defining an operation may sound like a side effect of inheritance of a
> Class) and define its body with OCL.
>
> Lets say that I want to create a stereotype =MyStereotype= and define a
> operation called =reverse= to reverse a given string.
>
> I will create at first the Stereotype =MyStereotype=, next create an
> operation called =reverse=, create an input parameter and a return
> parameter. So at this point I think that it is enough to create an
> operation context.
>
> next i am lost, and I even do not know if I can do something.
>
> Obviously I guess that it is not enough and I have to programmaticly do
> like in the article "implementing model integraty":
> 1. helper.setOperationContext(myprofilepackage, reverse),
> 2. retrieve the body (I do not know what model element is the best
> adapted), 3. create the query and so on..
>
> at the end, would it be sufficient to provide the helper with an operation
> called reverse in the context of this stereotype, something like at M1
> self.reverse('toto')!=self.base_Class.name
>
> between how/where are defined all the "meta-operation" such as
> self.hasValue():Boolean
>
>
> thanks a lot.
Re: Can we implement an operation in pure OCL [message #474265 is a reply to message #474263] Mon, 16 July 2007 19:45 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
.... there is some sparse documentation in the "new and noteworthy" section
that you might also want to look at.
As Christian mentioned, documentation is being worked on.... slowly but
surely :)

- James.

"Christian W. Damus" <cdamus@ca.ibm.com> wrote in message
news:f7g5j7$682$1@build.eclipse.org...
> Hi, Fran
Re: Can we implement an operation in pure OCL [message #623742 is a reply to message #474263] Mon, 16 July 2007 19:45 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
.... there is some sparse documentation in the "new and noteworthy" section
that you might also want to look at.
As Christian mentioned, documentation is being worked on.... slowly but
surely :)

- James.

"Christian W. Damus" <cdamus@ca.ibm.com> wrote in message
news:f7g5j7$682$1@build.eclipse.org...
> Hi, Fran
Previous Topic:Re: Can we implement an operation in pure OCL
Next Topic:Combined Fragments
Goto Forum:
  


Current Time: Wed Apr 01 17:30:52 GMT 2020

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

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

Back to the top