TM::Overview(3) Topic Maps, Overview


The TM suite of packages allows you to read and modify data organized according to the Topic Map paradigm. It includes some drivers to read TM content from files, such as LTM or AsTMa=, but also a way to synchronize with MLDBM data files.

The core functionality is enhanced in several ways: bulk transfer of TM content into your application, treating a set of maps as another map (mapsphere), map statistics and analysis, and converting a map taxonomy into a tree. There is also a way to index an existing map.

The distribution also provides packages to handle 'virtual' topic maps, i.e. wrappers around other resources which can be accessed via a TM interface and a set of backend technologies to make topic maps persistent. There is also nascent support of a TMQL-like query language. There is also an experimental TMDM-layer.


The set of classes and traits has evolved over several development stages and can be regarded as failry stable.

TM Core

At the core sits the class TM. This class implements a memory-based topic map store. With it, you can instantiate maps, fill them with content and extract it again using direct access methods for topic-like and association-like information. Its implementation paradigm is actually not TMDM, but the much more low-level TMRM. According to that a map consists mostly of assertions which are light-weight associations. With these, associations, topic names and occurrences are implemented. The topics themselves are collaps in this model to simple focal points carrying only subject locator and subject indicator information.

The search functionality is quite minimalistic, mostly provided by the functions "match_forall" and "match_exists".

TM Traits

The core functionality is extensible in many, many different ways. To allow a developer precise control over what he needs, these extensions are written as traits, i.e. a set of methods which can be added ad libitum to a TM object. Or, alternatively, you can create your own subclass of TM and mixin these traits as they suit you.

Here are some of the more interesting traits:

With it you can not only attach a map to an external resource (this is actually done by another trait TM::ResourceAble), but also have methods to synchronize in (loading map content from the resource into memory) and synchronize out (saving map content to the resource).

Some resources are serializable, i.e. the content is stored as a sequence of characters (symbols). Examples are LTM, AsTMa, XTM, etc. files. For each of these exists parsers, usually tucked away in packages such as TM::Serializable::AsTMa, TM::Serializeable::LTM, etc. Since some formats are more popular, dedicated classes for these exist: TM::Materialized::AsTMa, TM::Materialized::LTM, and so forth.

Some resources are not serializable, but they are still synchronizable. One example of this is TM::Synchronizable::MLDBM which allows you to dump the whole map content into a MLDBM file.

TM::Analysis, TM::Tree
These packages allow you to compute some statistics of a map, but also to find the connected island, i.e. those parts of a map which are somehow linked together with associations. The tree package can analyze a map in respect to an inherent tree structure. One example are family trees.
Since maps can store any information about the real world, they can also store information about other maps. In this sense you can embed maps into other maps. Here this is done by having one topic representing an embedded map. From then you can easily added meta-information about embedded maps, such as authorship, access control, etc.

If you organize this hierarchically, then you end up with a tree of maps: The top-level map contains various things, among them child maps. And each of these children can link to further maps. In a sense this is a complete TM repository into which you can add maps (mount) and remove complete maps (umount).

Especially when building web frontends for TM servers, the communication events have to be minimized. With TM::Bulk it is possible to learn a lot from a topic, instead of querying numerous times. There is also a first lookup function for names.


Using a naive in-memory representation can be quite slow if you map gets big and the retrieval more complex. To improve the performance instances of TM::Index can be associated with the map. See for the subclasses TM::Index::Match, TM::Index::Characteristics, TM::Index::Reify.

[from v1.54]: There is now a trait TM::IndexAble which you can attach to an existing map to get index support (experimental).


The low-level data structures are not exactly what most application developers would expect when they come across Topic Maps. They are more familiar with the high-level TMDM. The package TM::DM tries to emulate this behaviour as closely as possible.

Tau Expressions

Still quite experimental (but cool) are Tau expressions which allow you to combine maps in various ways, not just add them together for merging. One example would be the expression

  file:test.atm > file:test.xtm

which - when evaluated - will try to read AsTMa= content from the file "test.atm" and will try to save an XTM version of it into "test.xtm". More elaborate examples involve filtering:

  file:test.atm * urn:tau:statistics > io:stdout

That would take the map from "test.atm" and would apply the converter "urn:tau:statistics" to it to compute the statistics of the map. The statistical information is represented as map as well; it will then be copied to STDOUT (which is default anyway).

Tau expressions can also include TMQL queries and support any number of different formats (these are pluggable at compile and at run time).

Workbench tm

The distribution contains one 'binary' "tm". It is a command-line oriented interface to manage topic map content. With it you can copy map, query them (soon) and transform them. The interface also introduces one global store, a mapsphere into which you can save one or more maps.

Tutorial: In-memory maps


Tutorial: Associating Resources


Tutorial: Adding Indices


Tutorial: Analyzing Maps


Tutorial: Managing MapSpheres


Tutorial: Tau Expressions



Copyright 200[3-6] by Robert Barta, <[email protected]>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.