Thread View: borland.public.together.modeling
7 messages
7 total messages
Started by Thomas Schuster
Mon, 04 Jun 2007 09:57
How to create a stereotype via Modell/to?modell Transformation?
Author: Thomas Schuster
Date: Mon, 04 Jun 2007 09:57
Date: Mon, 04 Jun 2007 09:57
12 lines
1315 bytes
1315 bytes
Hi, I am writing a QVT-Transformation with Together Architect 2006 Release 2. The Problem is my input is an activity-diagram and my output a class-diagram in which I would like to create some stereotypes according to features within the activity diagram. So far I am able to create classes but I cannot stereotype them at all. I tried to use the class attribute stereotypes but do not have succeed so far. I would greatly appreciate any help. Thanks!
Re: How to create a stereotype via Modell/to?modell Transformation?
Author: Thomas Schuster
Date: Mon, 04 Jun 2007 10:07
Date: Mon, 04 Jun 2007 10:07
26 lines
2014 bytes
2014 bytes
Hi, I just identified that my problem is not the result but the input model. I would need to read a tagged value from there and use it to create the stereotype in my output model. (My input model is stereotyped as well. So to be more precise if a certain stereotype in the input model has a certain tagged value attached I would like to create some other stereotype in the output model). And as I just recognized my second question would be how to create a tagged value in the stereotype I created in my output. Thomas Schuster schrieb: > Hi, > > I am writing a QVT-Transformation with Together Architect 2006 Release > 2. The Problem is my input is an activity-diagram and my output a > class-diagram in which I would like to create some stereotypes according > to features within the activity diagram. > > So far I am able to create classes but I cannot stereotype them at all. > I tried to use the class attribute stereotypes but do not have succeed > so far. > > I would greatly appreciate any help. Thanks!
Re: How to create a stereotype via Modell/to?modell Transformation?
Author: ElenaA
Date: Tue, 05 Jun 2007 07:47
Date: Tue, 05 Jun 2007 07:47
37 lines
2637 bytes
2637 bytes
the simplest way to set a tagged value is to use setPropertyValue(String property_name, String property_value). But this function will create a simple custom property, not a tagged value defined for the certain stereotype. So, the more valid solution is to apply the profile stereotypes/tagged values are defined in to your output model prior to running the transformation, and set stereotypes and tagged values using profiles api "Thomas Schuster" <thomas@ballermann.cc> wrote in message news:4663e4a5$1@newsgroups.borland.com... > Hi, > > I just identified that my problem is not the result but the input model. > I would need to read a tagged value from there and use it to create the > stereotype in my output model. (My input model is stereotyped as well. > So to be more precise if a certain stereotype in the input model has a > certain tagged value attached I would like to create some other > stereotype in the output model). > > And as I just recognized my second question would be how to create a > tagged value in the stereotype I created in my output. > > > Thomas Schuster schrieb: >> Hi, >> >> I am writing a QVT-Transformation with Together Architect 2006 Release >> 2. The Problem is my input is an activity-diagram and my output a >> class-diagram in which I would like to create some stereotypes according >> to features within the activity diagram. >> >> So far I am able to create classes but I cannot stereotype them at all. >> I tried to use the class attribute stereotypes but do not have succeed >> so far. >> >> I would greatly appreciate any help. Thanks!
Re: How to create a stereotype via Modell/to?modell Transformation?
Author: Thomas Schuster
Date: Tue, 05 Jun 2007 17:18
Date: Tue, 05 Jun 2007 17:18
33 lines
2589 bytes
2589 bytes
Hi ElenaA, thanks for your response. In the meantime I succeeded in creating stereotypes with attached tagged values in the output model, although my transformation code doesn't seem to be very nifty. Since I create a certain stereotype in my output model according to a stereotype in the input model I am using if-then-else constructs with an empty else branch. Any suggestions to code that a little more stylish? Another problem is I intended to return different stereotypes within my if-then-else part and allocate that part which is returned to a variable. Together does not allow to do so since I would return different types, which I would understand in typed language, but as far as I understood a variable does exist as variant until it is allocated with a value of a certain type... I solved that again inelegant by using different variables each with its own if clause. ElenaA wrote: > the simplest way to set a tagged value is to use setPropertyValue(String > property_name, String property_value). But this function will create a > simple custom property, not a tagged value defined for the certain > stereotype. Good to knowm, but I intend to use tagged values. > So, the more valid solution is to apply the profile stereotypes/tagged > values are defined in to your output model prior to running the > transformation, and set stereotypes and tagged values using profiles api I didn't get that... do you suggest to create stereotypes und tagged values manually within the model?
Re: How to create a stereotype via Modell/to?modell Transformation?
Author: ElenaA
Date: Wed, 06 Jun 2007 13:25
Date: Wed, 06 Jun 2007 13:25
50 lines
3420 bytes
3420 bytes
> Since I create a certain stereotype in my output model according to a > stereotype in the input model I am using if-then-else constructs with an > empty else branch. Any suggestions to code that a little more stylish? unfortunately else branch can't be omitted. From OCL specification: "An IfExp results in one of two alternative expressions depending on the evaluated value of a condition. Note that both the thenExpression and the elseExpression are mandatory. The reason behind this is that an if expression should always result in a value, which cannot be guaranteed if the else part is left out." "Thomas Schuster" <thomas@ballermann.cc> wrote in message news:46659b2c@newsgroups.borland.com... > Hi ElenaA, > > thanks for your response. In the meantime I succeeded in creating > stereotypes with attached tagged values in the output model, although my > transformation code doesn't seem to be very nifty. > > Since I create a certain stereotype in my output model according to a > stereotype in the input model I am using if-then-else constructs with an > empty else branch. Any suggestions to code that a little more stylish? > > Another problem is I intended to return different stereotypes within my > if-then-else part and allocate that part which is returned to a > variable. Together does not allow to do so since I would return > different types, which I would understand in typed language, but as far > as I understood a variable does exist as variant until it is allocated > with a value of a certain type... > > I solved that again inelegant by using different variables each with its > own if clause. > > > ElenaA wrote: >> the simplest way to set a tagged value is to use setPropertyValue(String >> property_name, String property_value). But this function will create a >> simple custom property, not a tagged value defined for the certain >> stereotype. > Good to knowm, but I intend to use tagged values. > >> So, the more valid solution is to apply the profile stereotypes/tagged >> values are defined in to your output model prior to running the >> transformation, and set stereotypes and tagged values using profiles api > I didn't get that... do you suggest to create stereotypes und tagged > values manually within the model?
Re: How to create a stereotype via Modell/to?modell Transformation?
Author: Thomas Schuster
Date: Thu, 07 Jun 2007 21:45
Date: Thu, 07 Jun 2007 21:45
78 lines
4475 bytes
4475 bytes
Wow, sorry -my fault- of course the else branch is not empty in the way that it does not return a value but it calls a operation which I would name as nop (since it does not really do anything on it's input but just returns it again). Let me try again: 1.) I want to read an element if it is of stereotype 1 I create another stereotyp A, if it is of stereotype 2 I create another stereotyp B, ... 2.) There seem to be two limitations in together-qvt: - it seems as if nested if-then-else constructs are not allowed (regarding the ocl meta model that should be allowed) - if an if-then-else construct specifies a variable, together does not allow to return different types in then and else branch Looking at these two constraints I have to write a lot of if expressions with these nops in their else branch to create all model elements I intend to create in my output model. Since the transformations works well it is not too critical, but I was wondering, if I could write that a little more elegant. ElenaA schrieb: >> Since I create a certain stereotype in my output model according to a >> stereotype in the input model I am using if-then-else constructs with an >> empty else branch. Any suggestions to code that a little more stylish? > > unfortunately else branch can't be omitted. From OCL specification: > "An IfExp results in one of two alternative expressions depending on the > evaluated value of a condition. Note that both the > > thenExpression and the elseExpression are mandatory. The reason behind this > is that an if expression should always result > > in a value, which cannot be guaranteed if the else part is left out." > > > > "Thomas Schuster" <thomas@ballermann.cc> wrote in message > news:46659b2c@newsgroups.borland.com... >> Hi ElenaA, >> >> thanks for your response. In the meantime I succeeded in creating >> stereotypes with attached tagged values in the output model, although my >> transformation code doesn't seem to be very nifty. >> >> Since I create a certain stereotype in my output model according to a >> stereotype in the input model I am using if-then-else constructs with an >> empty else branch. Any suggestions to code that a little more stylish? >> >> Another problem is I intended to return different stereotypes within my >> if-then-else part and allocate that part which is returned to a >> variable. Together does not allow to do so since I would return >> different types, which I would understand in typed language, but as far >> as I understood a variable does exist as variant until it is allocated >> with a value of a certain type... >> >> I solved that again inelegant by using different variables each with its >> own if clause. >> >> >> ElenaA wrote: >>> the simplest way to set a tagged value is to use setPropertyValue(String >>> property_name, String property_value). But this function will create a >>> simple custom property, not a tagged value defined for the certain >>> stereotype. >> Good to knowm, but I intend to use tagged values. >> >>> So, the more valid solution is to apply the profile stereotypes/tagged >>> values are defined in to your output model prior to running the >>> transformation, and set stereotypes and tagged values using profiles api >> I didn't get that... do you suggest to create stereotypes und tagged >> values manually within the model? > >
Re: How to create a stereotype via Modell/to?modell Transformation?
Author: ElenaA
Date: Fri, 08 Jun 2007 08:19
Date: Fri, 08 Jun 2007 08:19
23 lines
1898 bytes
1898 bytes
> - it seems as if nested if-then-else constructs are not allowed
> (regarding the ocl meta model that should be allowed)
they are allowed. See, e.g., the extract of one of sample transformations (a
part of UML to J2EE example):
var bidir :=
association.oclAsType(businessdomain::BidirectionalAssociation);
var oppositeRef :=
if not bidir.oclIsUndefined() then
if bidir._end = self then
bidir.start
else
bidir._end
endif
else undefined endif;
> - if an if-then-else construct specifies a variable, together does not
> allow to return different types in then and else branch
hmm... same variable can't have different types depending on condition. Why
do you think that this is Tg limitation?Have you seen any examples of a
variable returning different types in standard QVT?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads