Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL]Load Model Problem in ATLEMFModelHandler
[ATL]Load Model Problem in ATLEMFModelHandler [message #22792] Mon, 12 March 2007 07:15 Go to next message
Eclipse UserFriend
Originally posted by: xxcs214.163.com

Dear All,

I try to test an example, metamodel is generated from schema using EMF
facilities

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:ns="http://www.m2matl.com/product"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.m2matl.com/product">
<element name="product" type="ns:Product" />
<complexType name="Product">
<sequence>
<element name="name" type="xsd:string" />
<element ref="ns:person" minOccurs="0" maxOccurs="1" />
</sequence>
</complexType>
<element name="person" type="ns:Person" abstract="true" />
<complexType name="Person" />
<element name="author" type="ns:Author" substitutionGroup="ns:person" />
<complexType name="Author">
<complexContent>
<extension base="ns:Person">
<sequence>
<element name="name" type="xsd:string" />
<element name="mail" type="xsd:string" />
</sequence>
</extension>
</complexContent>
</complexType>
</schema>

transform model (product.xml) to itsslef.

<Product xmlns="http://www.m2matl.com/product"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns="http://www.m2matl.com/product">
<name>aaaa</name>
<!--<person xsi:type="Author"> -->
<person xsi:type="ns:Author">
<name>asdd</name>
<age>123</age>
</person>
</Product>

when atl engineer(AtlEMFModelHandler) load this model,throw exceptions as
below:

org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Value
'org.eclipse.emf.ecore.impl.DynamicEObjectImpl@101cb7b (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@164538f (name: Author)
(instanceClassName: null) (abstract: false, interface: false))' is not
legal. (platform:/resource/Smaple4/models/product.xml, 7, 31)
at
org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLL oadImpl.java:80)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:189)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:179)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1089)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:895)
at
org.atl.engine.repositories.emf4atl.ASMEMFModel.loadASMEMFMo del(ASMEMFModel.java:323)
at
org.atl.eclipse.engine.AtlEMFModelHandler.loadModel(AtlEMFMo delHandler.java:122)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .loadModel(AtlLaunchConfigurationDelegate.java:275)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .getSourceModels(AtlLaunchConfigurationDelegate.java:333)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:205)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:168)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:145)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:121)
at
org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .launch(AtlLaunchConfigurationDelegate.java:97)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:639)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:565)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:754)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlu gin.java:944)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Caused by: org.eclipse.emf.ecore.xmi.IllegalValueException: Value
'org.eclipse.emf.ecore.impl.DynamicEObjectImpl@101cb7b (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@164538f (name: Author)
(instanceClassName: null) (abstract: false, interface: false))' is not
legal. (platform:/resource/Smaple4/models/product.xml, 7, 31)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XM LHandler.java:2382)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XM LHandler.java:2367)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromTy peName(XMLHandler.java:1842)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHa ndler.java:1768)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLH andler.java:1576)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:876)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:82)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:854)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:626)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:179)
... 17 more
Caused by: java.lang.IllegalArgumentException: The feature 'person' is not
a valid changeable feature
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(Basi cEObjectImpl.java:706)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:682)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:653)
at
org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.setValue(XMLHel perImpl.java:1091)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XM LHandler.java:2377)
... 35 more

I traced the problem in debug model, find that the product's metamodel is
load suceessfully, when load product.xml as a model it occurs the problem.
I ever use the schema generate product.genmodel product.ecore file ,using
EMF generate three plugin project: product,product.edit and
product.editor. The plugin works well and can create Product model
files(In this file,it doestn't container "person" element but "author"
element). But when the ecore file using in ATL,it has some problems.

