Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-user] (no subject)

Hi,

using your zip archive, I could reproduce the error and see what caused it:

The Henshin version you're using is affected by a bug in the method ChangeImpl.applyAndReverse(), for detailed information see https://dev.eclipse.org/mhonarc/lists/henshin-user/msg00061.html

Initially, I couldn't reproduce the error because I was using the Henshin version from the nightly build, where the bug has been fixed already. See https://www.eclipse.org/henshin/install.php

Best regards,
Daniel

Am 08.02.2017 um 12:02 schrieb Loic Gammaitoni:
Note that the execution of the CDRefinement unit works without problem when using the Henshin plugin on Eclipse.
Could it be that the problem comes from the fact that my ecore model doesn't have a root concept ? I ruled out that possibility as no problems occur when executing the transformation in eclipse.

(sorry for the multiple posts)

On Wed, Feb 8, 2017 at 11:58 AM, Loic Gammaitoni <loic.gammaitoni@xxxxxxxxx> wrote:
I spoke too fast,

Actually the code of Daniel yields the same error when executing the main sequential unit. ( back to the starting point i guess ?)

On Wed, Feb 8, 2017 at 11:54 AM, Loic Gammaitoni <loic.gammaitoni@xxxxxxxxx> wrote:
The code of Daniel works, I fail to understand why but it works, so problem solved !
Thanks to all of you for the time taken.

Cheers,
Loïc

PS:If someone figures out the source of the exception, I'd be happy to know,

On Wed, Feb 8, 2017 at 11:47 AM, Loic Gammaitoni <loic.gammaitoni@xxxxxxxxx> wrote:
Dear Nebras,

Thanks for the suggestion, yet your code yield to the same stacktrace than previously.
you can find on this google drive link  a zip containing my java project with the xmi/ecore files in the bin folder ( don't judge me I know this is terrible, it's just that i plan to export this project to a jar file and the code to set the working directory as the one where the jar is returns the bin directory when the project is launched in eclipse).

Just running the project should allow you to reproduce the error.
Cheers and thanks for this very welcome support,

Loïc




On Wed, Feb 8, 2017 at 11:27 AM, Nebras Nassar <nassarn@xxxxxxxxxxxxxx-marburg.de> wrote:

Hi Loïc,

 

I think that you work with a dynamic EMF. The following method could help you to execute your transformation assuming that your ecore file, xmi file and henshin file are in the same folder (working dir).

 

public void executeOnDynamicEMF(String workingDir, String henshinFileName, String unitName, String ecoreFileName,

                    String instanceFileName) {

             HenshinResourceSet resourceSet = new HenshinResourceSet(workingDir);

             // Load the module:

             Module module = resourceSet.getModule(henshinFileName, false);

             // Create a resource set with a base directory:

             resourceSet.registerDynamicEPackages(ecoreFileName);

             resourceSet.registerXMIResourceFactories("*");

             // Load the example model into an EGraph:

             EGraph graph = new EGraphImpl(resourceSet.getResource(instanceFileName));

             // Create an engine and a rule application:

             Engine engine = new EngineImpl();

             mainUnit = module.getUnit(unitName);

             UnitApplication app = new UnitApplicationImpl(engine, graph, mainUnit, null);

             if (!app.execute(null)) {

                    throw new RuntimeException("Error ...");

             }

             resourceSet.saveEObject(graph.getRoots().get(0), instanceFileName);

       }

 

Best wishes,

Nebras

 

---

M. Sc. Nebras Nassar
Philipps-Universität Marburg
Fachbereich Mathematik und Informatik
Hans-Meerwein-Str. – Raum 05D18
35032 Marburg
Phone: 06421-2821540
Email: nassarn AT informatik.uni-marburg.de 

---

From: henshin-user-bounces@eclipse.org [mailto:henshin-user-bounces@eclipse.org] On Behalf Of Loic Gammaitoni
Sent: Wednesday, 08 February, 2017 11:02 AM
To: Henshin Project user discussions <henshin-user@xxxxxxxxxxx>
Subject: Re: [henshin-user] (no subject)

 

I'm not sure I understand what is needed there.

The first line of my code already calls HenshinResourceSet resourceSet = new HenshinResourceSet(workingDir);

workingDir contains all my ecore and xmi files ( no subfolders ). In my code, the variables intput and transformation contains file names. ( as relative to workingDir ).

Should i also explicitely provide the ecore model to the interpreter, or does it get it directly from the xmi file ?

 

On Wed, Feb 8, 2017 at 10:52 AM, Steffen Zschaler <steffen.zschaler@xxxxxxxxx> wrote:

Vogella has a nice example here (using standard EMF resource sets, you will need to kep using a HenshinResourceSet): http://www.vogella.com/tutorials/EclipseEMFPersistence/article.html#load-an-existing-model . The links in there should take you to more details. I forget what HenshinResourceSet already sets up for you, but recall having issues with it when the rules and corresponding metamodel weren't in the right relative positions.

Steffen

 

On 08/02/2017 09:42, Loic Gammaitoni wrote:

@Daniel, I think this FAQ doesn't apply as the transformation executes correctly when using the Henshin GUI  in Eclipse.

@Steffen, this might well be the case as nowhere in the code have I imported my ecore model.

I attach my code at the end of this mail ( this code was copy pasted from the henshin interpreter page).

