NAME
XTM::AsTMa - Topic Map Parsing of AsTMa instances.
SYNOPSIS
# reading a topic map description from a file/url
$atm = new XTM::AsTMa (file => 'mymap.atm');
$tm = $atm->sync_in();
DESCRIPTION
This package provides parsing functionality for AsTMA instances as described in the package documentation (doc directory) or at
http://topicmaps.bond.edu.au/astma/Currently, only AsTMa= is supported, with the following constraints/additions:
- no macro support
-
This feature was experimental and is now deprecated.
- following directives are supported:
-
- %cancel
-
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.
- %log [ message ]
-
Writes a line to STDERR reporting the line number and an optional message. Useful for debugging.
- %name [ name ]
-
Adds a name attribute to the topic map.
- %encoding [ encoding ]
-
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: It is still not allowed to use several name : encoding clauses.
Note: If no encoding is provided, utf8 is assumed.
- %auto_complete [ on/off ]
-
Turns on/off auto completion.
Note: topics which have been mentioned in a 'is-reified-by' clause will be always generated.
A directive can be inserted anywhere in the document but must be at the start of a line.
INTERFACE
Constructor
The constructor expects a hash as parameter containing one of the following fields:
- url:
-
If given, then the AsTMa instance will be read from this url.
- file:
-
If given, then the AsTMa data will be read from this file (This is just a convenience function as it will be mapped to url).
- text:
-
If given, then the AsTMa instance will be read directly from this text.
- auto_complete
-
If set to 0, the AsTMa loader will NOT try to automatically generate topics which have been mentioned without being declared.
Note: topics which have been mentioned in a 'is-reified-by' clause will be always generated.
If several fields (file
, url
, text
) are specified, it is undefined which one will be taken.
Examples:
$atm = new XTM::AsTMa (file => 'here.atm');
$atm = new XTM::AsTMa (url => 'file:here.atm', # the same
auto_complete => 0); # but with auto_completion turned off
$atm = new XTM::AsTMa (text => '# this is AsTMa');
Methods
last_mod
-
$time = $atm->last_mod
returns the UNIX time when the resource has been modified last.
undef
is returned if the result cannot be determined. sync_in
-
$tmmemory = $atm->sync_in
loads an AsTMa instance and returns a XTM::Memory object. Note that that all undefined topics will be defined automatically, unless
auto_complete
is set to 0.The only optional parameter is
consistency
. It will be used when building the map while reading the AsTMa instance. See XTM for details. sync_out
-
is not implemented.
SEE ALSO
AUTHOR INFORMATION
Copyright 200[1-2], Robert Barta <rho@telecoma.net>, 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