Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [Flock] equivalent() not working(equivalent() returns original, not migrated element)
[Flock] equivalent() not working [message #638912] Sat, 13 November 2010 06:55 Go to next message
Mark Tippetts is currently offline Mark Tippetts
Messages: 25
Registered: July 2009
Junior Member
ehlo,

I'm having some trouble with the following line in a Flock migration. I'm not sure if it's my mistake, or a bug?
var newModel : Migrated!GuidanceModel := oldModel.equivalent();

Evidently, equivalent() is returning the original, rather than the migrated, object. I get the same result using the ::= syntax. It produces the following stack trace:

!ENTRY org.eclipse.epsilon.common.dt 4 0 2010-11-13 01:13:45.078
!MESSAGE Error encountered whilst executing Flock migration strategy for: C:/Eclipse/Workspaces/Golemware/DesignLayer/net.golemware.eclipsepsm.design/design/EclipsePSM.guidance
!STACK 0
Exception encountered while executing EOL block.
	at org.eclipse.epsilon.flock.FlockContext.executeBlock(FlockContext.java:101)
	at org.eclipse.epsilon.flock.model.Body.applyTo(Body.java:31)
	at org.eclipse.epsilon.flock.execution.MigrateRuleBasedEquivalence.applyStrategyToPopulateEquivalent(MigrateRuleBasedEquivalence.java:33)
	at org.eclipse.epsilon.flock.execution.Equivalences.populateEachEquivalent(Equivalences.java:61)
	at org.eclipse.epsilon.flock.MigrationStrategyRunner.populateEachEquivalent(MigrationStrategyRunner.java:49)
	at org.eclipse.epsilon.flock.MigrationStrategyRunner.run(MigrationStrategyRunner.java:37)
	at org.eclipse.epsilon.flock.FlockContext.run(FlockContext.java:164)
	at org.eclipse.epsilon.flock.FlockModule.execute(FlockModule.java:80)
	at org.eclipse.epsilon.flock.FlockModule.execute(FlockModule.java:75)
	at org.eclipse.epsilon.flock.dt.util.MigrationStrategyExecutor.migrate(MigrationStrategyExecutor.java:87)
	at org.eclipse.epsilon.flock.dt.util.MigrationStrategyExecutor.run(MigrationStrategyExecutor.java:64)
	at org.eclipse.epsilon.flock.dt.actions.ExecuteMigrationStrategy.migrateSelectionUsing(ExecuteMigrationStrategy.java:64)
	at org.eclipse.epsilon.flock.dt.actions.ExecuteMigrationStrategy.run(ExecuteMigrationStrategy.java:54)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	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.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: Illegal assignment to variable 'newModel'. Expected Migrated!GuidanceModel and found GuidanceModel [name=EpsilonToolsCore.guidance, ] (5:8)
	at org.eclipse.epsilon.eol.execute.context.Variable.setValue(Variable.java:73)
	at org.eclipse.epsilon.eol.execute.AssignExecutor.execute(AssignExecutor.java:67)
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
	at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute(StatementBlockExecutor.java:33)
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:179)
	at org.eclipse.epsilon.flock.FlockContext.executeBlock(FlockContext.java:93)
	... 41 more


