Re: PEARtree
| From: | Tomas V.V.Cox | Date: | Thu, 10 May 2001 14:30:12 +0000 |
| Subject: | Re: PEARtree | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-361@lists.php.net to get a copy of this message | ||
Jens Wolk wrote:
>
> Salut everybody ,
>
> I am working on a project which implements an online version of some
> Yellow Pages. We have addresses of companies which are assigned to
> business sectors. The business sectors in turn are arranged in a tree
> structure.
>
> More generally spoken, the business sectors are nodes of a tree and
> the addresses (or any other information objects with properties) the
> leaves.
Do you mean one leave object per property? Why not directly properties
in node?
> This is why I consider implementing a library for maintaining such
> hierarchical information trees. It shall be PEAR compliant (not only
> because it then might qualify for a really nice name: PEARtree :)
>
> The idea is this: 3 main classes: Tree, Tree_node and Tree_leaf - each
> extending DB_storage. Tree will take care of all
> modifying/adding/deleting of Tree_node and Tree_leaf objects which
> belong to this particular tree.
As the tree data structure is a very nice idea, it could be great if it
could contain more generic data, not only objects from a query. For
example I recently publish the Xml2obj class (in pear/Experimental/XML),
that maps an xml file to a tree of objects (dom style). With the tree
class I could bypass some current limitations of it, like a better node
search mechanism or the ability of one node to know about its parent or
brothers.
> Perhaps such a library already exists? If so it would be very nice if
> you could tell me the name of it.
>
> An example I know is the library from Ratschiller/Gerken: "Web Application >Development
> with PHP 4.0"
The only class I know to manages trees (binary tree) is in
http://phpclasses.upperdesign.com/browse.html/package/193
(I haven't
test it).
> Any comments are very appreciated.
>
My vote is to add it, but it could be very nice if the tree could be
filled with data from many sources and dumped back to whatever support.
I think that the class can be generic in adding, modifying, deleting or
searching but specific in filling or saving.
Hope to not be wrong with my though.
Tomas V.V.Cox