From: Conal T. <Con...@vu...> - 2004-09-10 06:15:02
|
I am developing an application which uses tm4j with Hibernate as the = provider.=20 The application is a website built with Cocoon. The topic map is = harvested from a bunch of sources, and defines the information = architecture of the site. Each page on the site represents a topic with = all its associated topics and other characteristics. So each page = requires querying for a few topics only. This works OK. My problem is that I also want to be able to visualise the entire map, = to check my harvesting/merging/etc; to do this I've exported the entire = map, and it takes about an hour (on a 2.6GHz P4 with 2GB RAM). This = seems like a long time to export 838kb of XTM code containing about 2800 = topics, but only a few dozen associations. Is this to be expected? Or is = there something peculiar in this? The MySQL database is local, and the = export is definitely processor-bound. About 97% of the processor time is = used by Tomcat (which is the container in which tm4j is running), and = the remainder is used by MySQL.=20 Some people have reported very slow performance with IMPORTING into = hibernate - I haven't noticed that. Certainly it takes only a minute or = so to harvest all these topics (which includes transforming them from = other XML formats into XTM) and insert them into tm4j. I see now that it's possible to configure TMNav to use the hibernate = provider - so maybe I don't need to do this export at all. I don't know = if this will speed up the visualisation - I'm certainly going to try = that, but I'm still keen to hear if someone can tell me I'm doing = something wrong - especially if it's something small and easy to fix :-) = I'm appending the JavaScript code which does the export, calling Java = classes to do the actual work. This code runs inside of Cocoon, as a = "flowscript". Thanks Con -- Conal Tuohy Senior Programmer New Zealand Electronic Text Centre www.nzetc.org JavaScript code: function export_map() { /* this program exports the "nzetc" topicmap to an XTM file, and then = calls a Cocoon pipeline to display that XTM file */=20 /* this file to export into */ var export_filename =3D cocoon.parameters["filename"]; =09 /* get the topic map from the topic map manager */ var TopicMapManager =3D = cocoon.getComponent("org.tm4j.tm4web.cocoon.TopicMapManagerComponent"); var map =3D TopicMapManager.getTopicMap("nzetc"); cocoon.releaseComponent(TopicMapManager); /* write the topic map to a file */ var walker =3D new Packages.org.tm4j.topicmap.utils.TopicMapWalker(); var writer =3D new Packages.org.tm4j.topicmap.utils.XTMWriter(); var file =3D new java.io.File(export_filename); var os =3D new java.io.FileOutputStream(file); var of =3D new Packages.org.apache.xml.serialize.OutputFormat(); of.setEncoding("UTF-8"); of.setIndenting(true); of.setIndent(2); var serializer =3D new = Packages.org.apache.xml.serialize.XMLSerializer(os, of); walker.setHandler(writer); writer.setContentHandler(serializer); walker.walk(map); cocoon.sendPage("export/nzetc.xtm"); } |