Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] Export Henshin to AGG

Hi Florian,

2014-02-08 13:40 GMT+01:00 Florian Heß <hessflorian@xxxxxxxxxxxxxxxxxxxxxxxxx>:

When you look at the patch (more precisely at the If statement inside the for-each-parent loop), it takes care that each parent node appears before their child nodes. So I don’t see the need for change and I would keep it as it is.


These are only the direct parents. If you have a situation where X -> Y and Y -> Z the X.getSuperTypes() returns only Y.
It could still work, because you are doing it for all classes. Anyway, I would like to take a closer look into this to understand
what is going on.

Cheers,
Christian
 
FYI: parents will never be null

Cheers,

Florian

Gesendet: Samstag, 8. Februar 2014 08:30
An: Henshin developers mailing list
Betreff: Re: [henshin-dev] Export Henshin to AGG

Hi Florian,

thanks for the patch. I am not sure though whether it handles the case correctly when you have an inheritance hierarchy of length > 2.

How about this: before we add the node types, we first create a fresh list of all EClasses and sort them so that superclasses always appear before child classes. Then we iterate over this list to create the node types and just use Frank's approach to create the parent elements. Do you maybe want to try this out? 

Cheers,

Christian

2014-02-07 22:18 GMT+01:00 Florian Heß <hessflorian@xxxxxxxxxxxxxxxxxxxxxxxxx>:

Hey Christian,

 

Sorry, I am a bit new to SVN and this patch thing. And another sorry for not point out explicitly what I had changed/inserted.

I had checked out the Exporter before Frank worked on this patch and since then worked on my own. So, comparing to Frank’s patch: Yes, his part is (re)moved in my solution.

 

My patch is in the attached file.

 

Cheers,

Florian

 

Von: henshin-dev-bounces@xxxxxxxxxxx [mailto:henshin-dev-bounces@xxxxxxxxxxx] Im Auftrag von Christian Krause
Gesendet: Freitag, 7. Februar 2014 20:55


An: Henshin developers mailing list
Betreff: Re: [henshin-dev] Export Henshin to AGG

 

Hi Florian,

 

Could you please use the "Team -> Create Patch..." context menu action to create a patch?

 

Also, I am wondering whether you then add the inheritance code twice. Did you maybe remove Frank's part?

 

Cheers,

Christian

 

2014-02-07 20:40 GMT+01:00 Florian Heß <hessflorian@xxxxxxxxxxxxxxxxxxxxxxxxx>:

Hey Christian,

 

Alright. This is my solution; right after the “Nodes and attribute types” part:

 

// Set Inheritance:

for (EPackage epackage : module.getImports()) {

      for (EClassifier eclassifier : epackage.getEClassifiers()) {

            if (eclassifier instanceof EClass) {

                  EClass eclass = (EClass) eclassifier;                                 

                  EList<EClass> parents = eclass.getESuperTypes();

                        if(parents != null) {

                        for(EClass parent : parents) {

                             String childID = nodeTypeIDs.get(eclass);

                             String parentID = nodeTypeIDs.get(parent);

                            

                             Element parentElem = newElement("Parent", document.getElementById(childID), false);

                             parentElem.setAttribute("pID", parentID);

                            

                             //Parent nodes have to appear before child node in XML document

                             //so only move if necessary

                             if(Integer.parseInt(childID.substring(1)) < Integer.parseInt(parentID.substring(1))) {

                                  

                                   typesElem.insertBefore(document.getElementById(parentID), document.getElementById(childID));

                             }

                                        

                            

                        }

                  }

            }

      }

}

 

Basically, it is the same as Frank’s patch except for the if-clause and its own surrounding for-loop.

 

Regards,

Florian

 

Von: henshin-dev-bounces@xxxxxxxxxxx [mailto:henshin-dev-bounces@xxxxxxxxxxx] Im Auftrag von Christian Krause
Gesendet: Freitag, 7. Februar 2014 20:23


An: Henshin developers mailing list
Betreff: Re: [henshin-dev] Export Henshin to AGG

 

Hi Florian,

 

thanks for pointing this out. If you have a solution, I would be happy to incorporate it. You can just send me a patch.

 

Cheers,
Christian

 

2014-02-07 19:33 GMT+01:00 Florian Heß <hessflorian@xxxxxxxxxxxxxxxxxxxxxxxxx>:

Hey!

 

Thanks for this patch. But if I get this patch right, it does not consider the fact that parent nodes have to appear BEFORE their child nodes inside the resulting XML document. Otherwise AGG will throw an error.

This problem occurs when you have got an existing model and add a parent node afterwards. Thus the parent node gets an higher ID and therefore will be added into the XML document after the child node.

The solution I am working with supports this case. I just wanted to test it out some more but I can make it available for you right now – if you want to (how?)

 

Cheers,

Florian

 

Von: henshin-dev-bounces@xxxxxxxxxxx [mailto:henshin-dev-bounces@xxxxxxxxxxx] Im Auftrag von Christian Krause
Gesendet: Mittwoch, 5. Februar 2014 18:58


An: Henshin developers mailing list
Betreff: Re: [henshin-dev] Export Henshin to AGG

 

Hi,

the AGG exporter now supports inheritance:

 

https://dev.eclipse.org/mhonarc/lists/henshin-commits/msg00956.html

 

Thanks for submitting the patch, Frank.

 

Cheers,

Christian

 

2013-12-17 Florian Heß <hessflorian@xxxxxxxxxxxxxxxxxxxxxxxxx>:

Hello Christian,

 

thank you for the reply. I will take a deeper look into the exporter and try my best to add inheritance to the exporter.

 

Regards,

Florian

 

Von: henshin-dev-bounces@xxxxxxxxxxx [mailto:henshin-dev-bounces@xxxxxxxxxxx] Im Auftrag von Christian Krause
Gesendet: Montag, 16. Dezember 2013 22:23
An: Henshin developers mailing list
Betreff: Re: [henshin-dev] Export Henshin to AGG

 

Hello Florian,

 

inheritance is currently not supported by the AGG exporter. If you are interested in having this feature, maybe you can take a look at the exporter and try to add it yourself. If it works, we could add it to Henshin so that others can also make use of it. Maybe just take a look at the exporter to get a feeling of what is currently supported:

 

http://dev.eclipse.org/svnroot/modeling/org.eclipse.emft.henshin/trunk/plugins/org.eclipse.emf.henshin.model/src/org/eclipse/emf/henshin/model/exporters/HenshinAGGExporter.java

 

Cheers,

Christian

 

2013/12/16 Florian Heß <hessflorian@xxxxxxxxxxxxxxxxxxxxxxxxx>

Hey all,

 

I am trying to export a Henshin file to AGG for further usage by the implemented export option (right click on henshin file -> Export -> Henshin Model -> AGG) but it seems like the exporter does not consider inheritances which I defined in the imported *.ecore meta model.

Am I missing something or is this on purpose?

 

Cheers,

Florian

 


_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev

 


_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev

 


_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev

 


_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev

 


_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev


_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev



Back to the top