Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Problems to reference a non-default target pattern of a matched rule
[ATL] Problems to reference a non-default target pattern of a matched rule [message #44751] Wed, 06 June 2007 09:02 Go to next message
Eclipse UserFriend
Originally posted by: erik_becker.gmx.de

Hello,

I have a matched rule that has two target elements:

rule Activity {
from
element : XML!Element(
element.isFunction()
)
to
activity : XML!Element(
name <- 'Activity',
children <- ...
),
transition : XML!Element(
name <- 'Transition',
children <- ...
}
)
}

This rule dedicated to some elements that are linked another rule:

rule WorkflowProcess {
from
element : XML!Element(
element.isEPK();
)
to
workflowProcess : XML!Element(
name <- 'WorkflowProcess',
children <- Sequence{activities, transitions}
),
activities : XML!Element(
name <- 'Activities',
children <- element.getElemsByName('ObjOcc')
->select(e | e.representsActivity())
}
),
transitions : XML!Element(
name <- 'Transitions',
children <- element.getElemsByName('ObjOcc')
->select(e | e.representsActivity())
)
}

If I do so both elements resulting from my rule 'Activity' are attached
to the transitions element.
What I want is that the default - activity - is attached to activities
and the transition elements to transitions.
In XML it should look like this:

<WorkflowProcess>
<Activities>
<Activity ...>
<Activity ...>
...
</Activities>
<Transitions>
<Transition ...>
<Transition ...>
....
</Transitions>
</WorkflowProcess>

I've already tried serveral this with and without resolveTemp() but
nothing worked.
Is there a solution for my problem?

Greetings

Erik
Re: [ATL] Problems to reference a non-default target pattern of a matched rule [message #45083 is a reply to message #44751] Fri, 08 June 2007 09:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rchevrel.sodius.com

This is a multi-part message in MIME format.
--------------050107050005050808030603
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

I Eric,

You try to set children properties two times, but children is a
container features, so, it cannot work.

Instead of trying attach children node (Attributes -> children =
{attribute}), try to attach an Attribute to its container like:

------------------------------------------------------------ --------------------------------------------------
-- We suppose that there is only one EPK. This helper allow us to refer
this specific element
helper def: EPK_Element : XML!Element =
M_in.getInstances(XML!Element)->select(e | e.isEPK())->first();
------------------------------------------------------------ --------------------------------------------------
-- We change this rule in order to delegate the composition tree
construction to the children nodes
rule Activity {
from
element : XML!Element(
element.isFunction()
)
to
activity : XML!Element(
-- we attach the child with its parent
parent <- thisModule.resolveTemp(thisModule.EPK_Element,
"activities"),
name <- 'Activity',
children <- ...
),
transition : XML!Element(
-- we attach the child with its parent
parent <- thisModule.resolveTemp(thisModule.EPK_Element,
"transitions"),
name <- 'Transition',
children <- ...
}
)
}
------------------------------------------------------------ --------------------------------------------------
-- We remove the problematic double children feature set
rule WorkflowProcess {
from
element : XML!Element(
element.isEPK();
)
to
workflowProcess : XML!Element(
name <- 'WorkflowProcess',
children <- Sequence{activities, transitions}
),
activities : XML!Element(
name <- 'Activities'
),
transitions : XML!Element(
name <- 'Transitions'
)
}
------------------------------------------------------------ --------------------------------------------------


Regards,

