Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Metamodel contains several classifiers with same name, then ClassCast exception
Metamodel contains several classifiers with same name, then ClassCast exception [message #990595] Thu, 13 December 2012 06:16 Go to next message
Leonid Ripeynih is currently offline Leonid Ripeynih
Messages: 98
Registered: February 2012
Member
Hi, I've got the following probmem transforming model with cross-references to UML model. My rule is:
rule GFRoot2Docschema {
  from
    gfr : GF!FGUmlLinked(
      gfr.refImmediateComposite().oclIsUndefined() -- root element
    )
  using {
    uml : GF!Class = gfr.umlElement;
  }
  to 
    dr : Desc!DocumentRoot (
      docschema <- ds
    ),
    ds : Desc!DocschemaElem(
      id <- uml.name, -- shoukd be ID
      desc <- uml.name,
      parentId <- uml.parentId,
      definitions <- df,
      content <- cn
    ),
    df : Desc!DefinitionsElem(
      
    ),
    cn : Desc!ContentElem(
      
    )
}


I have cross-references enabled in launch dialog. Howere, it first complains about the same meta-model element:

Metamodel contains several classifiers with same name: EAttribute
Metamodel contains several classifiers with same name: ecore::EAttribute
Metamodel contains several classifiers with same name: EAnnotation
Metamodel contains several classifiers with same name: ecore::EAnnotation
Metamodel contains several classifiers with same name: EClass
Metamodel contains several classifiers with same name: ecore::EClass
Metamodel contains several classifiers with same name: EClassifier
Metamodel contains several classifiers with same name: ecore::EClassifier
Metamodel contains several classifiers with same name: EDataType
Metamodel contains several classifiers with same name: ecore::EDataType
Metamodel contains several classifiers with same name: EEnum
Metamodel contains several classifiers with same name: ecore::EEnum
Metamodel contains several classifiers with same name: EEnumLiteral
Metamodel contains several classifiers with same name: ecore::EEnumLiteral
Metamodel contains several classifiers with same name: EFactory
Metamodel contains several classifiers with same name: ecore::EFactory
Metamodel contains several classifiers with same name: EModelElement
Metamodel contains several classifiers with same name: ecore::EModelElement
Metamodel contains several classifiers with same name: ENamedElement
Metamodel contains several classifiers with same name: ecore::ENamedElement
Metamodel contains several classifiers with same name: EObject
Metamodel contains several classifiers with same name: ecore::EObject
Metamodel contains several classifiers with same name: EOperation
Metamodel contains several classifiers with same name: ecore::EOperation
Metamodel contains several classifiers with same name: EPackage
Metamodel contains several classifiers with same name: ecore::EPackage
Metamodel contains several classifiers with same name: EParameter
Metamodel contains several classifiers with same name: ecore::EParameter
Metamodel contains several classifiers with same name: EReference
Metamodel contains several classifiers with same name: ecore::EReference
Metamodel contains several classifiers with same name: EStructuralFeature
Metamodel contains several classifiers with same name: ecore::EStructuralFeature
Metamodel contains several classifiers with same name: ETypedElement
Metamodel contains several classifiers with same name: ecore::ETypedElement
Metamodel contains several classifiers with same name: EBigDecimal
Metamodel contains several classifiers with same name: ecore::EBigDecimal
Metamodel contains several classifiers with same name: EBigInteger
Metamodel contains several classifiers with same name: ecore::EBigInteger
Metamodel contains several classifiers with same name: EBoolean
Metamodel contains several classifiers with same name: ecore::EBoolean
Metamodel contains several classifiers with same name: EBooleanObject
Metamodel contains several classifiers with same name: ecore::EBooleanObject
Metamodel contains several classifiers with same name: EByte
Metamodel contains several classifiers with same name: ecore::EByte
Metamodel contains several classifiers with same name: EByteArray
Metamodel contains several classifiers with same name: ecore::EByteArray
Metamodel contains several classifiers with same name: EByteObject
Metamodel contains several classifiers with same name: ecore::EByteObject
Metamodel contains several classifiers with same name: EChar
Metamodel contains several classifiers with same name: ecore::EChar
Metamodel contains several classifiers with same name: ECharacterObject
Metamodel contains several classifiers with same name: ecore::ECharacterObject
Metamodel contains several classifiers with same name: EDate
Metamodel contains several classifiers with same name: ecore::EDate
Metamodel contains several classifiers with same name: EDiagnosticChain
Metamodel contains several classifiers with same name: ecore::EDiagnosticChain
Metamodel contains several classifiers with same name: EDouble
Metamodel contains several classifiers with same name: ecore::EDouble
Metamodel contains several classifiers with same name: EDoubleObject
Metamodel contains several classifiers with same name: ecore::EDoubleObject
Metamodel contains several classifiers with same name: EEList
Metamodel contains several classifiers with same name: ecore::EEList
Metamodel contains several classifiers with same name: EEnumerator
Metamodel contains several classifiers with same name: ecore::EEnumerator
Metamodel contains several classifiers with same name: EFeatureMap
Metamodel contains several classifiers with same name: ecore::EFeatureMap
Metamodel contains several classifiers with same name: EFeatureMapEntry
Metamodel contains several classifiers with same name: ecore::EFeatureMapEntry
Metamodel contains several classifiers with same name: EFloat
Metamodel contains several classifiers with same name: ecore::EFloat
Metamodel contains several classifiers with same name: EFloatObject
Metamodel contains several classifiers with same name: ecore::EFloatObject
Metamodel contains several classifiers with same name: EInt
Metamodel contains several classifiers with same name: ecore::EInt
Metamodel contains several classifiers with same name: EIntegerObject
Metamodel contains several classifiers with same name: ecore::EIntegerObject
Metamodel contains several classifiers with same name: EJavaClass
Metamodel contains several classifiers with same name: ecore::EJavaClass
Metamodel contains several classifiers with same name: EJavaObject
Metamodel contains several classifiers with same name: ecore::EJavaObject
Metamodel contains several classifiers with same name: ELong
Metamodel contains several classifiers with same name: ecore::ELong
Metamodel contains several classifiers with same name: ELongObject
Metamodel contains several classifiers with same name: ecore::ELongObject
Metamodel contains several classifiers with same name: EMap
Metamodel contains several classifiers with same name: ecore::EMap
Metamodel contains several classifiers with same name: EResource
Metamodel contains several classifiers with same name: ecore::EResource
Metamodel contains several classifiers with same name: EResourceSet
Metamodel contains several classifiers with same name: ecore::EResourceSet
Metamodel contains several classifiers with same name: EShort
Metamodel contains several classifiers with same name: ecore::EShort
Metamodel contains several classifiers with same name: EShortObject
Metamodel contains several classifiers with same name: ecore::EShortObject
Metamodel contains several classifiers with same name: EString
Metamodel contains several classifiers with same name: ecore::EString
Metamodel contains several classifiers with same name: EStringToStringMapEntry
Metamodel contains several classifiers with same name: ecore::EStringToStringMapEntry
Metamodel contains several classifiers with same name: ETreeIterator
Metamodel contains several classifiers with same name: ecore::ETreeIterator
Metamodel contains several classifiers with same name: EGenericType
Metamodel contains several classifiers with same name: ecore::EGenericType
Metamodel contains several classifiers with same name: ETypeParameter
Metamodel contains several classifiers with same name: ecore::ETypeParameter
Metamodel contains several classifiers with same name: EInvocationTargetException
Metamodel contains several classifiers with same name: ecore::EInvocationTargetException
Metamodel contains several classifiers with same name: DocumentRoot


Then failes at
uml : GF!Class = gfr.umlElement;


with
org.eclipse.m2m.atl.engine.emfvm.VMException: The value of type 'class org.eclipse.uml2.uml.internal.impl.ClassImpl' must be of type 'org.eclipse.emf.ecore.impl.EClassImpl@1742220d (name: NamedElement) (instanceClassName: null) (abstract: true, interface: false)'
	at __matchGFRoot2Docschema#27(GenFormular2Desc.atl[22:21-22:35])
		local variables: self=GenFormular2Desc : ASMModule, gfr=IN!Контракт
	at __matcher__#1(GenFormular2Desc.atl)
		local variables: self=GenFormular2Desc : ASMModule
	at main#28(GenFormular2Desc.atl)
		local variables: self=GenFormular2Desc : ASMModule
Java Stack:
org.eclipse.m2m.atl.engine.emfvm.VMException: The value of type 'class org.eclipse.uml2.uml.internal.impl.ClassImpl' must be of type 'org.eclipse.emf.ecore.impl.EClassImpl@1742220d (name: NamedElement) (instanceClassName: null) (abstract: true, interface: false)'
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:643)
	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:300)
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:237)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:937)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1141)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.ClassCastException: The value of type 'class org.eclipse.uml2.uml.internal.impl.ClassImpl' must be of type 'org.eclipse.emf.ecore.impl.EClassImpl@1742220d (name: NamedElement) (instanceClassName: null) (abstract: true, interface: false)'
	at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSettingDelegateSingleEObject.dynamicGet(EStructuralFeatureImpl.java:2345)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1037)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1021)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1013)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1008)
	at org.eclipse.m2m.atl.engine.emfvm.adapter.EMFModelAdapter.get(EMFModelAdapter.java:511)
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:489)
	... 13 more


