TM::Serializable::AsTMa - Topic Maps, trait for parsing AsTMa instances.
# this is not an end-user package # see the source in TM::Materialized::AsTMa how this can be used
This trait provides parsing functionality for AsTMa= instances. AsTMa= is a textual shorthand notation for Topic Map authoring. Currently, AsTMa= 1.3 and the (experimental) AsTMa= 2.0 is supported.
This follows the specification: http://astma.it.bond.edu.au/authoring.xsp with the following constraints/additions:
Cancels the parse process on this very line and ignores the rest of the AsTMa instance. Useful for debugging faulty maps. There is an appropriate line written to STDERR.
Writes a line to STDERR reporting the line number and an optional message. Useful for debugging.
Specifies which encoding to use to interpret the following text. This implies that this directive may appear several times to change the encoding. Whether this is a good idea in terms of information management, is a different question.
NOTE: If no encoding is provided, utf8 is assumed.
For debugging purposes you can turn on tracing by specifying an integer level. Level
0 means no tracing, level
1 shows a bit more, and so forth.
NOTE: This is not overly developed at the moment, but can be easily extended.
A directive can be inserted anywhere in the document but must be at the start of a line.
It follows the specification on http://astma.it.bond.edu.au/astma=-spec-2.0r1.0.dbk with the following changes:
This method take a string and tries to parse AsTMa= content from it. It will raise an exception on parse error. On success, it will return the map object.
This method serialized the map object into AsTMa notation and returns the resulting string. It will raise an exception if the object contains constructs that AsTMa 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:
Which AsTMa version the result should conform to. Currently only version
1 is supported.
This option suppresses the output of completely naked toplets (toplets without any characteristics).
This option suppresses the output of infrastructure toplets.
If set, no mentioning of where the content came from is added.
[v1.54] Switches on tracing in the generated AsTMa code. The trace level can be controlled via the value of this option.
Copyright 200[1-68], Robert Barta <email@example.com>, Alexander Zangerl <firstname.lastname@example.org>, All rights reserved.
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