|Title|Link categories
|Date|27-Aug-2006 01:17:29 EEST
|JSPWiki version|2.2.33++
|Submitter|81.34.154.160
|[Idea Category]|GenericIdea
|Reference|
|[Idea Status]|NewIdea

Being able to categorize links in a Wiki when organizing information is something that I would find really interesting. 

For instance, I have defined several link prefixes to represent different kinds of relationships between Wiki entries (as in WordWeb/WordNet, for instance). Formally, I defined the following kinds of links:

|| Link type || Description
| [[ref$topic] | References (e.g. bibliographic sources)
| [[alias$topic] | Synonyms, aliases
| [[isa$topic] | Hiponyms/Hypernyms, ISA relationships (i.e. subsets)
| [[sub$topic] | Meronyms/Holonyms, HASA relationships (i.e. part-whole relation)

A more detailed description about these kinds of relationships (and others) can be found in "Introduction to WordNet: An On-line Lexical Database" ([http://www.idi.ntnu.no/emner/dif8916/5papers.pdf]).


In order to use such prefixes, I just had to tweak the JSPWiki implementation of the handleHyperlinks() method in the TranslatorReader class, so that prefixes are not considered by the ReferenceManager:

{{{
  // It's an internal Wiki link
                                
  // HACK Link types [type$link]
                
  int linktypepoint = reallink.indexOf("$");
  reallink = reallink.substring( linktypepoint+1 );
                
  // As before...
                        
  reallink = cleanLink( reallink );
}}}


I also had to modify the makeLink() method in JSPWiki HTMLRenderer class, in order to avoid the display of the link prefixes, as follows:

{{{
  public String makeLink 
     (int type, String link, String text, String section)
  {
    String result;

    if( text == null ) text = link;
            
    // HACK Link types [type$link]
            
    int linktypepoint = text.indexOf("$");
    text = text.substring( linktypepoint+1 );
  
    // ...
}}}

Before this, I simulated link types as interWiki links, although this had the collateral effect of corrupting the uninteresting entries in the undefined pages list (and it also could affect the behavior of other plugins). In contrast, the solution using prefixes seems to work perfectly and it also has the benefit of being flexible (so that anybody could define and use his/her own prefixes with little effort, without having to modify the jspwiki.properties file).

At least for me, this hack is useful to properly deal with "knowledge snippets" and organize ideas, problem reports, FAQs... Using such prefixes, I can also use Wiki as a fact database in order to track references, making a simple requirements management tool of JSPWiki.

I would certainly like to see a similar feature included in future versions of JSPWiki.

-- Fernando Berzal (fberzal@gmail.com)

PS: Some additional plugins would also be useful, as a ReferredPagesPlugin extension to track, visualize, and organize links taking into account their types.