Freeplane to spreadsheet interface

Freeplane to spreadsheet interface

Postby vineela3 » Thu Mar 27, 2014 6:59 pm

I need to view the mind map files as spreadsheets (in a table format) very often.
According my research, methods to convert mind maps to Excel are not exactly instantaneous.

I went through this link http://freeplane.sourceforge.net/wiki/index.php/Scripting:_Example_scripts_using_external_libraries and thought of using a java based spreadsheet application and accessing it through a groovy script.

I found two applications that suit our requirements. Using their APIs and Freeplane's APIs, I developed a small groovy script and packaged it as a Freeplane add-on.
With a key stroke, I was able to view the mind map as a spreadsheet, make the changes I want and save them back to the mind map.
FreeplaneToSpreadSheet.png
Freeplane to spreadsheet add-on
(53.15 KiB) Downloaded 246 times

Now I ran into a problem and I exhausted all my resources figuring it out.

Freeplane crashes after I launch the add-on a couple of times (close and re-open the GUI). It reports 'java.lang.OutOfMemoryError: PermGen space’ error. Both the spreadsheet apps I found end up with the same result.

FYI, PermGen is an area of memory that is used to load class files. The size of this memory region is fixed.
If there's any problem with the garbage collection of classes and if we keep on loading new classes, the VM runs out of space in PermGen and causes an out of memory error.

I did the following to find the issue:

1. I found out that the JFreeChart script mentioned in the above link does NOT exhibit the same behavior. The permgen space gets filled up and when it reaches the maximum, it gets cleaned up and I can re-launch the add-on without any issue.
Java VisualVM graphs of both the scenarios:
JFreeChart.png
JVisualVM graph of Freeplane permgen when JFreechart script is invoked
(55.76 KiB) Downloaded 131 times

Spreadsheet.png
JVisualVM graph of Freeplane permgen when Spreadsheet script is invoked
(35.27 KiB) Downloaded 145 times

2. I changed my script to simply open and close (dispose the GUI) the spreadsheet a 100 times using a loop. There was NO crash. Only when I keep re-launching the script using the add-on I get the error.

3. I launched Freeplane with the JVM parameters that increase/clean up the permgen space. (-XX:MaxPermSize=512M -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+UseConcMarkSweepGC).
Increasing the memory just delayed the crash. And apparently if there is a memory leak JVM ignores the arguments that specify to clean up the permgen space.

4. I tried to track down the leak but it was really hard and I was not able to find the source of the leak.

5. I found some information mentioning that the GroovyClassLoader has a permgen issue.
Sources:
http://stackoverflow.com/questions/20566651/groovyclassloader-and-permgen
http://groovy.329449.n5.nabble.com/Groovy-objects-classes-not-GCed-after-GroovyShell-evaluate-td5714808.html
http://jira.codehaus.org/browse/GROOVY-6494
I tried some of solutions mentioned above in my script, but there was no change.

The groovy script I used opens the spreadsheet GUI and disposes it. It has two lines of code.

How can I find what the real issue is here ?
Is it with in Groovy or the way Freeplane launches the add-ons or with the spreadsheet applications I found ?

I am totally stuck and I really need some help to proceed from here. Thank you !
vineela3
 
Posts: 11
Joined: Tue May 14, 2013 12:25 am

Re: Freeplane to spreadsheet interface

Postby dpolivaev » Thu Mar 27, 2014 11:30 pm

If you could create a bug report and upload everything I need to reproduce the problem and to get the out of memory exception I would analyze the problem and try to fix it.

https://sourceforge.net/apps/mantisbt/f ... g_page.php

Regards, Dimitry
User avatar
dpolivaev
Site Admin
 
Posts: 667
Joined: Sat Jul 23, 2011 1:21 pm

Re: Freeplane to spreadsheet interface

Postby boercher » Fri Mar 28, 2014 1:15 am

Freeplane crashes after I launch the add-on a couple of times (close and re-open the GUI). It reports 'java.lang.OutOfMemoryError: PermGen space’ error. Both the spreadsheet apps I found end up with the same result.

Please also clarify:

- What do you mean by "launch the add-on"? "Add-on" has a special meaning in Freeplane but I guess that you mean starting a script that launches one of the spreadsheet apps - right?

- When the error occurs exactly: On Freeplane's startup or when launching the script?

