Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Navigation of target model in ATL
[ATL] Navigation of target model in ATL [message #71089] Wed, 09 January 2008 13:45 Go to next message
Eclipse UserFriend
Originally posted by: m.a.cibran.gmail.com

Hi all,

I am currently working on defining an ATL transformation to map STP BPMN
to UML activity diagrams with which I am experiencing some problems. I am
quite new to ATL so probably these errors seem trivial to some of you (in
which case I would appreciate if you could share your knowledge with me
;-))

Basically, I encounter some problems when it comes to navigating target
elements in other rules than the one that creates those elements. More
concretely, at a certain point (e.g. RuleB) I need to obtain the target
element (previously created in a different rule e.g ruleA) corresponding
to a given source element. Note that I do not need to create that target
element in RuleB, I just need to obtain it in order to do something with
it (e.g. invoke a called rule passing that element as a parameter). Now,
the question is, how can I navigate to this target element?

To this end, I tried to use the resolveTemp operation but I observe
problems:

First of all, it is not really clear to me where this operation can or
should be invoked (can it be invoked from the 'to', 'do', 'using' sections
of a rule?). I tried several options and I observe in all of them an
incorrect behavior or errors:

** 1) the use the resolveTemp in the initialization expression of a
variable declared in the using clause of RuleB: it compiles but I obtain a
runtime error:

SEVERE: ERROR: could not find operation getNamedTargetFromSource on Void
having supertypes: [OclAny].

This is the extract of this declaration:

rule RuleB {
from
i: bpmn!MessagingEdge
using {
x : UML!OpaqueAction = thisModule.resolveTemp(i, 'target');
}
to ...
}

any clue of why is this failing?

** 2) I tried initializing the variable in the using clause of ruleB with
OclUndefined and the setting it in the do clause of the rule to the actual
target element. But the problem is that pattern matching seems not to be
performed in the 'do' section and therefore x is not set to the target but
to an element of the source instead:

rule RuleB {
from
i: bpmn!MessagingEdge
using {
x : UML!OpaqueAction = OclUndefined;
}
to ...
do {
x <- i.target;
}
}

and when I invoke resolveTemp in the 'do' section, an exception is thrown:

rule RuleB {
from
i: bpmn!MessagingEdge
using {
x : UML!OpaqueAction = OclUndefined;
}
to ...
do {
x <- thisModule.resolveTemp(i, 'target');
}
}

This is the exception:

java.util.EmptyStackException
at java.util.Stack.peek(Unknown Source)
at java.util.Stack.pop(Unknown Source)
at org.eclipse.m2m.atl.engine.vm.ASMStackFrame.pop
(ASMStackFrame.java:90)
at
org.eclipse.m2m.atl.engine.vm.ASMStackFrame.popVariable(ASMS tackFrame.java:118)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:248)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec
(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec
(ASMOperation.java:230)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
at org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke
(ASMOclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec
(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:289)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:155)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch (AtlLauncher.java:105)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:81)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:351)
at org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r
(AtlRegularVM.java:453)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:425)
at
org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java
:35)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch
(DebugUIPlugin.java:899)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.java:1102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
SEVERE: A.main() : ??#28 null
SEVERE: local variables = {self=BPMN2UML : ASMModule}
SEVERE: local stack = []
SEVERE: A.__exec__() : ??#58 null
SEVERE: local variables = {e=TransientLink {rule = 'MessagingEdge',
sourceElements = {i = IN!<notnamedyet>}, targetElements = {o =
OUT!<notnamedyet>}, variables = {opaque = OclUndefined}}, self=BPMN2UML :
ASMModule}
SEVERE: local stack = []
SEVERE: A.__applyMessagingEdge(1 : NTransientLink;) : ??#28 null
SEVERE: local variables = {opaque=OclUndefined, i=IN!<notnamedyet>,
link=TransientLink {rule = 'MessagingEdge', sourceElements = {i =
IN!<notnamedyet>}, targetElements = {o = OUT!<notnamedyet>}, variables =
{opaque = OclUndefined}}, self=BPMN2UML : ASMModule, o=OUT!<notnamedyet>}
SEVERE: local stack = []
SEVERE: ****** END Stack Trace

how can I interprete this exception?

Summarizing, the fundamental questions I am facing are:
a) where is pattern matching performed automatically (to traverse from
source to target)?
b) where pattern matching is NOT performed automatically and where then
can I use the resolveTemp explicitly to navigate to a target element?

