Chapter 7. TM4J Utilities

Table of Contents

Introduction
Testers
Extractors
XTMUtils
Making a Topic Map Consistent
TopicMapDoclet
Invoking the TopicMapDoclet
Other Utility Classes
AssociationUtils
BaseNameUtils
ScopeUtils
TopicMapFragment

Introduction

The package org.tm4j.topicmap.utils contains a variety of useful classes for working with topic map information. Making use of the classes provided here can seriously reduce the amount of time it takes to develop a topic map application.

One major feature of the TM4J utilities package is the provision of a set of functional objects using the Mango library. The Mango library provides a C++-like set of generic algorithms and functions, and TM4J provides some application-specific implementations which can be used for operations such as testing the type of a topic map object or creating a name for display in a user interface. Because these utility functions are implemented as separate classes using the Mango framework, it is very easy to combine the functions you need with the generic functions and iterator classes of the Mango library. At first, programming in this "functional" style can be a little bit confusing - but stick with it and you will quickly find that it takes a lot of the repetitive pain out of writing iterators and basic collection manipulation tasks which tend to be a major part of developing a topic map processing application.

The majority of these functional classes are divided between the testers and the extractors, each of which are defined in their own separate package (org.tm4j.topicmap.utils.testers and org.tm4j.topicmap.utils.extractors, respectively). In this chapter these utility classes are described in more detail.