Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Problem when referencing a created target element within a rule (Problem when referencing a created target element within a rule )
[ATL] Problem when referencing a created target element within a rule [message #534485] Wed, 19 May 2010 10:38 Go to next message
kikou  is currently offline kikou Friend
Messages: 7
Registered: May 2010
Junior Member
Hello !!
I am trying this ATL code but when lunching the transformation i receive this notification "An internal error occurred during: "Launching Principal Program".
java.lang.String cannot be cast to org.eclipse.emf.ecore.EObject
I know that the source of my problem is the wrong way I used to reference the bevavior when I call the "createBehaviorVariable" Rule. (I have put it in red color).
Can you please tell me the right way to reference the behavior within the "createBehaviorVariable" rule.
I inclosed my source code to this message.
Thank you so much.
Best regards.

kikou


rule UIMLRulefromTask {
from
s: bpmn!Task
do {
thisModule.createBehavior (s.Id.toString());
thisModule.createBehaviorVariable(s.Id.toString(), 'string', true, s.Id);

}
}

rule createBehavior(id: String ) {
to c: xml!Behavior ()
do
{
c.id <- id;
}
}

rule createBehaviorVariable(name: String, type: String, value: String, behavior: xml!Behavior) {
to
variable: xml!Variable()
do
{
variable.name <- name;
variable.type <- type;
variable.value <- value;
behavior.variable <- variable;
}
}

[Updated on: Wed, 19 May 2010 10:44]

Report message to a moderator

Re: [ATL] Problem when referencing a created target element within a rule [message #534499 is a reply to message #534485] Wed, 19 May 2010 11:23 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Why are you using called rules ?

rule UIMLRulefromTask {
from
s: bpmn!Task
to behavior : xml!Behavior (
id <- s.Id.toString(),
variable <- variable
),
variable: xml!Variable(
name <- s.Id.toString(),
type <- 'string',
value <- true
)
}
Re: [ATL] Problem when referencing a created target element within a rule [message #534507 is a reply to message #534499] Wed, 19 May 2010 11:48 Go to previous messageGo to next message
kikou  is currently offline kikou Friend
Messages: 7
Registered: May 2010
Junior Member
Thank you Sylvain for your fast answer.
In fact, I am using called rules because my source code is complex and what i have enclosed with my first message is only a small part. That's why I need to use complex conditions and statements. I think that's why I have to use the called rule.
Else, you think that it will be impossible to make that solution with called rules ?
If there is not the case , could you please tell me the right way to reference the behavior within the "createBehaviorVariable" rule.

I thank you again for your answer.
Best regards.

Kikou
Re: [ATL] Problem when referencing a created target element within a rule [message #534522 is a reply to message #534485] Wed, 19 May 2010 12:28 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
rule UIMLRulefromTask {
from
s: bpmn!Task
using{
behavior : OclAny = OclUndefined;
}
do {
behavior <- thisModule.createBehavior (s.Id.toString());
thisModule.createBehaviorVariable(s.Id.toString(), 'string', true, behavior);
}
}
Re: [ATL] Problem when referencing a created target element within a rule [message #534539 is a reply to message #534522] Wed, 19 May 2010 13:19 Go to previous messageGo to next message
kikou  is currently offline kikou Friend
Messages: 7
Registered: May 2010
Junior Member
Thank you Sylvain for paying attention to my problem.
I tried your last recommendation but I have received this error displayed on the eclipse console:

org.eclipse.m2m.atl.engine.emfvm.VMException: -1
at __applyUIMLRulefromTask(FromBPMNtoUIML.atl[34:9-34:64])
local variables: self=thisModule, link=org.eclipse.m2m.atl.engine.emfvm.lib.TransientLink@1e28fe3, s=IN!<unnamed>:bpmn!Task, behavior=OclUndefined

Here the referenced error line which is selected is
behavior <- thisModule.createBehavior(s.Id.toString());
Even if changed the "OclAny" type to "xml!Behavior", the error persist.
Could you please indicate to me how I could change this line. I'm really blocked.

Thanks a lot.
Best regards.

Kikou
Re: [ATL] Problem when referencing a created target element within a rule [message #534541 is a reply to message #534485] Wed, 19 May 2010 13:35 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
try :

rule createBehavior(id: String ) {
to c: xml!Behavior ()
do
{
c.id <- id;
c;
}
}
Re: [ATL] Problem when referencing a created target element within a rule [message #534543 is a reply to message #534541] Wed, 19 May 2010 13:46 Go to previous messageGo to next message
kikou  is currently offline kikou Friend
Messages: 7
Registered: May 2010
Junior Member
Thank you so much Sylvain !!!!
It works perfectly Smile
I was really blockedwhile seraching a solution and now i will restart working thanks to your help.

Best regards and good luck.
Kikou
Re: [ATL] Problem when referencing a created target element within a rule [message #534556 is a reply to message #534485] Wed, 19 May 2010 14:21 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
With a called rule you have to indicate what is returned by the called rule.

The way to do that is a bit harsch as you have to code the returned entities in the last sentence of the do section of the called rules (c; here). You can also return a sequence if you create many elements in the called rule.

to t1 (), t2 ()
do{
Sequence{t1,t2};
}
Re: [ATL] Problem when referencing a created target element within a rule [message #534566 is a reply to message #534556] Wed, 19 May 2010 14:56 Go to previous message
kikou  is currently offline kikou Friend
Messages: 7
Registered: May 2010
Junior Member
Thank you again Sylvain,
It's more and more clear for me why I have to add the line you added.
Good luck.

Kikou
Previous Topic:[ATL] wiki user guide on language small mistakes
Next Topic:[QVTo] Problems using the "resolve/resolveone" command - tracking objects
Goto Forum:
  


Current Time: Thu Apr 25 06:04:35 GMT 2024

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

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

Back to the top