[QVTO] simple mapping constructs [message #533901] |
Mon, 17 May 2010 12:47 |
Siegfried Nolte Messages: 48 Registered: August 2009 |
Member |
|
|
Hi QVTO-folks again,
the following is OK:
mapping Package::transformHelloComplete ( ) : Package
{
init { log ('Init ' ); var packageName := self.name; }
log ('Do' );
name := packageName;
end { log ('End' ); }
}
The following not:
mapping Package::transformHelloComplete ( ) : Package
{
init { log ('Init ' ); var packageName := self.name; }
population { log ('Do' ); name := packageName; }
end { log ('End' ); }
}
The population-block is not accepted. Is there any reason for it? (Yes, I know, why shouldn't I be that lazy and omitt the population keyword and the brackets. )
Thanks for answer,
Siegfried
[Updated on: Mon, 17 May 2010 12:49] Report message to a moderator
|
|
|
Re: [QVTO] simple mapping constructs [message #534112 is a reply to message #533901] |
Tue, 18 May 2010 06:07 |
Eclipse User |
|
|
|
Originally posted by: dhendriksREMOVE_THIS.tueREMOVE.THIS.nl
Siegfried wrote:
> The population-block is not accepted. Is there any reason for it? (Yes,
> I know, why shouldn't I be that lazy and omitt the population keyword
> and the brackets. )
Hello Siegfried,
Both cases look OK to me. It looks like a bug to me. Maybe you should
open a bug in Bugzilla for this?
Dennis
|
|
|
Re: [QVTO] simple mapping constructs [message #534224 is a reply to message #533901] |
Tue, 18 May 2010 12:19 |
Eclipse User |
|
|
|
Originally posted by: Alexander.Igdalov.gmail.com
Hi Siegfried,
If you use a population block explicitly, you should also use explicit
object expressions there, i.e.
population {
log('Do');
object result : Package {
name := packageName;
}
}
HTH,
- Alex.
Siegfried wrote:
> Hi QVTO-folks again,
>
> the following is OK:
>
> mapping Package::transformHelloComplete ( ) : Package
> {
> init
> {
> log ('Init ' );
> var packageName := self.name;
> }
> log ('Do' );
> name := packageName; end
> {
> log ('End' );
> }
> }
> The following not:
>
> mapping Package::transformHelloComplete ( ) : Package
> {
> init
> {
> log ('Init ' );
> var packageName := self.name;
> }
> population
> {
> log ('Do' );
> name := packageName; }
> end
> {
> log ('End' );
> }
> }
> The population-block is not accepted. Is there any reason for it? (Yes,
> I know, why shouldn't I be that lazy and omitt the population keyword
> and the brackets. )
>
> Thanks for answer,
> Siegfried
|
|
|
|
Re: [QVTO] simple mapping constructs [message #534696 is a reply to message #534536] |
Wed, 19 May 2010 23:39 |
Eclipse User |
|
|
|
Originally posted by: Alexander.Igdalov.gmail.com
Hi Siegfried,
When "population" keyword is omitted, the text between the init and end
sections is considered to be contained in an implicit object expression.
If you explicitly use "population" keyword, you have to explicitly use
the object expression, otherwise the qvt compiler doesn't have the idea
that you want to update the properties of the mapping result.
BTW, the explicit population section is sensible in cases when a mapping
has multiple results, e.g.:
mapping EPackage::myMapping() : a : EClass, b : EPackage {
population {
object a : EClass { name := 'C'; };
object b : EPackage { name := 'P'; };
}
}
In most mappings the population keyword is not needed at all.
Best,
- Alex.
Siegfried wrote:
> Thanks you all,
>
> the tip with the explicite object expression did it. And it is near to
> the specification example as well (p48), though I really don't
> understand, why. Anyway, it works.
>
> Siegfried
|
|
|
Powered by
FUDForum. Page generated in 0.03103 seconds