[ETL] same metamodel [message #1066851] |
Thu, 04 July 2013 18:43 |
Mehdi Jabalameli Messages: 3 Registered: July 2013 |
Junior Member |
|
|
Hi,
I want to apply design pattern to UML classes.
In this situation, source and targed metamodels are the same (UML Metamodel).
when I tried to do this, I got an error.
I start with a simple example, but it didn't work.
Content of my etl file is:
pre{
"Running ETL".println();
var pk : new OO!Package;
}
post {
"Running Successful".println();
}
rule Class2Class
transform c : OO!Class
to t : OO!Class {
t.name = c.name;
t.package = pk;
}
and content of my launch file is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.epsilon.etl.eclipse.dt.launching.EtlLaunchConfigurationDelegate">
<booleanAttribute key="fine_grained_profiling" value="false"/>
<listAttribute key="models">
<listEntry value="#
#Thu Jul 04 01:13:16 GMT+03:30 2013
isMetamodelFileBased=false
name=OO
readOnLoad=true
storeOnDisposal=false
aliases=
cached=true
fileBasedMetamodelUri=platform\:/resource/org.eclipse.epsilon.examples.metamodels/OO.ecore
metamodelUri=OO
modelUri=platform\:/resource/OO2TargetOO/models/OOInstance.model
type=EMF
modelFile=/OO2TargetOO/models/OOInstance.model
expand=false
metamodelFile=org.eclipse.epsilon.examples.metamodels/OO.ecore
"/>
<listEntry value="#
#Thu Jul 04 22:20:49 GMT+03:30 2013
isMetamodelFileBased=false
name=OO
readOnLoad=false
storeOnDisposal=true
aliases=
cached=true
fileBasedMetamodelUri=platform\:/resource/org.eclipse.epsilon.examples.metamodels/OO.emf
metamodelUri=OO
modelUri=platform\:/resource/OO2TargetOO/models/TargetOOInstance.model
type=EMF
modelFile=/OO2TargetOO/models/TargetOOInstance.model
expand=false
metamodelFile=/org.eclipse.epsilon.examples.metamodels/OO.emf
"/>
<listEntry value="#
#Thu Jun 04 21:54:41 BST 2009
isMetamodelFileBased=false
name=Trace
readOnLoad=false
storeOnDisposal=true
aliases=
metamodelUri=SimpleTrace
type=EMF
modelFile=/OO2TargetOO/models/Trace.model
expand=true
metamodelFile=
"/>
</listAttribute>
<booleanAttribute key="profile_model_loading" value="false"/>
<booleanAttribute key="profiling_enabled" value="false"/>
<booleanAttribute key="reset_profiler" value="false"/>
<stringAttribute key="source" value="/OO2TargetOO/OO2TargetOO.etl"/>
<stringAttribute key="sourceModel" value="OO"/>
<stringAttribute key="targetModel" value="OO"/>
<listAttribute key="tools"/>
<stringAttribute key="transformationStrategy" value="Default"/>
</launchConfiguration>
when I tried to run it, I got following error.
Internal error: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Content is not allowed in prolog.
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load[XMLLoadImpl.java:195]
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad[XMLResourceImpl.java:240]
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load[ResourceImpl.java:1505]
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load[ResourceImpl.java:1284]
at org.eclipse.epsilon.emc.emf.EmfUtil.register[EmfUtil.java:161]
at org.eclipse.epsilon.emc.emf.EmfModel.determinePackagesFrom[EmfModel.java:392]
at org.eclipse.epsilon.emc.emf.EmfModel.loadModelFromUri[EmfModel.java:235]
at org.eclipse.epsilon.emc.emf.EmfModel.loadModel[EmfModel.java:167]
at org.eclipse.epsilon.eol.models.CachedModel.load[CachedModel.java:147]
at org.eclipse.epsilon.emc.emf.EmfModel.load[EmfModel.java:151]
at org.eclipse.epsilon.eol.dt.launching.EclipseContextManager.loadModels[EclipseContextManager.java:141]
at org.eclipse.epsilon.eol.dt.launching.EclipseContextManager.setup[EclipseContextManager.java:83]
at org.eclipse.epsilon.eol.dt.launching.EpsilonLaunchConfigurationDelegate.launch[EpsilonLaunchConfigurationDelegate.java:72]
at org.eclipse.epsilon.eol.dt.launching.EpsilonLaunchConfigurationDelegate.launch[EpsilonLaunchConfigurationDelegate.java:56]
at org.eclipse.debug.internal.core.LaunchConfiguration.launch[LaunchConfiguration.java:855]
at org.eclipse.debug.internal.core.LaunchConfiguration.launch[LaunchConfiguration.java:704]
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch[DebugUIPlugin.java:1047]
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run[DebugUIPlugin.java:1251]
at org.eclipse.core.internal.jobs.Worker.run[Worker.java:53]
Caused by: org.xml.sax.SAXParseExceptionpublicId: platform:/resource/org.eclipse.epsilon.examples.metamodels/OO.emf; systemId: platform:/resource/org.eclipse.epsilon.examples.metamodels/OO.emf; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException[Unknown Source]
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError[Unknown Source]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError[Unknown Source]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError[Unknown Source]
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError[Unknown Source]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next[Unknown Source]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next[Unknown Source]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument[Unknown Source]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse[Unknown Source]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse[Unknown Source]
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse[Unknown Source]
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse[Unknown Source]
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse[Unknown Source]
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse[Unknown Source]
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load[XMLLoadImpl.java:175]
... 18 more
I've registered my OO.ecore package.
Is it possible to use same metamodel for source and target models?
as an another test,
when I create a new instance of OO.ecore and rename it to "DB" and use it as target
model, it works fine, but if I rename it to "TargetOO", it doesn't work!!!
(I've created DB.emf and DB.ecore and I've register it as for "TargetOO" )
|
|
|
Re: [ETL] same metamodel [message #1066925 is a reply to message #1066851] |
Fri, 05 July 2013 07:34 |
|
Hi Mehdi,
Your two models should have different names in the ETL launch configuration (now both of them are called OO). If you rename them to Source and Target, the following should work:
rule Class2Class
transform c : Source!Class
to t : Target!Class {
t.name = c.name;
t.package ::= pk; // See the ETL chapter of the Epsilon book for the semantics of the ::= operator
}
Cheers,
Dimitris
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03805 seconds