|Re: Can we implement an operation in pure OCL [message #623740]
||Mon, 16 July 2007 16:15
Originally posted by: cdamus.ca.ibm.com|
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.
François Lagarde wrote:
> 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
> between how/where are defined all the "meta-operation" such as
> thanks a lot.
Powered by FUDForum
. Page generated in 0.02538 seconds