As the class cast is looking like eCore meta-model was loaded twice (?) i think that it's related to same metamodel elements warnings. What couild i do to fix it?
Re: Metamodel contains several classifiers with same name, then ClassCast exception [message #990608 is a reply to message #990595] Thu, 13 December 2012 07:12 Go to previous messageGo to next message
Andreas Brieg is currently offline Andreas Brieg
Messages: 48
Registered: November 2012
Member
What @nsURI tags are in your .atl file and how does your create statement look?

[Updated on: Thu, 13 December 2012 07:12]

Report message to a moderator

Re: Metamodel contains several classifiers with same name, then ClassCast exception [message #990614 is a reply to message #990608] Thu, 13 December 2012 07:44 Go to previous messageGo to next message
Leonid Ripeynih is currently offline Leonid Ripeynih
Messages: 98
Registered: February 2012
Member
Thank you for you quick answere. I don't have any nsURI (am I should?) in my header, only pathes to my models.

GF is a source meta-model allowing wrapping (decorating) some UML classes.
Desc is a target metamodel, which doesn't have references to any other models, just some information holder, much like java beans. So, here is my declarations:
-- @path GF=/plugin.fgenmodel/model/fgenmodel.ecore
-- @path Desc=/plugin.model/model/desc.ecore


And here is my create statement:
create OUT : Desc from IN : GF;
Re: Metamodel contains several classifiers with same name, then ClassCast exception [message #990909 is a reply to message #990595] Fri, 14 December 2012 14:13 Go to previous messageGo to next message
Leonid Ripeynih is currently offline Leonid Ripeynih
Messages: 98
Registered: February 2012
Member
Well, I've solved this one. That was pretty frustrating to debug...

The problem was in my meta-model XMI (ecore) serrialization. When i've loaded an UML model in ECore editor, i've browsed through the registered packages, and picked an UML one. It was automatically resolved to platform:/plugin/some.uml2.package/UML.ecore. Then it was saved to xmi, with eType="ecore:EClass platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//NamedElement". Changing it to eType="ecore:EClass http://www.eclipse.org/uml2/3.0.0/UML#//NamedElement" solved the problem, as now there is only ONE instance of UML.ecore model is loading.

Is it a bug?
Re: Metamodel contains several classifiers with same name, then ClassCast exception [message #990941 is a reply to message #990909] Sat, 15 December 2012 02:25 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4035
Registered: July 2009
Senior Member
Hi

It's a traditional behaviour, and you get what you ask for:

http:/... is the installed model as compiled Java
platform:/ ... *.ecore is an Ecore file.

They might be different and so are loaded separately and lead to what I
call metamodel schizophrenia (Google it).

IMHO this is just about never useful and frequently shows up in obscure
ways. The metamodel loader for the new OCL makes a virtue of Complete
OCL's need for a load-time merge to define all packages with the same
hierarchical nsURI as the same package and diagnose conflicting
duplicates. You may also use OCL's ProjectMap to ensure that each of
http:/..., platform:/plugin/... and platform:/resource/... resolve to a
single resource.

Regards

Ed Willink


On 14/12/2012 19:13, Dark Diver wrote:
> Well, I've solved this one. That was pretty frustrating to debug...
> The problem was in my meta-model XMI (ecore) serrialization. When i've
> loaded an UML model in ECore editor, i've browsed through the
> registered packages, and picked an UML one. It was automatically
> resolved to platform:/plugin/some.uml2.package/UML.ecore. Then it was
> saved to xmi, with eType="ecore:EClass
> platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//NamedElement".
> Changing it to eType="ecore:EClass
> http://www.eclipse.org/uml2/3.0.0/UML#//NamedElement" solved the
> problem, as now there is only ONE instance of UML.ecore model is loading.
> Is it a bug?
Previous Topic:resolveTemp over several associations
Next Topic:Several XML Files into one UML
Goto Forum:
  


Current Time: Sat Aug 30 08:28:47 EDT 2014

Powered by FUDForum. Page generated in 0.02768 seconds