Home » Modeling » M2T (model-to-text transformation) » java.lang.ClassCastException while transforming source EReference to Target ERefernce.
java.lang.ClassCastException while transforming source EReference to Target ERefernce. [message #1838523] |
Sat, 27 February 2021 09:56 |
houda houda Messages: 12 Registered: February 2021 |
Junior Member |
|
|
Hello,
I am trying to achieve aM2M transformation using ATL. So I am transforming Source (first figure ) class named "part" and its properties to Target (second figure) class named "Parameter" and its properties.
================================
================================
I would like to transform part(partelement) property to Parameter(parametertypereference) so i wrote the following ATL transformation:
rule part2Parameter{
from s: wsdl!part, s1: wsdl!schema
to t:gcsd!Parameter
( sampleValues <- 'Param',
parametertypereference <- s.partelement ),
t2:gcsd!TypeReference
( unitSymbol<- s.type,
classificationSystemID <- s1.xmlns )
}
And i generated the following instance to run my transformation on :
<messageDefinition
name="messagein">
<part name="p1"
partelement="//@typesDefinition/@schema.0/@elementSchema.0"
type="strn"/>
</messageDefinition>
<messageDefinition
name="messageout">
<part name="p2"
partelement="//@typesDefinition/@schema.0/@elementSchema.1"
type="int"/>
</messageDefinition>
However, when i run the transformation it donesn't seem to transform the Ereference "partelement" from "part" to "element" into "parametertypereference", which is from "Parameter" to "TypeReference" and i get the following error:
org.eclipse.m2m.atl.engine.emfvm.VMException: The value of type 'org.eclipse.emf.ecore.impl.EClassImpl@32517953 (name: element) (instanceClassName: null) (abstract: false, interface: false)' must be of type 'org.eclipse.emf.ecore.impl.EClassImpl@13a712f1 (name: TypeReference) (instanceClassName: null) (abstract: false, interface: false)'
at __applypart2Parameter#39(wsdl2gcsd.atl[43:5-43:44])
local variables: self=wsdl2gcsd : ASMModule, link=TransientLink {rule = part2Parameter, sourceElements = {s = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@6c405db1 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@3d6c89b (name: part) (instanceClassName: null) (abstract: false, interface: false)), s1 = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@26177b4d (eClass: org.eclipse.emf.ecore.impl.EClassImpl@23442127 (name: schema) (instanceClassName: null) (abstract: false, interface: false))}, targetElements = {t4 = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@1d67082d (eClass: org.eclipse.emf.ecore.impl.EClassImpl@381d3c7c (name: Description) (instanceClassName: null) (abstract: false, interface: false)), t = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@73a473e5 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@4540ab74 (name: Parameter) (instanceClassName: null) (abstract: false, interface: false)), t1 = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@5185be4f (eClass: org.eclipse.emf.ecore.impl.EClassImpl@381d3c7c (name: Description) (instanceClassName: null) (abstract: false, interface: false)), t2 = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@4cd56a21 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@13a712f1 (name: TypeReference) (instanceClassName: null) (abstract: false, interface: false)), t3 = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@69d635f6 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@18294587 (name: Artifact) (instanceClassName: null) (abstract: false, interface: false))}, variables = {}}, s=IN!p1, s1=IN!<unnamed>, t=OUT!<unnamed>, t1=OUT!<unnamed>, t2=OUT!<unnamed>, t3=OUT!<unnamed>, t4=OUT!<unnamed>
at __exec__#28(wsdl2gcsd.atl)
local variables: self=wsdl2gcsd : ASMModule, e=TransientLink {rule = part2Parameter, sourceElements = {s = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@6c405db1 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@3d6c89b (name: part) (instanceClassName: null) (abstract: false, interface: false)), s1 = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@26177b4d (eClass: org.eclipse.emf.ecore.impl.EClassImpl@23442127 (name: schema) (instanceClassName: null) (abstract: false, interface: false))}, targetElements = {t4 = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@1d67082d (eClass: org.eclipse.emf.ecore.impl.EClassImpl@381d3c7c (name: Description) (instanceClassName: null) (abstract: false, interface: false)), t = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@73a473e5 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@4540ab74 (name: Parameter) (instanceClassName: null) (abstract: false, interface: false)), t1 = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@5185be4f (eClass: org.eclipse.emf.ecore.impl.EClassImpl@381d3c7c (name: Description) (instanceClassName: null) (abstract: false, interface: false)), t2 = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@4cd56a21 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@13a712f1 (name: TypeReference) (instanceClassName: null) (abstract: false, interface: false)), t3 = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@69d635f6 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@18294587 (name: Artifact) (instanceClassName: null) (abstract: false, interface: false))}, variables = {}}
at main#24(wsdl2gcsd.atl)
local variables: self=wsdl2gcsd : ASMModule
Java Stack:
org.eclipse.m2m.atl.engine.emfvm.VMException: The value of type 'org.eclipse.emf.ecore.impl.EClassImpl@32517953 (name: element) (instanceClassName: null) (abstract: false, interface: false)' must be of type 'org.eclipse.emf.ecore.impl.EClassImpl@13a712f1 (name: TypeReference) (instanceClassName: null) (abstract: false, interface: false)'
at org.eclipse.m2m.atl.engine.emfvm.adapter.EMFModelAdapter.set(EMFModelAdapter.java:679)
at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:474)
at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:388)
at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:388)
at org.eclipse.m2m.atl.engine.emfvm.ASM.run(ASM.java:208)
at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(EMFVMLauncher.java:170)
at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMUILauncher.launch(EMFVMUILauncher.java:46)
at org.eclipse.m2m.atl.core.service.LauncherService.launch(LauncherService.java:136)
at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launchOrDebug(AtlLaunchConfigurationDelegate.java:307)
at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:237)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:807)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:718)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1021)
at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:1224)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.ClassCastException: The value of type 'org.eclipse.emf.ecore.impl.EClassImpl@32517953 (name: element) (instanceClassName: null) (abstract: false, interface: false)' must be of type 'org.eclipse.emf.ecore.impl.EClassImpl@13a712f1 (name: TypeReference) (instanceClassName: null) (abstract: false, interface: false)'
at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSettingDelegateSingleEObject.dynamicSet(EStructuralFeatureImpl.java:2658)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(BasicEObjectImpl.java:1166)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1140)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1110)
at org.eclipse.m2m.atl.engine.emfvm.adapter.EMFModelAdapter.internalSet(EMFModelAdapter.java:718)
at org.eclipse.m2m.atl.engine.emfvm.adapter.EMFModelAdapter.set(EMFModelAdapter.java:672)
... 14 more
I tried to understand the reason behind the "java.lang.ClassCastException" error but couldn't find a proper response.
If anyone could help me I would be very thankful.
My best regards.
-
Attachment: source.png
(Size: 21.16KB, Downloaded 225 times) -
Attachment: target.png
(Size: 9.89KB, Downloaded 213 times)
|
|
| |
Goto Forum:
Current Time: Sun Dec 08 12:49:17 GMT 2024
Powered by FUDForum. Page generated in 0.03787 seconds
|