TM::Serializable::LTM(3pm) User Contributed Perl Documentation TM::Serializable::LTM(3pm)NAME
TM::Serializable::LTM - Topic Maps, trait for parsing of LTM instances.
SYNOPSIS
# this is not an end-user package
# see the source of TM::Materialized::LTM
DESCRIPTION
This package provides parsing functionality for LTM 1.3 instances with the exceptions listed below. LTM 1.3 is backwards compatible with
version 1.2. As LTM 1.3 is not yet public, please contact the author (Lars M. Garshol) for a copy.
http://www.ontopia.net/download/ltm.html
Deviations from the LTM Specification
comments:
The parser does NOT recognizes nested comments. Any closest following */ sequence terminates a comment. The parser does also not
distinguish between comments within or outside strings.
Justification: Speed of parsing and complexity of the parser.
scope:
Only exactly ONE topic can be specified for a scope.
Justification: Multiple topics per scope are allowed by the standard, but are undefined in their semantics. The underlying TM
representation does NOT allow for multiple topics per scope.
variants
Variants are currently not supported. This also includes sort names and display names.
Justification: Will be added later.
syntax
Any number of statements are allowed in LTM files (also 0).
Justification: There is no reason to do otherwise.
TOPICMAP directive
This is currently not implemented.
Justification: There are better ways to do that.
MERGEMAP directive
The HyTime, ISO13250 format is not implemented as there is currently no driver in the TM suite.
Justification: As long as there is no interest (read: bribe money), it never will.
BASEURI directive
BASEURI is currently not honored for all local URIs.
Justification: I do not understand its purpose.
encoding
This is currently ignored.
Justification: Will be added later.
Subject Locators
It is a violation to use more than one subject locator per topic.
Justification: This is enforced by the underlying model.
Source Locators
No source locators are created.
Justification: There is no such concept (thankfully) in the TM suite.
role type:
If a role is not specified, it will remain default to "thing" and not - as the specification mandates - will be substituted by the
topic type.
Justification: First, a topic might have several types (which one to use?), secondly there might be several topics in a member and
thirdly, a role should generally NOT be the type of a member.
Notes
Merging
The parser (like any other in the TM suite) does NOT perform merging automatically. You have to trigger that explicitely with the
method "consolidate".
MERGEMAP directive
The strings determining the format are checked case-insensitive, so ASTMA and AsTMa are treated equally.
The location of the map can be defined via any URI handled by LWP::Simple. If no scheme is provided file: will be assumed.
INTERFACE
Methods
deserialize
This method tries to parse the passed in text stream as LTM instance. It will raise an exception on the first parse error.
serialize
This is not implemented.
SEE ALSO
TM
AUTHOR INFORMATION
Copyright 200[1-6], Robert Barta <drrho@cpan.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
perl v5.10.1 2008-06-12 TM::Serializable::LTM(3pm)
Check Out this Related Man Page
TM::Serializable::CSV(3pm) User Contributed Perl Documentation TM::Serializable::CSV(3pm)NAME
TM::Serializable::CSV - Topic Maps, trait for parsing (and later dumping) CSV stream
SYNOPSIS
# 1) bare bones
my $tm = .....; # get a map from somewhere (can be empty)
Class::Trait->apply ($tm, "TM::Serializable::CSV");
use Perl6::Slurp;
$tm->deserialize (slurp 'myugly.csv');
# 2) exploiting the timed sync in/out mechanism
my $tm = new TM::.... (url => 'file:myugly.csv'); # get a RESOURCEABLE map from somewhere
$tm->sync_in;
DESCRIPTION
This trait provides parsing and dumping from CSV formatted text streams.
INTERFACE
Methods
deserialize
$tm->deserialize ($text)
This method consumes the text string passed in and interprets it as CSV formatted information. What topic map information is generated,
depends on the header line (the first line):
o If the header line contains a field called "association-type", then all rows will be interpreted as assertions. In that the
remaining header fields (in that order) are interpreted as roles (role types). For all rows in the CSV stream, the position where
the "association-type" field was is ignored. The other fields (in that order) are affiliated with the corresponding roles.
Example:
association-type,location,bio-unit
is-born,gold-coast,rumsti
is-born,vienna,ramsti
Scoping cannot be controlled. Also all players and roles (obviously) are directly interpreted as identifiers. Subject identifiers
and locators are not (yet) implemented.
o If the header line contains a field called "id", then all further rows will be interpreted as topic characteristics, with each
topic on one line. The column position where the "id" field in the header is will be interpreted as toplet identifier.
All further columns will be interpreted according to the following:
o If the header column is named "name", the values will be used as topic names.
o Otherwise if the value looks like a URI, an occurrence with that URI value will be be added to the topic.
o Otherwise an occurrence with a string value will be added to the topic.
Example:
name,id,location,homepage
"Rumsti",rumsti,gold-coast,http://rumsti.com
"Ramsti",ramsti,vienna,http://ramsti.com
serialize
$tm->serialize
[Since TM 1.53] This method serializes a fragment of a topic map into CSV. Which fragment can be controlled with the header line and
options (see constructor).
"header_line" (only for serialization)
This string contains a comma separated list (CSV parseable) of headings. If one of the headings is "association-type", then the
generated CSV content will contain associations only. Nothing else is implemented yet. The other headings control which roles (and
in which order) should be included in the CSV content. If a particular role type has more than one player, then all players are
included.
NOTE: As this is inconsistent, this will have to change.
"type" (only for serialization)
If existing, then this controls which association type is to be taken.
"baseuri" (only for serialization)
If existing and non-zero, the base URI of the map will remain in the identifiers. Otherwise it will be removed.
"specification"
If existing (and when selecting only associations), this specification will be interpreted in the sense of "asserts" (see TM).
Example:
$tm->serialize (header_line => 'association-type,location,bio-unit',
type => 'is-born',
baseuri => 0);
SEE ALSO
TM, TM::Serializable
AUTHOR INFORMATION
Copyright 2010 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
perl v5.10.1 2012-06-05 TM::Serializable::CSV(3pm)