Thanks in advance for your help.
Kind regards,
Agustina
Re: [ATL] Navigation of target model in ATL [message #71190 is a reply to message #71089] Wed, 09 January 2008 16:11 Go to previous message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

Dear Agustina,

My answers below,

Maria Agustina Cibran wrote:
> Hi all,
>
> I am currently working on defining an ATL transformation to map STP BPMN
> to UML activity diagrams with which I am experiencing some problems. I
> am quite new to ATL so probably these errors seem trivial to some of you
> (in which case I would appreciate if you could share your knowledge with
> me ;-))
>
> Basically, I encounter some problems when it comes to navigating target
> elements in other rules than the one that creates those elements. More
> concretely, at a certain point (e.g. RuleB) I need to obtain the target
> element (previously created in a different rule e.g ruleA) corresponding
> to a given source element. Note that I do not need to create that target
> element in RuleB, I just need to obtain it in order to do something with
> it (e.g. invoke a called rule passing that element as a parameter). Now,
> the question is, how can I navigate to this target element?

First of all, we do not talk about navigation of the target model but of
resolution (navigation of traceability links). Direct navigation of
target model is strongly discouraged in ATL.

> To this end, I tried to use the resolveTemp operation but I observe
> problems:

You are right about the use of resolveTemp. But you only need to use it
if the element you want to resolve is NOT at the first position in
target elements pattern of the rule. Having this rule:

rule R1 {
from
s : SMM!AClas
to
t1 : TMM!Bar (
),
t2 : TMM!FooBar (
)
}

resolveTemp does not need to be used to resolve t1 but only t2. Then, in
another rule

> First of all, it is not really clear to me where this operation can or
> should be invoked (can it be invoked from the 'to', 'do', 'using'
> sections of a rule?).

As resolveTemp is navigating internal traceability links, it can only be
called in target pattern elements ("to" part) and do part because those
section are "executed" after the matching that create internal
traceability links.

> I tried several options and I observe in all of
> them an incorrect behavior or errors:
>
> ** 1) the use the resolveTemp in the initialization expression of a
> variable declared in the using clause of RuleB: it compiles but I obtain
> a runtime error:
> SEVERE: ERROR: could not find operation getNamedTargetFromSource on Void
> having supertypes: [OclAny].
> This is the extract of this declaration:
>
> rule RuleB {
> from
> i: bpmn!MessagingEdge
> using {
> x : UML!OpaqueAction = thisModule.resolveTemp(i, 'target');
> }
> to ...
> }
>
> any clue of why is this failing?

There is no traceability links created when "using" is executed, so it
can not find any element. Moreover, I don't see why you want to resolve
"i" as it is matched by RuleB, the current rule. And do not forget that
an element can not be matched by more than one MatchedRule.

>
> ** 2) I tried initializing the variable in the using clause of ruleB
> with OclUndefined and the setting it in the do clause of the rule to the
> actual target element. But the problem is that pattern matching seems
> not to be performed in the 'do' section and therefore x is not set to
> the target but to an element of the source instead:
>
> rule RuleB {
> from
> i: bpmn!MessagingEdge
> using {
> x : UML!OpaqueAction = OclUndefined;
> }
> to ...
> do {
> x <- i.target;
> }
> }
>
> and when I invoke resolveTemp in the 'do' section, an exception is thrown:
>
> rule RuleB {
> from
> i: bpmn!MessagingEdge
> using {
> x : UML!OpaqueAction = OclUndefined;
> }
> to ...
> do {
> x <- thisModule.resolveTemp(i, 'target');
> }
> }
>

I don't see what you want to do here. Why don't you reference directly
target elements of the "to" part ?

>
> how can I interprete this exception?
>
> Summarizing, the fundamental questions I am facing are:
> a) where is pattern matching performed automatically (to traverse from
> source to target)?

Resolution is done automatically in "to" part. You can use resolveTemp
in "to" and "do" section.

> b) where pattern matching is NOT performed automatically and where then
> can I use the resolveTemp explicitly to navigate to a target element?

Everywhere else :)

> Thanks in advance for your help.
> Kind regards,
> Agustina
>

Best regards,
Mikael



--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Previous Topic:[ATL] A problem about resolveTemp
Next Topic:[ATL] Can a class inherit its super's context helper?
Goto Forum:
  


Current Time: Sun Sep 01 05:29:23 GMT 2024

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

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

Back to the top