(BTW, I love the use of 'whilst'. This is far and away the most literate error message I've ever received!)

I'm using the latest (0.8.9.201011041158) interim build of Epsilon on Helios.Here's the entire migration strategy. I can provide the ecore models as well, if that would be helpful.

migrate Variable to WorkProductVariable
{
	original.println('Migrating ');
	var oldModel : GuidanceModel := original.eContainer().getModel();
	var newModel : Migrated!GuidanceModel := oldModel.equivalent();
	newModel.variables.add(migrated);
	var param := new Migrated!Parameter;
	param.source := original.eContainer().equivalent();
	param.target := migrated;
	newModel.parameters.add(param);
}

operation UserGuide getModel() : GuidanceModel
{
	if (self.eContainer().isKindOf(GuidanceModel)){
		return self.eContainer();
	}
	return self.eContainer().getModel();
}


Thanks,

Mark
Re: [Flock] equivalent() not working [message #638981 is a reply to message #638912] Sun, 14 November 2010 10:42 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Mark,

Could you please send us the metamodels and a sample input model at
epsilon.devs gmail com?

Cheers,
Dimitris

On 13/11/2010 08:55, Mark Tippetts wrote:
> ehlo,
>
> I'm having some trouble with the following line in a Flock migration.
> I'm not sure if it's my mistake, or a bug?
> var newModel : Migrated!GuidanceModel := oldModel.equivalent();
> Evidently, equivalent() is returning the original, rather than the
> migrated, object. I get the same result using the ::= syntax. It
> produces the following stack trace:
>
>
> !ENTRY org.eclipse.epsilon.common.dt 4 0 2010-11-13 01:13:45.078
> !MESSAGE Error encountered whilst executing Flock migration strategy
> for:
> C:/Eclipse/Workspaces/Golemware/DesignLayer/net.golemware.ec lipsepsm.design/design/EclipsePSM.guidance
>
> !STACK 0
> Exception encountered while executing EOL block.
> at
> org.eclipse.epsilon.flock.FlockContext.executeBlock(FlockCon text.java:101)
> at org.eclipse.epsilon.flock.model.Body.applyTo(Body.java:31)
> at
> org.eclipse.epsilon.flock.execution.MigrateRuleBasedEquivale nce.applyStrategyToPopulateEquivalent(MigrateRuleBasedEquiva lence.java:33)
>
> at
> org.eclipse.epsilon.flock.execution.Equivalences.populateEac hEquivalent(Equivalences.java:61)
>
> at
> org.eclipse.epsilon.flock.MigrationStrategyRunner.populateEa chEquivalent(MigrationStrategyRunner.java:49)
>
> at
> org.eclipse.epsilon.flock.MigrationStrategyRunner.run(Migrat ionStrategyRunner.java:37)
>
> at org.eclipse.epsilon.flock.FlockContext.run(FlockContext.java :164)
> at org.eclipse.epsilon.flock.FlockModule.execute(FlockModule.ja va:80)
> at org.eclipse.epsilon.flock.FlockModule.execute(FlockModule.ja va:75)
> at
> org.eclipse.epsilon.flock.dt.util.MigrationStrategyExecutor. migrate(MigrationStrategyExecutor.java:87)
>
> at
> org.eclipse.epsilon.flock.dt.util.MigrationStrategyExecutor. run(MigrationStrategyExecutor.java:64)
>
> at
> org.eclipse.epsilon.flock.dt.actions.ExecuteMigrationStrateg y.migrateSelectionUsing(ExecuteMigrationStrategy.java:64)
>
> at
> org.eclipse.epsilon.flock.dt.actions.ExecuteMigrationStrateg y.run(ExecuteMigrationStrategy.java:54)
>
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:251)
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:584)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:501)
>
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:411)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:4066)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3657)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2640)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 38)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:664)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:115)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
>
> 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.equinox.launcher.Main.invokeFramework(Main.java: 619)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
> Caused by: Illegal assignment to variable 'newModel'. Expected
> Migrated!GuidanceModel and found GuidanceModel
> [name=EpsilonToolsCore.guidance, ] (5:8)
> at
> org.eclipse.epsilon.eol.execute.context.Variable.setValue(Va riable.java:73)
> at
> org.eclipse.epsilon.eol.execute.AssignExecutor.execute(Assig nExecutor.java:67)
>
> at
> org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(E xecutorFactory.java:179)
>
> at
> org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execu te(StatementBlockExecutor.java:33)
>
> at
> org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(E xecutorFactory.java:179)
>
> at
> org.eclipse.epsilon.flock.FlockContext.executeBlock(FlockCon text.java:93)
> ... 41 more
>
>
> (BTW, I love the use of 'whilst'. This is far and away the most literate
> error message I've ever received!)
>
> I'm using the latest (0.8.9.201011041158) interim build of Epsilon on
> Helios.Here's the entire migration strategy. I can provide the ecore
> models as well, if that would be helpful.
>
>
> migrate Variable to WorkProductVariable
> {
> original.println('Migrating ');
> var oldModel : GuidanceModel := original.eContainer().getModel();
> var newModel : Migrated!GuidanceModel := oldModel.equivalent();
> newModel.variables.add(migrated);
> var param := new Migrated!Parameter;
> param.source := original.eContainer().equivalent();
> param.target := migrated;
> newModel.parameters.add(param);
> }
>
> operation UserGuide getModel() : GuidanceModel
> {
> if (self.eContainer().isKindOf(GuidanceModel)){
> return self.eContainer();
> }
> return self.eContainer().getModel();
> }
>
>
> Thanks,
>
> Mark
>
Previous Topic:Using My own Java Code in ETL
Next Topic:Modulo operation in EOL
Goto Forum:
  


Current Time: Thu Oct 23 16:38:54 GMT 2014

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

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