Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ETL] same metamodel(Using ETL for changing UML models)
[ETL] same metamodel [message #1066851] Thu, 04 July 2013 18:43 Go to next message
Mehdi Jabalameli is currently offline Mehdi JabalameliFriend
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 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

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
Re: [ETL] same metamodel [message #1067236 is a reply to message #1066925] Sun, 07 July 2013 20:42 Go to previous messageGo to next message
Mehdi Jabalameli is currently offline Mehdi JabalameliFriend
Messages: 3
Registered: July 2013
Junior Member
Dear Dimitris,
Hi,

I changed source metamodel name to "SourceOO" and target metamodel name to "TargetOO".
Unfortunately, I get 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/SingletonTest/models/TargetOO.emf; systemId: platform:/resource/SingletonTest/models/TargetOO.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 both metamodels.
Content of 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="#
#Mon Jul 08 00:57:38 GMT+03:30 2013
isMetamodelFileBased=false
name=SourceOO
readOnLoad=true
storeOnDisposal=false
aliases=
cached=true
fileBasedMetamodelUri=platform\:/resource/SingletonTest/models/SourceOO.ecore
metamodelUri=SourceOO
modelUri=platform\:/resource/SingletonTest/models/OOInstance.model
type=EMF
modelFile=/SingletonTest/models/OOInstance.model
expand=true
metamodelFile=SingletonTest/models/SourceOO.ecore
"/>
<listEntry value="#
#Mon Jul 08 01:06:53 GMT+03:30 2013
isMetamodelFileBased=false
name=TargetOO
readOnLoad=false
storeOnDisposal=true
aliases=
cached=true
fileBasedMetamodelUri=platform\:/resource/SingletonTest/models/TargetOO.emf
metamodelUri=TargetOO
modelUri=platform\:/resource/SingletonTest/models/TargetOOInstance.model
type=EMF
modelFile=/SingletonTest/models/TargetOOInstance.model
expand=true
metamodelFile=/SingletonTest/models/TargetOO.emf
"/>
<listEntry value="#
#Mon Jul 08 00:57:30 GMT+03:30 2013
isMetamodelFileBased=false
name=Trace
readOnLoad=false
storeOnDisposal=true
aliases=
cached=true
fileBasedMetamodelUri=
metamodelUri=SimpleTrace
modelUri=platform\:/resource/SingletonTest/models/Trace.model
type=EMF
modelFile=/SingletonTest/models/Trace.model
expand=false
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="/SingletonTest/OOSingleton.etl"/>
<stringAttribute key="sourceModel" value="SourceOO"/>
<stringAttribute key="targetModel" value="TargetOO"/>
<listAttribute key="tools"/>
<stringAttribute key="transformationStrategy" value="Default"/>
</launchConfiguration>

if I use OO2DB example project and replace DB metamodel file with OO metamodel(with DB name), it works fine!!!!!
Re: [ETL] same metamodel [message #1067238 is a reply to message #1067236] Sun, 07 July 2013 20:47 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi,

By the looks of it, one of the involved models is not valid XMI. Could you please put together a minimal example [1] we can use to reproduce this?

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/minimal-examples/
Re: [ETL] same metamodel [message #1070107 is a reply to message #1067238] Wed, 17 July 2013 08:51 Go to previous message
Mehdi Jabalameli is currently offline Mehdi JabalameliFriend
Messages: 3
Registered: July 2013
Junior Member
Hi,
Thanks for your attention.
My problem was resolved. I just changed ETL OO2DB and it worked fine.

Regards,
Mehdi.
Previous Topic:[concordance] org.h2.jdbc.JdbcSQLException on values containing single quotes
Next Topic:[Emfatic] bidirectional aggregation
Goto Forum:
  


Current Time: Thu Mar 28 15:53:02 GMT 2024

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

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

Back to the top