Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ETL] Standalone Java program: How to apply profiles?
[ETL] Standalone Java program: How to apply profiles? [message #1553423] Thu, 08 January 2015 17:49 Go to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi there,

I have a question concerning the handling UML profiles within Epsilon standalone Java programs.

I was able to create InMemoryEmfModel instances which are recognized within my ETL module.

However, I do not know how to apply a UML Profile "on-the-fly". I suppose that for the source InMemoryEmfModel, the Profile is automatically recognized when it is loaded to the ETL module. But then I still need to apply a Profile to my target model. Can I somehow copy it from the source model?

Thanks for any appreciated hints!

Kind regards, Alexander
Re: [ETL] Standalone Java program: How to apply profiles? [message #1557275 is a reply to message #1553423] Sat, 10 January 2015 21:35 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alexander,

I'm afraid I can't be of much assistance with this off the top of my head but I've added this to my todo list for investigation. Please post an update if you figure this out before I do Smile

Cheers,
Dimitris
Re: [ETL] Standalone Java program: How to apply profiles? [message #1558279 is a reply to message #1557275] Sun, 11 January 2015 11:16 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

thanks a lot for your feedback. I have done a little step forward. I have been able to read the set of applied profiles of the source model by the following statement:

srcModel.getAppliedProfiles();

Now I would need a means to apply these profiles to the target model.

The statement "tgtModel.applyProfile(profilesAppliedToSrcModel.all);" does not work.

In general, the requirement is to apply all profiles of the source to the target model. Of course, it would also be helpful to select exactly one profile to be applied to the target model. However, the latter has lower priority at the moment.

Any suggestions are really appreciated.

Thanks a lot in advance and Kind regards, Alex
Re: [ETL] Standalone Java program: How to apply profiles? [message #1558312 is a reply to message #1558279] Sun, 11 January 2015 11:45 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi again Dimitris,

I tried to create a Profile as an usual InMemoryEmfModel and then to apply it in the ETL module. However, this does not work neither. I suppose that it is not recognized as a model of type Profile.

Here is how I created the profile model in my Java code:

		profileFile = this.getFileInBundle("/res/"
		        + "model.profile.uml");
		profileModel = this.getUmlModel("Profile",
				profileFile);
		strProps = new StringProperties();
		strProps.put(InMemoryEmfModel.PROPERTY_NAME,
				"Profile");		
		strProps.put(InMemoryEmfModel.PROPERTY_ALIASES,
				"Profile");
		strProps.put(InMemoryEmfModel.PROPERTY_READONLOAD, true + "");
		strProps.put(InMemoryEmfModel.PROPERTY_STOREONDISPOSAL, true + "");			
		profileModel.load(strProps, null);


And here the way I tried to apply this to my target model in the ETL module:

	var profile := Profile!Profile.all.first();
	("Applied profile of source model: " + profile).println();
	tgtModel.applyprofile(profile);


The error message I receive is:
"Undefined variable, type or model: 'Profile!Profile' (D:\Eclipse\Workspace1\de.uni.due.swe.propman.propgen.pcm2pcptrafo\res\Pcm2PcpTrafo.etl@56:27)"

Maybe this analysis gives you an idea to find a solution.

Thanks a lot in advance and Kind regards, Alex
Re: [ETL] Standalone Java program: How to apply profiles? [message #1564784 is a reply to message #1558312] Thu, 15 January 2015 00:40 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

Would something like the following do the trick?

for (p in srcModel.getAppliedProfiles()) {
  tgtModel.applyProfile(p);
}


Cheers,
Dimitris
Re: [ETL] Standalone Java program: How to apply profiles? [message #1567642 is a reply to message #1564784] Fri, 16 January 2015 13:36 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

thanks for your answer and the proposal. I tried that but unfortunately I get the following Exception:

Profiles in srcModel: org.eclipse.uml2.uml.internal.impl.ProfileImpl@7f92ed5f (eProxyURI: file:/D:/Eclipse/Workspace1/de.uni.due.swe.propman.propgen.pcm2pcptrafo/model.profile.uml#_1dRWOi9xEeSFWMEXFIzaFw)
Internal error: java.lang.IllegalArgumentException: org.eclipse.uml2.uml.internal.impl.ProfileImpl@7f92ed5f [eProxyURI: file:/D:/Eclipse/Workspace1/de.uni.due.swe.propman.propgen.pcm2pcptrafo/model.profile.uml#_1dRWOi9xEeSFWMEXFIzaFw]
	at org.eclipse.uml2.uml.internal.operations.PackageOperations.applyProfile[PackageOperations.java:608]
	at org.eclipse.uml2.uml.internal.impl.PackageImpl.applyProfile[PackageImpl.java:1072]
	at sun.reflect.NativeMethodAccessorImpl.invoke0[Native Method]
	at sun.reflect.NativeMethodAccessorImpl.invoke[Unknown Source]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke[Unknown Source]
	at java.lang.reflect.Method.invoke[Unknown Source]
	at org.eclipse.epsilon.eol.util.ReflectionUtil.executeMethod[ReflectionUtil.java:187]
	at org.eclipse.epsilon.eol.util.ReflectionUtil.executeMethod[ReflectionUtil.java:163]
	at org.eclipse.epsilon.eol.execute.PointExecutor.executeOperation[PointExecutor.java:174]
	at org.eclipse.epsilon.eol.execute.PointExecutor.execute[PointExecutor.java:89]
	at org.eclipse.epsilon.eol.execute.PointExecutor.execute[PointExecutor.java:49]
	at org.eclipse.epsilon.eol.execute.PointExecutor.execute[PointExecutor.java:104]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:190]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:160]
	at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute[StatementBlockExecutor.java:26]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:190]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:160]
	at org.eclipse.epsilon.eol.execute.ForStatementExecutor.execute[ForStatementExecutor.java:111]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:190]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:160]
	at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute[StatementBlockExecutor.java:26]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:190]
	at org.eclipse.epsilon.etl.TransformRule.executeSuperRulesAndBody[TransformRule.java:279]
	at org.eclipse.epsilon.etl.TransformRule.transform[TransformRule.java:215]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.executeTransformations[FastTransformationStrategy.java:165]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.transformModels[FastTransformationStrategy.java:157]
	at org.eclipse.epsilon.etl.EtlModule.execute[EtlModule.java:126]
	at de.uni.due.swe.propman.propgen.pcm2pcptrafo.handler.BaseHandler.executeProPGenPcm2PcpTransformation[BaseHandler.java:397]
	at de.uni.due.swe.propman.propgen.pcm2pcptrafo.handler.BaseHandler$1.run[BaseHandler.java:239]
	at org.eclipse.core.internal.jobs.Worker.run[Worker.java:53]



Thanks a lot for your Support and Kind regards, Alex
Re: [ETL] Standalone Java program: How to apply profiles? [message #1567643 is a reply to message #1567642] Fri, 16 January 2015 13:38 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi again Dimitris,

I Need to add that if I run the module using Launch configuration, then your proposal works fine.

KR, Alex
Re: [ETL] Standalone Java program: How to apply profiles? [message #1567866 is a reply to message #1567643] Fri, 16 January 2015 16:24 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi again Dimitris,

it works now!!! I had some other issues within my logic on both the Java as well as the ETL side.

Thanks again for your helpful Support.

Kind regards, Alex
Re: [ETL] Standalone Java program: How to apply profiles? [message #1569217 is a reply to message #1567866] Sat, 17 January 2015 10:34 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

That's great news - I'm glad this helped.

Cheers,
Dimitris
Previous Topic:ModeLink for a transformation model
Next Topic:[Flock] Limited error information
Goto Forum:
  


Current Time: Fri Apr 26 01:36:59 GMT 2024

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

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

Back to the top