|Problems? Is your data what you think it is?|
Tree Traversal Script/Nested Setsby Raad (Acolyte)
|on Jul 13, 2004 at 20:19 UTC||Need Help??|
Raad has asked for the
wisdom of the Perl Monks concerning the following question:
Hi Monks, I've been struggling with this problem for over a week now and I am about to admit failure at getting a working algorithm! I have a thesaurus of terms consisting of hierarchical tree structures which we use to index our library collection. My objective is to create a database like SQLite to store all existing entries (over 3,000). The thesaurus consists of a subject term and a unique identifier, a description and some other information. Example:
TERM BODY REGIONS
DESCRIPTION Anatomical areas of the body.
DESCRIPTION Portion of the body that lies between the
thorax and the pelvis.
Since I experienced some problems creating foreign keys in SQLite, I decided to store my data in a Hash of Array like:
The algorith for nested sets calls for a recursive technique to populate children nodes.
Could anybody direct me in the right direction? Or could you recommend an alternative algorithm using regex for instance? Any help would be appreciated.
I've looked at the ISO Thesaurus modules on CPAN but our data does not conform to this standard. I've also looked at some XML approaches but it was mind boggling, to say the least.
Edited by Chady -- removed <br> tags from code.