Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[henshin-dev] Failed to execute henshin rules in plug-in developement

Hi

I’m working on an eclipse plug-in that employ a specific graph transformation to weave certain patterns in a base model. I have programmatically performed this scenario with a JAVA application, but I couldn't do it in an eclipse plug-in project. Using the debugging mode, I got the following exception thrown by the call of the execute() operation.


Particularly, this problem occurs when the graph transformation has to manipulate an attribute value, and I was able to debug the program without errors for a transformation that simply removes a graph node.


java.lang.NullPointerException

at org.eclipse.emf.ecore.util.EcoreUtil.createFromString(EcoreUtil.java:3483)

at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.castValueToDataType(EngineImpl.java:969)

at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.evalAttributeExpression(EngineImpl.java:895)

at org.eclipse.emf.henshin.interpreter.info.VariableInfo.createConstraints(VariableInfo.java:188)

at org.eclipse.emf.henshin.interpreter.info.VariableInfo.createVariables(VariableInfo.java:111)

at org.eclipse.emf.henshin.interpreter.info.VariableInfo.<init>(VariableInfo.java:77)

at org.eclipse.emf.henshin.interpreter.info.RuleInfo.<init>(RuleInfo.java:26)

at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.getRuleInfo(EngineImpl.java:703)

at org.eclipse.emf.henshin.interpreter.impl.EngineImpl$MatchFinder.<init>(EngineImpl.java:305)

at org.eclipse.emf.henshin.interpreter.impl.EngineImpl$MatchGenerator.iterator(EngineImpl.java:251)

at org.eclipse.emf.henshin.interpreter.impl.RuleApplicationImpl.execute(RuleApplicationImpl.java:89)

at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeRule(UnitApplicationImpl.java:175)

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

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

at run.Main.execute(Main.java:55)



The code fragment we use to execute the henshin transformation is given here:


HenshinResourceSet resourceSet = new HenshinResourceSet(ResourcePath);

Module module = resourceSet.getModule("unit1.henshin", false);

Resource r = resourceSet.getResource("Test.ecore");

EObject eObject = r.getContents().get(0);

if (eObject instanceof EPackage) {

   EPackage p = (EPackage)eObject;

   resourceSet.getPackageRegistry().put(p.getNsURI(), p);

}

EGraph graph = new EGraphImpl(resourceSet.getResource("base.xmi"));

Engine engine = new EngineImpl();

UnitApplication app = new UnitApplicationImpl(engine);

app.setEGraph(graph);

app.setUnit(module.getUnit("r1"));

app.execute(null);

Resource rs=resourceSet.getResource("base.xmi");

rs.setModified(true);

rs.getContents().clear();

for(int i=0;i<graph.getRoots().size();i++){

rs.getContents().add(graph.getRoots().get(i));

}

rs.save(null);


Greetings,



Back to the top