*R
Re: [ATL] Problems to reference a non-default target pattern of a matched rule [message #45174 is a reply to message #45083] Fri, 08 June 2007 09:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rchevrel.sodius.com

This is a multi-part message in MIME format.
--------------060306030905070009010807
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Please replace the double quotes, with simple quote.
thisModule.resolveTemp(thisModule.EPK_Element, 'activities'),
thisModule.resolveTemp(thisModule.EPK_Element, 'transitions'),

R
Re: [ATL] Problems to reference a non-default target pattern of a matched rule [message #45296 is a reply to message #45174] Fri, 08 June 2007 12:30 Go to previous message
Eclipse UserFriend
Originally posted by: erik_becker.gmx.de

Many thanks Regis! That works fine for me!

Régis schrieb:
> Please replace the double quotes, with simple quote.
> thisModule.resolveTemp(thisModule.EPK_Element, 'activities'),
> thisModule.resolveTemp(thisModule.EPK_Element, 'transitions'),
>
> Régis a écrit :
>> I Eric,
>>
>> You try to set children properties two times, but children is a
>> container features, so, it cannot work.
>>
>> Instead of trying attach children node (Attributes -> children =
>> {attribute}), try to attach an Attribute to its container like:
>>
>> ------------------------------------------------------------ --------------------------------------------------
>> -- We suppose that there is only one EPK. This helper allow us to
>> refer this specific element
>> helper def: EPK_Element : XML!Element =
>> M_in.getInstances(XML!Element)->select(e | e.isEPK())->first();
>> ------------------------------------------------------------ --------------------------------------------------
>> -- We change this rule in order to delegate the composition tree
>> construction to the children nodes
>> rule Activity {
>> from
>> element : XML!Element(
>> element.isFunction()
>> )
>> to
>> activity : XML!Element(
>> -- we attach the child with its parent
>> parent <- thisModule.resolveTemp(thisModule.EPK_Element,
>> "activities"),
>> name <- 'Activity',
>> children <- ...
>> ),
>> transition : XML!Element(
>> -- we attach the child with its parent
>> parent <- thisModule.resolveTemp(thisModule.EPK_Element,
>> "transitions"),
>> name <- 'Transition',
>> children <- ...
>> }
>> )
>> }
>> ------------------------------------------------------------ --------------------------------------------------
>> -- We remove the problematic double children feature set
>> rule WorkflowProcess {
>> from
>> element : XML!Element(
>> element.isEPK();
>> )
>> to
>> workflowProcess : XML!Element(
>> name <- 'WorkflowProcess',
>> children <- Sequence{activities, transitions}
>> ),
>> activities : XML!Element(
>> name <- 'Activities'
>> ),
>> transitions : XML!Element(
>> name <- 'Transitions'
>> )
>> }
>> ------------------------------------------------------------ --------------------------------------------------
>>
>>
>> Regards,
>>
>> *Régis CHEVREL* <mailto:rchevrel@sodius.com>
>>
>>
>> SODIUS*
>> *6, rue Cornouaille
>> 44319 Nantes - France
>>
>> Phone: +33 (0)2 28 23 54 34
>>
>> ***www.mdworkbench.com* <http://www.mdworkbench.com/>* *
>> Draw more value from your model
>>
>>
>> Erik Becker a écrit :
>>> Hello,
>>>
>>> I have a matched rule that has two target elements:
>>>
>>> rule Activity {
>>> from
>>> element : XML!Element(
>>> element.isFunction()
>>> )
>>> to
>>> activity : XML!Element(
>>> name <- 'Activity',
>>> children <- ...
>>> ),
>>> transition : XML!Element(
>>> name <- 'Transition',
>>> children <- ...
>>> }
>>> )
>>> }
>>>
>>> This rule dedicated to some elements that are linked another rule:
>>>
>>> rule WorkflowProcess {
>>> from
>>> element : XML!Element(
>>> element.isEPK();
>>> )
>>> to
>>> workflowProcess : XML!Element(
>>> name <- 'WorkflowProcess',
>>> children <- Sequence{activities, transitions}
>>> ),
>>> activities : XML!Element(
>>> name <- 'Activities',
>>> children <- element.getElemsByName('ObjOcc')
>>> ->select(e | e.representsActivity())
>>> }
>>> ),
>>> transitions : XML!Element(
>>> name <- 'Transitions',
>>> children <- element.getElemsByName('ObjOcc')
>>> ->select(e | e.representsActivity())
>>> )
>>> }
>>>
>>> If I do so both elements resulting from my rule 'Activity' are
>>> attached to the transitions element.
>>> What I want is that the default - activity - is attached to
>>> activities and the transition elements to transitions.
>>> In XML it should look like this:
>>>
>>> <WorkflowProcess>
>>> <Activities>
>>> <Activity ...>
>>> <Activity ...>
>>> ...
>>> </Activities>
>>> <Transitions>
>>> <Transition ...>
>>> <Transition ...>
>>> ....
>>> </Transitions>
>>> </WorkflowProcess>
>>>
>>> I've already tried serveral this with and without resolveTemp() but
>>> nothing worked.
>>> Is there a solution for my problem?
>>>
>>> Greetings
>>>
>>> Erik
>>
>
Previous Topic:[ATL] New ATL use case: QVT to ATL Virtual Machine Compiler
Next Topic:[ATL] verification
Goto Forum:
  


Current Time: Mon Dec 30 16:47:01 GMT 2024

Powered by FUDForum. Page generated in 0.03445 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top