Processing recursive data structures? [message #1768130] |
Thu, 13 July 2017 17:25  |
Eclipse User |
|
|
|
Hi,
My models are basically trees (with some objects between the tree nodes carrying additional data, i.e. an edge between a parent A and a child B looks like A->E->B). I would like to generate a document that reflects the tree structure. That means for a node A with two children B (with child C) and D, the output should look like
My problem: I don't want to impose a limit on the depth of the tree!
I don't see how I can process such a recursive data structure in a gendoc template. I first thought I can do recursive calls between fragments, but that's not allowed in gendoc.
Then I thought that maybe I could first flatten the tree structure (with Acceleo/Ocl collect) and process all children iteratively. However, that also doesn't work. The collect function doesn't know how to handle the edges (it probably only works for simple package structures with contain-relationships).
Any other idea? Invoke a Java function?
[Updated on: Thu, 13 July 2017 17:34] by Moderator
|
|
|
|
|
|
|
|
Re: Processing recursive data structures? [message #1770531 is a reply to message #1769378] |
Mon, 14 August 2017 02:24  |
Eclipse User |
|
|
|
Hi,
I have been looking at that issue, and we have some code that prevent loops in the invokation of fragments. This is basically due to we put the fragment in a new acceleo template and use acceleo includes which does not allow loops in the template dependency.
When I have a little of time, I will try to submit a patch.
I have been working on put all the fragments inside the same acceleo template, so the recursion will work for all the cases. Actually the issue with the polymorphism is there using fragment recursion or just calling a fragment.
Another issue we have is that we can not define queries in the gendoc templates, but that is another issue.
|
|
|
Powered by
FUDForum. Page generated in 0.04920 seconds