Monday, September 04, 2006

AJAX - Tag Clouds

I searched how to implement a tag cloud on my Lotus Notes application for web and I've the surprise to find quickly 3 solutions. All this solution implemented three differents way. I find them very interresting because they reproduced the three standard new ways to develop Lotus Notes Application on Web; Formula & Javascript, LotusScript and LotusScript with DXL.

What is a tag cloud ?

A tag cloud is a representation of keywords defined by users who are displayed with a font size proportional at his importance. The most common criteria to define importance is the number of occurence of this tag in all the documents.

You can find tag cloud in all the important web 2.0 application like delicious, Flickr or Technorati.


If I want to use tag use, it's to replace the categorized view. I find categorization too hard to manage in web application.

Three ways to implement a tag cloud in Lotus Notes for the Web

First Way : Formula & Javascript
Ferdy Christant suggest to create a javascript array thru Notes view with little formula. The tag cloud is generated by Javascript on browser.

The principal advantage is to not overload the server. Only a view is called by the users.

Unfortunately this solution is not perfect

  • The browser must support Javascript. If all the modern browser allow to run Javascript code, the user can deactivate this option. Second thing, if the Javascript can be executed, we must be careful to not overload the browser with too much data.
  • One of the advantages of tag cloud for webmaster is for indexation on search engine. For search bots, a tag cloud is a library of links with smart keywords, the tag, to index the content of the link. Today, the javascript isn't running by this bots. Then, the tag cloud is ignore by search engine.
  • You can't use this method to display tag cloud on Lotus Notes Client
Second way : Traditional LotusScript
Thomas Adrian uses a LotusScript agent to build the TagCloud. The tag cloud is computed in real time from an agent who is based on NotesView Navigator and print function. The server must run this agent for every call to display the tag cloud. The advantage is that the tag cloud is coded in HTML format, then the search bot can index it. The disavantage of that solution is the avantage of the first solution and inverse.

If I had to choose one these two solution, I will prefer first for an Intranet and second for Internet. In an intranet application I can control browsers versions, I don't need to index my tag cloud and the most important is to preserve the CPU.

Third way : LotusScript with DXL
Christian Mueller purpose a variation of the second solution with DXL. He computes the tag cloud with the same method than Thomas Adrian but doesn't display the result directly to the browser. He saves the result in a new form with DXL. We just need to execute the agent when a document is created, updated or deleted, when the tag cloud is modified.

With this solution the server has just to open a form to display the tag cloud in HTML format. Another advantage is it's possible to display the tag cloud on Lotus Notes Client.

Is the ideal solution ? It's the best solution for my first constraints. But there are two new problems :
  • In french version of this blog, Yogi has remarked it's not possible to manage documents with reader field,
  • It's difficult today to find developper who really knows DXL to integer and maintain this type of application.

4 comments:

Christian Mueller said...

You could place a reader field with DXL using the attribute type set to "READER".

Like:
field name="readers" type="READER"

You need propably to recalculate the document with an Agent, that runs on the server.

To enable the application for multiple users, you should use a "User"-Field, too...

Thats all possibilities, that had made my example code to complex to understand on the fly.

Christian

Philippe GAUVIN said...

Your solution can correct some problems but not all with DXL method.

In the case of the tag cloud display tags repartition on documents where there are reader field, you haven't one tag cloud, but one tag cloud by user profile.
I find another similar restriction when I want to display a tag cloud relative to another tag. With DXL method I must generate one tag cloud by couple of tags. It's not be very good if I have a lot of tags. For example, with only 10 tags I must generate 90 tags cloud (10 * 9).

Like I write it, I think the three solutions are very interresting. It depends of the context and what you need to do. The DXL solution is the most interresting for classic usage of tags cloud. For specific usage, the two first solution can be better or simplier.

Anonymous said...

I did a similar thing for the Lotusphere sessions database:

http://www.dominux.co.uk/dominuxblog.nsf/d6plinks/ABEL-6K9S7W

http://www.dominux.co.uk/dominuxblog.nsf/plinks/ABEL-6K9S3T

Andrés said...

I thougth you could find this article interesting...

http://www.microgestion.com/AJAXDXL_eng.html

Hope you like it...

Regards,

Andrés.