Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2m-atl-dev] pattern matching and resolveTemp issues in ATL

Hi,

I am currently working on defining an ATL transformation to map STP BPMN to UML activity diagrams. 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 obtaining target elements in other rules than the one that created 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 get it in order to do something with it (e.g. assign some values to some properties by means of  invoking a helper or a called rules). Now, the question is, how can I obtain this target element? Is it using the resolveTemp operation?

I tried using the resolveTemp operation but I have problems:

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

** 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 real target element. But the problem is that pattern matching is not performed in the do clause and therefore x is not set to the target but to an element of the source:

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

and even if I invoke resolveTemp in the do section, as follows:

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

it does not work, I get an 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(ASMStackFrame.java:118)
    at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:248)
    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(ASMOclAny.java:91)
    at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec (ASMOperation.java:230)
    at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.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(ASMOclAny.java:91)
    at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.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.java:155)
    at org.eclipse.m2m.atl.engine.AtlLauncher.launch (AtlLauncher.java:105)
    at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:81)
    at org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLauncher(AtlRegularVM.java:351)
    at org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLauncher (AtlRegularVM.java:453)
    at org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlRegularVM.java:425)
    at org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java :35)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:766)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:608)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch (DebugUIPlugin.java:899)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlugin.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


Did any of you have these or similar problems before?

I guess 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 retrieve a target element?
c) is ATL statically typed??? I noticed that even when I declare types explicitly, ATL does not complain about the types until I try to do something (such as assigned a field to an element whose dynamic type does not accept it).

Thanks in advance for your help. I would also appreciate if you could send me links to good ATL documentation (the User manual is not enough!!) and other forums or mailing lists.

Kind regards,
Agustina

Back to the top