Topic maps, overview
The \s-1TM\s0 suite of packages allows you to read and modify data organized according to the Topic Map paradigm. It includes some drivers to read \s-1TM\s0 content from files, such as \s-1LTM\s0 or AsTMa=, but also a way to synchronize with \s-1MLDBM\s0 data files.
The core functionality is enhanced in several ways: bulk transfer of \s-1TM\s0 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 \s-1TM\s0 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.
At the core sits the class \s-1TM\s0. 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 \s-1TMDM\s0, but the much more low-level \s-1TMRM\s0. 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 \*(C`match_forall\*(C' and \*(C`match_exists\*(C'.
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 \s-1TM\s0 object. Or, alternatively, you can create your own subclass of \s-1TM\s0 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 \s-1LTM\s0, AsTMa, \s-1XTM\s0, 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 \s-1MLDBM\s0 file.
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 \s-1TM\s0 repository into which you can add maps (mount) and remove complete maps (umount).
Especially when building web frontends for \s-1TM\s0 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 \s-1TMDM\s0. The package \s-1TM::DM\s0 tries to emulate this behaviour as closely as possible.
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 \*(C`test.atm\*(C' and will try to save an \s-1XTM\s0 version of it into \*(C`test.xtm\*(C'. More elaborate examples involve filtering:
file:test.atm * urn:tau:statistics > io:stdout
That would take the map from \*(C`test.atm\*(C' and would apply the converter \*(C`urn:tau:statistics\*(C' to it to compute the statistics of the map. The statistical information is represented as map as well; it will then be copied to \s-1STDOUT\s0 (which is default anyway).
Tau expressions can also include \s-1TMQL\s0 queries and support any number of different formats (these are pluggable at compile and at run time). The distribution contains one 'binary' \*(C`tm\*(C'. 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.
@@@
@@@
@@@
@@@
@@@
@@@
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.