[ETL] Transformation can't access part of metamodel [message #1038820] |
Thu, 11 April 2013 07:28  |
Eclipse User |
|
|
|
Hello,
I'm experiencing some difficulties with transformations when I try to follow references through files. The simplified model is like this:
test.asm.xmi:
- AssemblerObject (name = asm.test)
- InstructionCall (instruction = <Reference to MOVLW element below>)
- InstructionCallParameter (definition = <Reference to parameter element under MOVLW>, value = 5)
instructionSet.xmi:
- InstructionSet (name = iset)
- Instruction (name = MOVLW)
- InstructionParameter (defaultValue = 0)
The input of the transformation is the test.asm.xmi file and it fails at the following code:
rule assemble
transform assem : asm!AssemblerObject
to hexfile : hex!HexFile {
for (call in assem.instructions) {
var i = call.instruction;
i.eClass.println();
call.println();
i.eIsProxy().println();
i.name.println(); // Execution fails here, because it can't find 'name' property, but it's obviously there
}
}
Is this because the referenced Instruction (variable i) is in another resource? I can query its metamodel, even list its eStructuralFeatures but still can't access the values of any of its properties.
The whole project (with metamodels, transformation and ant script) can be accessed here: github.com/balazsgrill/junk/tree/Epsilon/epsilon-test
Thanks for any help in advance.
Balázs;
|
|
|
|
Re: [ETL] Transformation can't access part of metamodel [message #1041482 is a reply to message #1040302] |
Mon, 15 April 2013 02:51  |
Eclipse User |
|
|
|
Hi!
Yes, the currently uploaded version works, because it uses the reflective Ecore API instead of the EMF property name, see line 19-20:
//var i_parameters = i.parameters;
var i_parameters = i.eGet(i.eClass.eStructuralFeatures[0]);
If you uncomment line 19, it will fail with the following exception:
Property 'parameters' not found in object org.eclipse.emf.ecore.impl.DynamicEObjectImpl@265b6acb [eProxyURI: file:/C:/work/git/junk/epsilon-test/microchip.pic16.instructions.xmi#//@instructions.25 eClass: org.eclipse.emf.ecore.impl.EClassImpl@50c02acb [name: Instruction] [instanceClassName: null] [abstract: false, interface: false]] (C:\work\git\junk\epsilon-test\compiler.assemble.etl@19:29)
at org.eclipse.epsilon.eol.execute.introspection.java.JavaPropertyGetter.invoke(JavaPropertyGetter.java:48)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:70)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:44)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:90)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:226)
at org.eclipse.epsilon.eol.execute.AssignExecutor.execute(AssignExecutor.java:48)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:226)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:196)
at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute(StatementBlockExecutor.java:26)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:226)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:196)
at org.eclipse.epsilon.eol.execute.ForStatementExecutor.execute(ForStatementExecutor.java:111)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:226)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:196)
at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute(StatementBlockExecutor.java:26)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:226)
at org.eclipse.epsilon.etl.TransformRule.executeSuperRulesAndBody(TransformRule.java:264)
at org.eclipse.epsilon.etl.TransformRule.transform(TransformRule.java:200)
at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.executeTransformations(FastTransformationStrategy.java:165)
at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.transformModels(FastTransformationStrategy.java:157)
at org.eclipse.epsilon.etl.EtlModule.execute(EtlModule.java:126)
at org.eclipse.epsilon.workflow.tasks.ExecutableModuleTask.executeImpl(ExecutableModuleTask.java:193)
... 24 more
Further inspection revealed that if I use generated EMF code registered in the platform the transformation runs successfully. The problem only exists when simple ecore files are used and the model is loaded into dynamic eobjects.
Balázs;
|
|
|
Powered by
FUDForum. Page generated in 0.23602 seconds