Project
GSoC 2009 – Taxonomy Library API
5 years, 2 months ago Posted in: Project 0

The primary task was to implement the architecture in ! library. Albeit having �clear specs about final outcome, it was not straight forward. The first hurdle was to follow ! style i.e. using JTable for CURD while ensuring that the performance and features are not limited by it. Also as it is ! 1.6 is targetted and there is no clear documentation available, I chose to follow JUser (a core library class) as reference because it parallels JTaxonomyTree and JTaxonomyLeaf two primary classes exposed by framework. This post talks about the library design.

I had some discussion with the mentors as where to place the taxonomy library folder, and finally it was decided to go under libraries/joomla/taxonomy, although it could be moved later to to libraries/taxonomy if it is deemed to be more appropriate.

JTaxonomy

At the root JTaxonomy class which extends JClass, exposes the full set of features. It is used in a singleton form and must be invoked as

jimport(‘joomla.taxonomy.taxonomy’);
$taxonomy =&JTaxonomy::getInstance();

This class provides the following set of methods

1. Tree related

&getTreeList($extension = null)
&getTrees($extension = null)
&getTree($id = 0, $options = null)

First returns an array of tree names keyed by tree IDs, second returns an array tree objects keyed by tree IDs, and the last gives tree object for the given tree ID. They are eventually routed through JTaxonomyTree which provides the implmentation for trees.

2. Leaf related

&getLeafList($options = null)
&getLeaves($options = null)
&getLeaf($id = 0, $options = null)
&getLeafHierarchy($tid, $options = null)

The last function serves a important function implemented in a helper class. It builds a complete leaf hierarchy under a given tree.

3. Map related
&getMap()
It returns a TaxonomyMap object that provides methods dealing with leaf mapping.

JTaxonomyTree

JTaxonomyTree extends JClass, and mainly handles the CRUD operations which are routed through its JTable subclass JTabeTaxTree class.

JTaxonomyTree Class

JTaxonomyTree Class

JTableTaxTree Class

JTableTaxTree Class

JTaxonomyLeaf

JTaxonomyLeaf extends JClass, and mainly handles the CRUD operations which are routed through its JTable subclass JTabeTaxLeaf class.
JTaxonomyLeaf class

JTaxonomyLeaf class

JTableTaxLeaf class

JTableTaxLeaf class

JTaxonomyMap

This is class handles the object – leaf mapping, the fundamental operation of taxonomy frame, through standard methods. The implementation is expected to change with the requirements imposed, which will be actually finalized along with the implementation of com_contentPlus (a content component with taxonomy support). �This class together with JHTMLTaxonomy is expected to provide a complete form support to the integration with any components.

JTaxonomyMap Class

JTaxonomyMap Class

JHTMLTaxonomy JHTML subclass

JHTMLTaxonomy JHTML subclass

Summary

Although the feature sets of Taxonomy Library is currently completely determined, it might evolve with the requirements of components and plugins as demanded. Hence it is provided here for reference and feedback only. In the next blog I will discuss the dilemma we had in compromising between performance, standard pattern and generality.

Related Posts

Leave a Reply