[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| Re: [henshin-user] (no subject) | 
| Actually, using your source code, transformation, and models, I was
    able to set up the transformation so that it runs without throwing
    in exception. (To try it out, download the attached zip, import it
    in Eclipse via "File -> Import -> General -> Existing
    Projects into Workspace...", and execute Main.java). 
 Note that the rule "AssociationClass2Class" successfully changes the
    model, whereas the application of the unit "CDRefinement" fails (I
    haven't looked at the transformation in detail).
 
 In the general case, Steffen's answer is accurate: when working with
    EMF, you need to register the involved meta-models. But
    HenshinResourceSet has some convenience features built into it so
    that it can register the meta-models automatically in this case.
 
 Best regards,
 Daniel
 
 
 Am 08.02.2017 um 10:42 schrieb Loic
      Gammaitoni:
 
      
        
          
            
              
                @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);
 _______________________________________________
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
 | 
Attachment:
CDRefinement.zip
Description: Zip compressed data