Please help me,how to resolve the problem, and how to transform elements
having realtionship of "extend", can anyone give an example using
product.xml(maybe the product.xml need change) I list above tranform to
itself, any help would be appreciated very much!
Thanks in andvance!
Re: [ATL]Load Model Problem in ATLEMFModelHandler [message #25417 is a reply to message #22792] Fri, 23 March 2007 22:42 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

Can you please give us the listing of the metamodel that is generated
from your schema?

Your product.xml file should indeed conform to this metamodel, not to
the schema. Depending on how the translation was performed, the actual
metamodel may take very different forms.


Regards,

Frédéric Jouault


Shan wrote:
> Dear All,
>
> I try to test an example, metamodel is generated from schema using EMF
> facilities
>
> <?xml version="1.0" encoding="UTF-8"?>
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:ns="http://www.m2matl.com/product"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.m2matl.com/product">
> <element name="product" type="ns:Product" />
> <complexType name="Product">
> <sequence>
> <element name="name" type="xsd:string" />
> <element ref="ns:person" minOccurs="0" maxOccurs="1" />
> </sequence>
> </complexType>
> <element name="person" type="ns:Person" abstract="true" />
> <complexType name="Person" />
> <element name="author" type="ns:Author"
> substitutionGroup="ns:person" />
> <complexType name="Author">
> <complexContent>
> <extension base="ns:Person">
> <sequence>
> <element name="name" type="xsd:string" />
> <element name="mail" type="xsd:string" />
> </sequence>
> </extension>
> </complexContent>
> </complexType>
> </schema>
>
> transform model (product.xml) to itsslef.
>
> <Product xmlns="http://www.m2matl.com/product"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ns="http://www.m2matl.com/product">
> <name>aaaa</name>
> <!--<person xsi:type="Author"> -->
> <person xsi:type="ns:Author"> <name>asdd</name>
> <age>123</age>
> </person>
> </Product>
>
> when atl engineer(AtlEMFModelHandler) load this model,throw exceptions
> as below:
>
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Value
> 'org.eclipse.emf.ecore.impl.DynamicEObjectImpl@101cb7b (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl@164538f (name: Author)
> (instanceClassName: null) (abstract: false, interface: false))' is not
> legal. (platform:/resource/Smaple4/models/product.xml, 7, 31)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLL oadImpl.java:80)
>
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:189)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:179)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1089)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:895)
>
> at
> org.atl.engine.repositories.emf4atl.ASMEMFModel.loadASMEMFMo del(ASMEMFModel.java:323)
>
> at
> org.atl.eclipse.engine.AtlEMFModelHandler.loadModel(AtlEMFMo delHandler.java:122)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .loadModel(AtlLaunchConfigurationDelegate.java:275)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .getSourceModels(AtlLaunchConfigurationDelegate.java:333)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:205)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:168)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:145)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .runAtlLauncher(AtlLaunchConfigurationDelegate.java:121)
>
> at
> org.atl.eclipse.adt.launching.AtlLaunchConfigurationDelegate .launch(AtlLaunchConfigurationDelegate.java:97)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:639)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:565)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:754)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlu gin.java:944)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
> Caused by: org.eclipse.emf.ecore.xmi.IllegalValueException: Value
> 'org.eclipse.emf.ecore.impl.DynamicEObjectImpl@101cb7b (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl@164538f (name: Author)
> (instanceClassName: null) (abstract: false, interface: false))' is not
> legal. (platform:/resource/Smaple4/models/product.xml, 7, 31)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XM LHandler.java:2382)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XM LHandler.java:2367)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromTy peName(XMLHandler.java:1842)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHa ndler.java:1768)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLH andler.java:1576)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:876)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:82)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:854)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:626)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .startElement(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanStartElement(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS cannerImpl.scanDocument(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
> Source)
> at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
> Source)
> at javax.xml.parsers.SAXParser.parse(Unknown Source)
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:179)
> ... 17 more
> Caused by: java.lang.IllegalArgumentException: The feature 'person' is
> not a valid changeable feature
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(Basi cEObjectImpl.java:706)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:682)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:653)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.setValue(XMLHel perImpl.java:1091)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XM LHandler.java:2377)
>
> ... 35 more
>
> I traced the problem in debug model, find that the product's metamodel
> is load suceessfully, when load product.xml as a model it occurs the
> problem. I ever use the schema generate product.genmodel product.ecore
> file ,using EMF generate three plugin project: product,product.edit and
> product.editor. The plugin works well and can create Product model
> files(In this file,it doestn't container "person" element but "author"
> element). But when the ecore file using in ATL,it has some problems.
>
> Please help me,how to resolve the problem, and how to transform elements
> having realtionship of "extend", can anyone give an example using
> product.xml(maybe the product.xml need change) I list above tranform to
> itself, any help would be appreciated very much!
> Thanks in andvance!
>
Previous Topic:[ATL] New FAQ entry: What's this ATL feature called "superimposition"?
Next Topic:[ATL] "Warning, could not find mathing node for ForEachOutPatternElement..."
Goto Forum:
  


Current Time: Thu Dec 26 16:23:31 GMT 2024

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

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

Back to the top