Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] henshin-dev Digest, Vol 56, Issue 5

Hi Christian,
Thank you very much for your help, I tested the solution and everything worked out fine. The problem is that the base model (concerned by the application of the henshin transformation) results from the parsing of a concrete textual specification to the corresponding model and It uses the static EMF registry. So I have to manipulate programmatically this model to insert/remove the tag 
-xsi:schemaLocation="<ns-uri> <path>" -.

Best regards


Youness LAGHOUAOUTA
Phd student
Mohammed V-Rabat University

2014-12-25 8:45 GMT+00:00 <henshin-dev-request@xxxxxxxxxxx>:
Send henshin-dev mailing list submissions to
        henshin-dev@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
        https://dev.eclipse.org/mailman/listinfo/henshin-dev
or, via email, send a message with subject or body 'help' to
        henshin-dev-request@xxxxxxxxxxx

You can reach the person managing the list at
        henshin-dev-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of henshin-dev digest..."


Today's Topics:

   1. Re: henshin-dev Digest, Vol 56, Issue 3 (Christian Krause)


----------------------------------------------------------------------

Message: 1
Date: Thu, 25 Dec 2014 09:44:51 +0100
From: Christian Krause <henshin.ck@xxxxxxxxx>
To: Henshin developers mailing list <henshin-dev@xxxxxxxxxxx>
Subject: Re: [henshin-dev] henshin-dev Digest, Vol 56, Issue 3
Message-ID:
        <CAHwrtvqvdG7aD55o-9rFhoCf3vSdPn96L1i+9S+E7qRDAbLoDw@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="utf-8"

Hi laghouaouta,

you are using dynamic EMF but the dynamically loaded package does not have
a corresponding factory. This can happen when you mix static and dynamic
EMF.

To avoid this problem, you should not register the package yourself in the
registry, but let EMF take care of this. In your Henshin file you should
import the package from your workspace, not from the static EMF registry.
Similarly, your instance model needs to refer to the Ecore file directly.
You can do a right-click on the Ecore file, and click on Henshin -> Create
Dynamic Instance. This will create a sample file. The important piece in
the header is:

xsi:schemaLocation="http://test/1.0 Test.ecore"

--> This tells EMF from where to load the Ecore model.

In your Java code you don't need to register any packages anymore. It is
also worth looking at the examples plugin (some of the examples you can
also find on our website). Almost all of them use dynamic EMF -- so you can
compare the approaches.

Hope this helps.

Cheers,
Christian


2014-12-24 11:58 GMT+01:00 laghouaouta youness <rabat.ntic@xxxxxxxxx>:

> Hi Christian,
>
> Thank you for your response. Actually, I have to match string constants
> and I tested with integers but this problem persists.
>
> Yes , this occurs specifically when the rule has to evaluate attribute
> values. And I performed the deleting of a contained node without errors.
>
> Please find below the resources I used to test this scenario:
>
>
> *//Test.ecore*
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
>     xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
> nsURI="http://test/1.0" nsPrefix="test">
>
>   <eClassifiers xsi:type="ecore:EClass" name="Rule">
>
>     <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
>     <eStructuralFeatures xsi:type="ecore:EReference" name="params"
> upperBound="-1"
>
>         eType="#//Param" containment="true"/>
>
>     <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
>
>   </eClassifiers>
>
>   <eClassifiers xsi:type="ecore:EClass" name="Param"/>
>
> </ecore:EPackage>
>
> *//unit1.henshin*
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <henshin:Module xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:henshin="
> http://www.eclipse.org/emf/2011/Henshin" xmi:id="_bIT78IlJEeS-Lpe2rDONkQ">
>
>   <imports href="" href="http://test/1.0#/" target="_blank">http://test/1.0#/"/>
>
>   <units xsi:type="henshin:Rule" xmi:id="_cmLoIIlJEeS-Lpe2rDONkQ"
> name="r1">
>
>     <lhs xmi:id="_cnX68IlJEeS-Lpe2rDONkQ" name="Lhs">
>
>       <nodes xmi:id="_eMsS8IlJEeS-Lpe2rDONkQ">
>
>         <type href="" href="http://test/1.0#//Rule" target="_blank">http://test/1.0#//Rule"/>
>
>         <attributes xmi:id="_gN0dMIlJEeS-Lpe2rDONkQ" value="&quot;a&quot;">
>
>           <type href="" href="http://test/1.0#//Rule/name" target="_blank">http://test/1.0#//Rule/name"/>
>
>         </attributes>
>
>       </nodes>
>
>     </lhs>
>
>     <rhs xmi:id="_cnX68YlJEeS-Lpe2rDONkQ" name="Rhs">
>
>       <nodes xmi:id="_eMsS8YlJEeS-Lpe2rDONkQ">
>
>         <type href="" href="http://test/1.0#//Rule" target="_blank">http://test/1.0#//Rule"/>
>
>         <attributes xmi:id="_gN0dMYlJEeS-Lpe2rDONkQ" value="&quot;b&quot;">
>
>           <type href="" href="http://test/1.0#//Rule/name" target="_blank">http://test/1.0#//Rule/name"/>
>
>         </attributes>
>
>       </nodes>
>
>     </rhs>
>
>     <mappings xmi:id="_eMsS8olJEeS-Lpe2rDONkQ"
> origin="_eMsS8IlJEeS-Lpe2rDONkQ" image="_eMsS8YlJEeS-Lpe2rDONkQ"/>
>
>   </units>
>
> </henshin:Module>
>
>
> *//base.xmi*
>
> <?xml version="1.0" encoding="ASCII"?>
>
> <test:Rule xmi:version="2.0"
>
>     xmlns:xmi="http://www.omg.org/XMI"
>
>     xmlns:test="http://test/1.0"
>
>     name="a">
>
>   <params/>
>
>   <params/>
>
> </test:Rule>
>
>
> *//unit1.henshin (the running version that deletes a Param node)*
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <henshin:Module xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:henshin="
> http://www.eclipse.org/emf/2011/Henshin" xmi:id="_lxujgIm-EeSNK6Vke8rPuQ">
>
>   <imports href="" href="http://test/1.0#/" target="_blank">http://test/1.0#/"/>
>
>   <units xsi:type="henshin:Rule" xmi:id="_rhBBkIm-EeSNK6Vke8rPuQ"
> name="r1">
>
>     <lhs xmi:id="_rhBBlYm-EeSNK6Vke8rPuQ" name="Lhs">
>
>       <nodes xmi:id="_I5rksIm_EeSNK6Vke8rPuQ"
> outgoing="_JPZ9E4m_EeSNK6Vke8rPuQ">
>
>         <type href="" href="http://test/1.0#//Rule" target="_blank">http://test/1.0#//Rule"/>
>
>       </nodes>
>
>       <nodes xmi:id="_JPZ9EIm_EeSNK6Vke8rPuQ"
> incoming="_JPZ9E4m_EeSNK6Vke8rPuQ">
>
>         <type href="" href="http://test/1.0#//Param" target="_blank">http://test/1.0#//Param"/>
>
>       </nodes>
>
>       <edges xmi:id="_JPZ9E4m_EeSNK6Vke8rPuQ"
> source="_I5rksIm_EeSNK6Vke8rPuQ" target="_JPZ9EIm_EeSNK6Vke8rPuQ">
>
>         <type href="" href="http://test/1.0#//Rule/params" target="_blank">http://test/1.0#//Rule/params"/>
>
>       </edges>
>
>     </lhs>
>
>     <rhs xmi:id="_rhBBlom-EeSNK6Vke8rPuQ" name="Rhs">
>
>       <nodes xmi:id="_I5rksYm_EeSNK6Vke8rPuQ">
>
>         <type href="" href="http://test/1.0#//Rule" target="_blank">http://test/1.0#//Rule"/>
>
>       </nodes>
>
>     </rhs>
>
>     <mappings xmi:id="_I5rksom_EeSNK6Vke8rPuQ"
> origin="_I5rksIm_EeSNK6Vke8rPuQ" image="_I5rksYm_EeSNK6Vke8rPuQ"/>
>
>   </units>
>
> </henshin:Module>
>
>
>
> Greetings,
>
>
>
> Youness LAGHOUAOUTA
>
> Phd Student
>
> Mohammed V-Rabat University
>
>
>
> 2014-12-24 8:32 GMT+00:00 <henshin-dev-request@xxxxxxxxxxx>:
>
>> Send henshin-dev mailing list submissions to
>>         henshin-dev@xxxxxxxxxxx
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>         https://dev.eclipse.org/mailman/listinfo/henshin-dev
>> or, via email, send a message with subject or body 'help' to
>>         henshin-dev-request@xxxxxxxxxxx
>>
>> You can reach the person managing the list at
>>         henshin-dev-owner@xxxxxxxxxxx
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of henshin-dev digest..."
>>
>>
>> Today's Topics:
>>
>>    1. Failed to execute henshin rules in plug-in        developement
>>       (laghouaouta youness)
>>    2. Re: Failed to execute henshin rules in plug-in    developement
>>       (Christian Krause)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Tue, 23 Dec 2014 21:30:48 +0000
>> From: laghouaouta youness <rabat.ntic@xxxxxxxxx>
>> To: henshin-dev@xxxxxxxxxxx
>> Subject: [henshin-dev] Failed to execute henshin rules in plug-in
>>         developement
>> Message-ID:
>>         <CANmOEp=Oy2X7C6SCxQLDc0+kHUkkJB=
>> EBqvPfU4ukpmKTg1Bdg@xxxxxxxxxxxxxx>
>> Content-Type: text/plain; charset="utf-8"
>>
>> 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,
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <
>> https://dev.eclipse.org/mailman/private/henshin-dev/attachments/20141223/59976ecb/attachment.html
>> >
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Wed, 24 Dec 2014 09:32:16 +0100
>> From: Christian Krause <henshin.ck@xxxxxxxxx>
>> To: Henshin developers mailing list <henshin-dev@xxxxxxxxxxx>
>> Subject: Re: [henshin-dev] Failed to execute henshin rules in plug-in
>>         developement
>> Message-ID:
>>         <CAHwrtvpQJFxeQoSh=
>> RU9gVC_79-J8XyJH0+0fShazG6g6Qn+sQ@xxxxxxxxxxxxxx>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hi laghouaouta,
>>
>> from the exception it looks like in your rule an attribute is matched
>> using a constant and that this constant cannot correctly be instantiated
>> from its string representation. How does your rule exactly look like
>> (particularly
>> the attribute part)?
>>
>> Cheers,
>> Christian
>>
>> 2014-12-23 22:30 GMT+01:00 laghouaouta youness <rabat.ntic@xxxxxxxxx>:
>>
>> > 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,
>> >
>> >
>> >
>> > _______________________________________________
>> > 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
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <
>> https://dev.eclipse.org/mailman/private/henshin-dev/attachments/20141224/2690d73b/attachment.html
>> >
>>
>> ------------------------------
>>
>> _______________________________________________
>> 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
>>
>> End of henshin-dev Digest, Vol 56, Issue 3
>> ******************************************
>>
>
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dev.eclipse.org/mailman/private/henshin-dev/attachments/20141225/1e3e53e0/attachment.html>

------------------------------

_______________________________________________
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

End of henshin-dev Digest, Vol 56, Issue 5
******************************************


Back to the top