[ATL] Call lazy rule not for a collection [message #671859] |
Thu, 19 May 2011 07:54 |
Patrick Schmitt Messages: 87 Registered: July 2009 |
Member |
|
|
I am using following example to call a lazy rule for a collection:
create OUT : B from IN : A;
rule RootElement {
from
billOfMaterial : A!BillOfMaterial
to
target : B!BCModel (
categories <- billOfMaterial.armature.parts->collect(e | thisModule.Part2Category(e))
)
}
lazy rule Part2Category {
from
s : A!Part
to
t : B!Category(
)
}
Can anybody tell me how to call a lazy rule for a single object? In my case i want to call it for billOfMaterial.armature(which is not a collection), but did not find such a case in the documentation.
Second problem is how to get information from billOfMaterial to that lazy rule function??
Sorry for my stupid questions, in my opinion ATL is quite difficult to understand for beginners.
Cheers
Patrick
[Updated on: Thu, 19 May 2011 07:56] Report message to a moderator
|
|
|
|
|
|
|
Re: [ATL] Call lazy rule not for a collection [message #672197 is a reply to message #672024] |
Fri, 20 May 2011 09:36 |
Patrick Schmitt Messages: 87 Registered: July 2009 |
Member |
|
|
Sylvain EVEILLARD wrote on Thu, 19 May 2011 11:36rule RootElement {
from
billOfMaterial : A!BillOfMaterial
to
target : B!BCModel (
categories <- if billOfMaterial.armature.oclIsUndefined() then OclUndefined else thisModule.addArmature() endif
)
}
lary rule addArmature{
from arm : A!Armature
to t : B!Category()
}
I have again a question:
Lets assume category object contains a list of "Distributors". I want to fill that list with new "Distributor" objects. Theese objects have to get filled with information from "Part" objects. The "Part" instances are children from billOfMaterial.armature.
What expressions do i have to use for such use cases ? I am playing with ATL without getting a working result, so i would be very pleased for some hints.
[Updated on: Fri, 20 May 2011 09:38] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04171 seconds