Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] simple mapping constructs(problems with simple mapping constructs)
[QVTO] simple mapping constructs [message #533901] Mon, 17 May 2010 08:47 Go to next message
Siegfried Mising name is currently offline Siegfried Mising name
Messages: 39
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 08:49]

Report message to a moderator

Re: [QVTO] simple mapping constructs [message #534112 is a reply to message #533901] Tue, 18 May 2010 02:07 Go to previous messageGo to next message
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 08:19 Go to previous messageGo to next message
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 #534536 is a reply to message #534224] Wed, 19 May 2010 09:10 Go to previous messageGo to next message
Siegfried Mising name is currently offline Siegfried Mising name
Messages: 39
Registered: August 2009
Member
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
Re: [QVTO] simple mapping constructs [message #534696 is a reply to message #534536] Wed, 19 May 2010 19:39 Go to previous message
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
Previous Topic:[ATL]
Next Topic:called rule
Goto Forum:
  


Current Time: Fri Jul 25 18:19:45 EDT 2014

Powered by FUDForum. Page generated in 0.01844 seconds