Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] Problems with source metamodel

Thank you Christian,

It works now. 

Regards,
Petter


2013/6/8 Christian Krause <henshin.ck@xxxxxxxxx>
Hi Petter,

when you execute the transformation you use the static metamodel, i.e., the generated classes. When I look at your Henshin file, it looks like you imported the Ecore file directly, which basically means that you use dynamic EMF. You have to make sure that use either use static or dynamic EMF, but not mixing them (see also the Henshin FAQ). I assume that you want to use generated model classes, so that means you need to go with the static metamodel. Then you can go with one of these options:

1) in the Java code, load first the instance model. After that you load the module with the additional parameter "true". This will try to replace the dynamic metamodel references in the Henshin model by the static ones used by your instance model.
See also http://download.eclipse.org/modeling/emft/henshin/javadoc/nightly/org/eclipse/emf/henshin/model/resource/HenshinResourceSet.html#getModule(org.eclipse.emf.common.util.URI, boolean)

or:

2) Create the Henshin file from scratch again, but this time do not import the ecore file directly, but use Import From Registry and select your metamodel from the global EMF registry. This requires though that you are editing your transformation in a workspace where your metamodel plugins are running already.

I hope this helps. Please not that this is not a Henshin issue but due to the way how EMF handles static and dynamic versions of the same metamodels.

Cheers,
Christian


2013/6/8 Petter Barvik <petter.barvik@xxxxxxxxx>
Hi Christian,

Here you have the stack trace from eclipse:

java.lang.AssertionError: Error executing unit 'test'
at org.eclipse.emf.henshin.interpreter.util.InterpreterUtil.executeOrDie(InterpreterUtil.java:89)
at henshim_rules.TranslateToHenshinRules.generateHenshinModule(TranslateToHenshinRules.java:88)
at no.hib.dpf.transform.command.AddTransformCommand.execute(AddTransformCommand.java:58)
at org.eclipse.gef.commands.CommandStack.execute(CommandStack.java:199)
at org.eclipse.gef.tools.AbstractTool.executeCommand(AbstractTool.java:425)
at org.eclipse.gef.tools.AbstractTool.executeCurrentCommand(AbstractTool.java:438)
at no.hib.dpf.transform.presentation.AddTool.handleButtonUp(AddTool.java:40)
at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java:1200)
at org.eclipse.gef.tools.SelectionTool.mouseUp(SelectionTool.java:575)
at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:301)
at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseReleased(DomainEventDispatcher.java:380)
at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(LightweightSystem.java:548)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:220)
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:4169)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
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:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
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:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

I get an error when i try to run the test unit from "generateHenshinRules.henshin", 
java.lang.AssertionError: Error executing unit 'test'

For debugging, i can debug the resourceSet and the resut But since the program terminates when i get this AssertionError, i'm finding it hard to debug.

And i messed up abit on the Resource model, in "TranslateToHenshinRules", it should be 

Resource model = resourceSet.getResource("tra1.xform");

But i still get the AssertionError when running the test unit.

Cheers,
Petter


2013/6/8 Christian Krause <henshin.ck@xxxxxxxxx>
Dear Petter,
comments below...

2013/6/7 Petter Barvik <petter.barvik@xxxxxxxxx>
Hello everyone,

I'm currently working with trying to set up a model to model transformation environment. For doing this i want to use Henshin to translate a set of transformation rules into Henshin rules.

I am having a very similar problem that Jens had,


But for some reason i cannot get it to work. I import my source metamodel to my Henshin module. This metamodel has a root element, named Transform. The file itself uses an "example.xform" extension. 

<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" ....>
  <transform:Transform>
               ....
               ....
               ....
  </transform:Transform>

So i have a simple Henshin rule where i only have one preserve action, namely a Transform object, but then i get an AssertionError on my rule.

Where and when does the AssertionError occur? Do you get an error message? How does the stack trace look like? Did you try to debug it?

Best regards,
Christian

 
So that tells me that i am having a problem with loading the instance of my source metamodel. I cannot figure out what seems to be the problem. I have tried to register the extension to the resource set,

resourceSet.registerXMIResourceFactories("xform");

But i cant figure out what i am doing wrong?

Thank you in advance,

Petter


_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev



_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev



_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev



_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev



Back to the top