- Which Freeplane version are you using? Freeplane 1.3 caches scripts and with it of course some classes. (But they shouldn't survive a re-start.)

Btw. have you considered using Freeplane formulas for a part of the tasks that you are handling with the external apps?

Volker
boercher
 
Posts: 644
Joined: Tue Jul 26, 2011 7:13 am

Re: Freeplane to spreadsheet interface

Postby vineela3 » Fri Mar 28, 2014 4:05 am

Hi Dimitry,

I have posted a bug in mantis : : https://sourceforge.net/apps/mantisbt/freeplane/view.php?id=2127

Thank You
Vineela
vineela3
 
Posts: 11
Joined: Tue May 14, 2013 12:25 am

Re: Freeplane to spreadsheet interface

Postby vineela3 » Fri Mar 28, 2014 4:19 am

Hi Volker,

- What do you mean by "launch the add-on"? "Add-on" has a special meaning in Freeplane but I guess that you mean starting a script that launches one of the spreadsheet apps - right?


Yes. Sorry for the confusion. I start the script that is part of the Freeplane Add-on I packaged.

- When the error occurs exactly: On Freeplane's startup or when launching the script?


I launch the script in the add-on (using a key stroke or Going to Tools -> MyAddOn -> Script)
It brings up a GUI as shown in the "FreeplaneToSpreasheet.png" screenshot above. I close the spreadsheet GUI (not Freeplane). And when I need to see the mind map as a spreadsheet again, I launch the script through the add-on. If we keep closing the spreadsheet GUI and re-launching the script, the crash occurs on the 8th time.
After this, I have to re-start Freeplane. Again the crash occurs again if we repeat the above steps.

- Which Freeplane version are you using? Freeplane 1.3 caches scripts and with it of course some classes. (But they shouldn't survive a re-start.)


I am using 1.2.23. Let me try 1.3.

Btw. have you considered using Freeplane formulas for a part of the tasks that you are handling with the external apps?


Yes. But they do not serve our purpose. We need to edit the attributes and view the mind map in a table quite often. For our purpose, it is convenient to see the nodes, attribute names as columns and the node names, attribute values as column values.

Thank You
Vineela
vineela3
 
Posts: 11
Joined: Tue May 14, 2013 12:25 am

Re: Freeplane to spreadsheet interface

Postby boercher » Wed Apr 02, 2014 10:29 am

vineela3 wrote:> Btw. have you considered using Freeplane formulas for a part of the tasks that you are handling with the external apps?

Yes. But they do not serve our purpose. We need to edit the attributes and view the mind map in a table quite often. For our purpose, it is convenient to see the nodes, attribute names as columns and the node names, attribute values as column values.

If I understood correctly you assume that you cannot use formulas since you assume that they don't work in attribute values, right? But formulas are actually evaluated in attribute values too.

Volker
boercher
 
Posts: 644
Joined: Tue Jul 26, 2011 7:13 am

Re: Freeplane to spreadsheet interface

Postby vineela3 » Wed Apr 02, 2014 8:52 pm

Hi Volker,

If I understood correctly you assume that you cannot use formulas since you assume that they don't work in attribute values, right? But formulas are actually evaluated in attribute values too.


I can use formulas in attribute values, but we don't need to perform any type of calculations. (Please correct me if my understanding of formulas is not right) I never came across a case where formulas are required.

We have several mind maps with nodes close to 6000. One of our use case is, we need to add a particular attribute name and a value to a bunch of selected nodes. Later we may need to change that value for exactly those nodes to some other value. I am also aware of the 'Copy attributes' 'Paste attributes' 'Find and replace attributes' and filtering options. But for the amount of attribute editing we do, something like excel will be more comfortable.

What we are looking for is a fast, easy and comprehensive editing environment for attributes. We also have the the requirement to show the map in a table as it is convenient at times.

So we developed a procedure to convert the mind map to excel and excel to mind map. (never used formulas in excel either) But this takes significant amount of time. We do this so frequently that this delay became unacceptable.

That was the reason I choose this approach. I thought this way we can switch back and forth almost instantly (simply open the table with a key stroke, close and open again when needed). I select a bunch of nodes, open them in the table, make the edits I need and save them back to the map. The whole environment works fine on both Windows and Linux. But this memory leak is not something I anticipated.

Is there a better approach or any other way to achieve what I am trying to do ?

Please let me know your thoughts.

-Vineela
Last edited by vineela3 on Thu Apr 03, 2014 8:50 pm, edited 2 times in total.
vineela3
 
Posts: 11
Joined: Tue May 14, 2013 12:25 am

Re: Freeplane to spreadsheet interface

Postby vineela3 » Thu Apr 03, 2014 5:48 pm

Hi Volker,

One of the softwares (JComponentPack) is working fine for freeplane beta 1.3.6. There is no crash. The memory remained stable for a long time.

The other one (Jxcell) opens up once and when I try to open it for the second time, the table does not show up. There is no (error) message or any other change. I have to re-start Freeplane to open the table again. There is no crash.

I will keep working with the beta version.

When will this beta version be released as the product version ? Can we expect any fix soon ?

- Vineela
vineela3
 
Posts: 11
Joined: Tue May 14, 2013 12:25 am

Re: Freeplane to spreadsheet interface

Postby boercher » Sun Apr 06, 2014 10:50 pm

Hi Vineela,

I agree that your use case doesn't need formulas although "calculation" is not restricted to numbers - a formula "= parent.text" will use the text of the parent node and "=parent['anAttribute']" that of the attribute.

The problem with Jxcell sounds like it is doing some important work in static initialization which isn't done on further invocations. Maybe you have to call some initialization or cleanup procedure before launch.

The release of 1.3 will still take some weeks or even months, depending on the number of bugs found in the beta phase. (Felix might have a better prediction.)

I believe your best option would be to work on some smart dialogs for editing attributes instead of switching between different tools. These can be done quite easily with Groovy's SwingBuilder, see also the examples in the Freeplane scripts collection.

Regards, Volker
boercher
 
Posts: 644
Joined: Tue Jul 26, 2011 7:13 am

Re: Freeplane to spreadsheet interface

Postby vineela3 » Mon Apr 07, 2014 5:17 pm

Hi Volker,

We already have some smart dialogue scripts to edit attributes. We used Groovy SwingBuilder and looked at Freeplane scripts collection page for examples.

But our requirements started piling up and there were a lot of scenarios that needed to be covered. So we decided instead of developing everything from scratch, we can use one of the softwares available on the market.

As one of the spreadsheet apps we choose is working for the Freeplane beta version, we are planning to switch to that. There is no abnormal memory increase or any other issue. Its been working perfectly.

Can we continue using the beta version, until you guys make a release ? I did not find any issues with the beta version so far.

Thank you
Vineela
vineela3
 
Posts: 11
Joined: Tue May 14, 2013 12:25 am


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 1 guest