Use XSD Metamodel in ATL [message #1021253] |
Tue, 19 March 2013 14:39  |
Eclipse User |
|
|
|
Hi,
I am trying to perform an ATL transformation from UML models to XML Schemas.
I am using the UML metamodel as IN metamodel, specifically, the uml.ecore included in the UML2 plug-in (org.eclipse.uml2.uml_3.2.100.v201108110105.jar).
I have transformed the file XMLSchema.xsd, provided in the XSD plug-in (org.eclipse.xsd_2.7.1.v20120130-0943.jar) within \cache\www.w3.org\2001, to an ecore metamodel, using the EMF plug-in.
If I use this metamodel as OUT metamodel in a very simple transformation (see below) I obtain this message in the ATL Logger: "Metamodel contains several classifiers with same name: AnyType". What does it mean? Only one Classifier AnyType is in the ecore file.
Which is the OUT metamodel that I should use?
Can I use an Uri? I tried to use http://www.w3.org/2001/XMLSchema, but it does not work. The error is: Error loading http://www.w3.org/2001/XMLSchema: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.w3.org/1999/xhtml' not found. (http://www.w3.org/2001/XMLSchema, 1, 260)
The ATL transformation is:
module UML2XMLSchema;
create OUT : XMLSchema from IN : UML;
rule trClass {
from
c : UML!Class
to
t : XMLSchema!LocalComplexType (
name <- c.name + 'Type'
)
}
Could anybody help me?
Thanks in advance!
|
|
|
Re: Use XSD Metamodel in ATL [message #1021764 is a reply to message #1021253] |
Wed, 20 March 2013 12:27  |
Eclipse User |
|
|
|
Hello,
The error you get means that you are loading a metamodel that is probably already loaded into the EMF Registry (this is why it can found several EClass with the same name).
When using already registered metamodels such as the UML2 one, I recommend you to load them using their URI when running transformations.
Note that you can also similarly benefit from the content assist: http://wiki.eclipse.org/ATL/User_Guide_-_The_ATL_Tools#Content_assist.
If you want to use the URI of the Ecore metamodel you've generated from the XDS schema (i.e.; your own one and not the generic one you're mentioning in your post), your Ecore metamodel has to be previously registered/loaded into the EMF Registry.
Then you will be able to refer to it from your ATL transformation and corresponding launcher.
|
|
|
Powered by
FUDForum. Page generated in 0.04255 seconds