Do I have to add an instruction to import the ecore metamodel ? If so, how to do it ? ( I'm relatively new to the ecore world ).

Thanks for the swift reply,

Cheers,

Loïc


                HenshinResourceSet resourceSet = new HenshinResourceSet(workingDir);
   
                // Load a model:
                Resource model = resourceSet.getResource(input);
                 
                // Load the Henshin module:
                Module module = resourceSet.getModule(transformation);
                 
                // Apply the transformation (see below)...
                 
                // Save the model:
                model.save(null);
               
                // Prepare the engine:
                Engine engine = new EngineImpl();
                 
                // Initialize the graph:
                EGraph graph = new EGraphImpl(model);
               
                 
                // Find the unit to be applied:
                Unit u = module.getUnit(unit);
           
                // Apply the unit:
                UnitApplication application = new UnitApplicationImpl(engine, graph, u, null);
                application.execute(null);

       

 

 

 

On Wed, Feb 8, 2017 at 9:24 AM, Steffen Zschaler <steffen.zschaler@xxxxxxxxx> wrote:

From the stack trace, it looks like this occurs inside ECore. Have you set up your resource set correctly to include all the relevant metamodels?

Many thanks,

Steffen

 

On 08/02/2017 07:38, Daniel Strüber wrote:

Dear Loic,

there is an a FAQ entry about null pointer exceptions (NPEs) while executing a transformation, have you checked it? https://wiki.eclipse.org/Henshin_FAQ#I_get_NPEs_when_I_try_to_execute_my_transformation

Besides that, if possible, it would help us if you can attach the Java code, so we can look at it (I assume you modified it a bit so that it matches your transformation).

Best regards,
Daniel

Am 07.02.2017 um 23:48 schrieb loic.gammaitoni@xxxxxxxxx:

Dear mailing list readers,

I’m interested in measuring the time needed by Henshin to execute a transformation (see attached cdrefinement.henshin) on a given xmi model ( size10.xmi conforming to CD.ecore). The transformation works great when running through eclipse but unfortunately I can’t see any log of the time it took to be computed.
I thus tried my luck in developing a small java application running the transformation and printing out the time taken and can’t get rid of a NullPointerException...
Here is the stacktrace: (note that I simply reused the code given in the henshin interpreter web page)

Exception in thread "main" java.lang.NullPointerException

                at org.eclipse.emf.ecore.impl.EClassImpl.getFeatureID(EClassImpl.java:1500)

                at org.eclipse.emf.ecore.impl.DynamicEObjectImpl.eDerivedStructuralFeatureID(DynamicEObjectImpl.java:218)

                at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1008)

                at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1003)

                at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:998)

                at org.eclipse.emf.henshin.interpreter.impl.ChangeImpl$AttributeChangeImpl.applyAndReverse(ChangeImpl.java:134)

                at org.eclipse.emf.henshin.interpreter.impl.ChangeImpl$CompoundChangeImpl.applyAndReverse(ChangeImpl.java:466)

                at org.eclipse.emf.henshin.interpreter.impl.RuleApplicationImpl.undo(RuleApplicationImpl.java:126)

                at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.undo(UnitApplicationImpl.java:135)

                at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeSequentialUnit(UnitApplicationImpl.java:230)

                at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:104)

                at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:90)

                at Interpreter.interpret(Interpreter.java:80)

                at Main.main(Main.java:38)


Do you have any idea what causes this error ?

Also, is there a way to get the time taken by henshin to execute a transformation directly in eclipse ( without having to program anything )

Cheers,
Loïc

 

 

 

 

 

_______________________________________________
henshin-user mailing list
henshin-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/henshin-user
_______________________________________________
henshin-user mailing list
henshin-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://emea01.safelinks.protection.outlook.com/?url="">A%2F%2Fdev.eclipse.org%2Fmailman%2Flistinfo%2Fhenshin-user&data=01%7C01%7Csteffen.zschaler%40kcl.ac.uk%7Cd07bcc42cc444ee058cf08d44ff58f49%7C8370cf1416f34c16b83c724071654356%7C0&sdata=GZvUzq%2BqoGUk2%2FltY3QqwPcE2X8pqnyPftwW%2BT9Ap%2Fs%3D&reserved=0
-- 
Dr. rer. nat. Steffen Zschaler AHEA
Senior Lecturer
 
King's College London
Department of Informatics
 
Email szschaler@xxxxxxx
Phone +44 (020) 7848 1513
WWW   http://www.steffen-zschaler.de/

_______________________________________________ henshin-user mailing list henshin-user@xxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/henshin-user

_______________________________________________
henshin-user mailing list
henshin-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://emea01.safelinks.protection.outlook.com/?url="">A%2F%2Fdev.eclipse.org%2Fmailman%2Flistinfo%2Fhenshin-user&data=01%7C01%7Csteffen.zschaler%40kcl.ac.uk%7C3065d49d49b745cd779808d45006ce0d%7C8370cf1416f34c16b83c724071654356%7C0&sdata=0bUrI3QBVWBkqr7Pw%2FVjV02i6XNz2eZUDyj7Nltunfw%3D&reserved=0
-- 
Dr. rer. nat. Steffen Zschaler AHEA
Senior Lecturer
 
King's College London
Department of Informatics
 
Email szschaler@xxxxxxx
Phone +44 (020) 7848 1513
WWW   http://www.steffen-zschaler.de/

_______________________________________________ henshin-user mailing list henshin-user@xxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/henshin-user

 

_______________________________________________ henshin-user mailing list henshin-user@xxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/henshin-user
_______________________________________________
henshin-user mailing list
henshin-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/henshin-user

Back to the top