The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

TM::Serializable::XTM - Topic Maps, trait for parsing and dumping XTM instances.

SYNOPSIS

  # this is not an end-user package
  # see the source in TM::Materialized::XTM how this can be used

DESCRIPTION

This trait provides parsing and dumping functionality for XTM instances.

Version 1.0 : http://www.topicmaps.org/xtm/index.html
Version 2.0 : http://www.isotopicmaps.org/sam/sam-xtm/

Limitations

  • only a single <topicMap> is allowed in one instance, there is no support for multiple maps per document

  • only a single scope is allowed for (base)names, occurrences and associations.

TODOs

  • <mergeMap> is handled, but any scoping topic is ignored. This is related to the above. If you use it, it may be a design flaw anyway.

  • At this stage, you can only include other XTM instances with <mergeMap>, not AsTMa= or LTM. This may be fixed in the future.

  • variants

  • reification of topic map

INTERFACE

Methods

deserialize

This method takes an XTM string and tries to parse it. It will raise an exception on parse error. The if a version attribute exists, then the value

serialize

This method serializes the map object into XTM notation and returns the resulting string. It will raise an exception if the object contains constructs that XTM cannot represent. The result is a standard Perl string, so you may need to force it into a particular encoding.

The method understands a number of key/value pair parameters:

omit_trivia (default: 0)

This option suppresses the output of topics without any characteristics.

version (default: 2.0)

This option controls whether XTM 1.0 or XTM 2.0 (default) is generated.

SEE ALSO

TM, TM::Serializable

AUTHOR INFORMATION

Copyright 200[78] Alexander Zangerl, Robert Barta.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. http://www.perl.com/perl/misc/Artistic.html