Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] a question about the higher-order transformation or about the Henshin interpreter

Dear Christian,

 

Thank you very much for your email. Yes, you have right. Nevertheless, I thought that I can let the user to select an Ecore file and then register it if it is not in the registry. Thereafter, the interpreter can work with its NS URI.

One more thing please, it would be nice to have the following feature:

During designing a  rule and specifying its parameters such as param1,  it would be more useful at least for me if I could write such param1.getName() in another node so that the interpreter can parse it later.  

 

Best wishes,

Nebras Nassar

 

 

 

From: henshin-dev-bounces@xxxxxxxxxxx [mailto:henshin-dev-bounces@xxxxxxxxxxx] On Behalf Of Christian Krause
Sent: Friday, November 21, 2014 8:50 AM
To: Henshin developers mailing list
Subject: Re: [henshin-dev] a question about the higher-order transformation or about the Henshin interpreter

 

Hi Nebras,

 

if you load your Ecore model from a file, you are using dynamic EMF and get the references to the Ecore files in your Henshin files. The alternative would be to use generated / static packages -- in this case you get the NS URIs instead of the Ecore file references. In general, it is not a good idea to mix dynamic and static EMF because of possible inconsistencies and name clashes in the package registry.

 

To be able to handle both dynamic and static packages, you could modify your method such that it gets the EPackage as input. Then the application could feed in either static packages like MyroomPackage.eINSTANCE or dynamically loaded packages (from *.ecore files).

 

Cheers,

Christian

 

 

2014-11-20 17:24 GMT+01:00 Nebras Nassar <nassarn@xxxxxxxxxxxxxxxxxxxxxxxxx>:

Dear Henshin team,

 

I have used the higher-order transformation technology of Henshin language to deduce rules and  generate Henshin files, which contain several model rules, from any given model (Ecore file). The problem is that the generated Henshin files work with the path of the given model (Ecore file). Therefore, the model (Ecore file) should be always beside (i.e. in the right path to) the Henshin files.

How can I tell the interpreter to use the NS URI instead of the path of any selected model ? Or Is it  possible to let the user to choose the path of any  model and then register it so that the Henshin interpreter uses the NS URI?  How can I generate Henshin files which work with the NS URI of the selected model?

In other words, the imports should not contain the path of the Ecore file. <imports href="model/MyRoom.ecore#/"/>

 

Please note that I do not want to write inside the following method too specific code such as MyroomPackageImpl.init() because this method should work correctly with any provided model.

 

I have used the following method  to generate the Henshin files:

 

public static void run(String path, String ecoreLocalPath, String henshinLocalPath, String generatedHenshinfilesLocalPath, boolean saveResult) {

             

              HenshinResourceSet resourceSet = new HenshinResourceSet(path);

              resourceSet.registerDynamicEPackages(ecoreLocalPath);

              resourceSet.registerXMIResourceFactories("*");

 

              EObject root = resourceSet.getResource(ecoreLocalPath).getContents().get(0);

              EPackage epModel = resourceSet.getPackageRegistry().getEPackage( ((EPackage)root).getNsURI());

             

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

              EGraph graph = new EGraphImpl();

              graph.addTree(epModel);

             

              // Initialize the interpreter:

              Engine engine = new EngineImpl();

              Unit unit = module.getUnit("mainUnit");

              UnitApplication unitApp = new UnitApplicationImpl(engine, graph, unit, null);

 

              // Execute the transformation unit:

              InterpreterUtil.executeOrDie(unitApp);

 

              Module result = (Module) unitApp.getResultParameterValue("moduleParam");

 

              // Save the result?

              if (saveResult) {

                     resourceSet.saveEObject(result, generatedHenshinfilesLocalPath);

              }

      

       }

 

 

 

Thanks in advance,

Nebras Nassar

 

 

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

 

 

 


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

 


Back to the top