Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

tm::serializable::ltm(3pm) [debian man page]

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::DM(3pm)						User Contributed Perl Documentation					       TM::DM(3pm)

NAME
TM::DM - Topic Maps, read-only TMDM layer SYNOPSIS
# somehow acquire a map (see TM and its subclasses) my $tm = .... # put a TMDM layer on top of it use TM::DM; my $tmdm = new TM::DM (map => $tm); # get the TMDM topic map item my $topicmap = $tmdm->topicmap; # ask for all topics my @topics = $topicmap->topics; # for all associations my @assocs = $topicmap->associations; # get a particular topic my $adam = $topicmap->topic ('adam'); # get some of its properties $adam->id; $adam->subjectLocators; $adam->subjectIdentifiers; $adam->parent; my @ns = $adam->names; my @os = $adam->occurrences; # similar for assocs my @as = $topicmap->associations (iplayer => 'adam'); $as[0]->type; $as[0]->parent; my @rs = $as[0]->roles; ABSTRACT
This package provides a TMDM-ish (read-only) view on an existing topic map. DESCRIPTION
TMDM, the Topic Maps Data Model http://www.isotopicmaps.org/sam/sam-model/ is the ISO standard for the high-level model for Topic Maps. TMDM Concepts TMDM's main concepts are the topic map item containing any number of topic and association items topic item containing any number of names, occurrence items, subject locators and subject identifiers association item containing a type, a scope and any number of role items name item containing a string, a type and a scope occurrence item containing a data value (together with its data type), a type and a scope role item containing a type and a player All items have an item id and all (except the map) have a parent which links back to where the item belongs. This package implements for each of the above a class and access methods to retrieve actual structure and values from an existing map. Nota bene, there are some deviations from TMDM: o only ONE identifier per item is supported o at most ONE subject locator per topic is supported o no variants are supported (might be added at some stage, poke me) o a scope consists only of a single topic o role items do not have an identity, so they also cannot be reified Modus Operandi Before you can use the TMDM layer, you need TM information in the form of a TM object. Any subclass should do, materialized and non- materialized maps should both be fine. Only with such a map you can instantiate a TMDM layer: use TM::Materialized::AsTMa; my $tm = new TM::Materialized::AsTMa (file => 'test.atm'); use TM::DM; my $tmdm = new TM::DM (map => $tm); Probably the first thing you need to do is to get a handle on the whole topic map: my $topicmap = $tmdm->topicmap; That is delivered as an instance of TM::DM::TopicMap as described below. From there you start to extract topics and associations and that way you then further drill down. Implementation Notes This implementation only supports reading map information, not changing it or modifying the structure of the map. Not that it is impossible to do, but many applications get their map content from elsewhere and a read/write interface is an overkill in these cases. All objects generated here are ephemeral, i.e. they are only instantiated because you wanted the map information embedded into them. This implies that if you ask for one and the same topic twice, you are getting two copies of the topic information. The following will not work as expected: my $t0 = $topicmap->topic ('adam'); my $t1 = $topicmap->topic ('adam'); warn "have the same topic!" if $t0 == $t1; This will work: warn "have the same topic!" if $t0->id eq $t1->id; INTERFACES
TM::DM The TM::DM class itself does not offer much functionality itself. It only keeps the connection to the background map. Constructor The constructor expects exactly one parameter, namely the background map. $tmdm = new TM::DM (map => $tm) Methods topicmap $topicmap = $tmdm->topicmap This method generates a Topic Map item. See TM::DM::TopicMap . TM::DM::TopicMap This class provides access to all TMDM properties: id This returns the item identifier. topics @topics = $topicmap->topics (@list-of-ids) @topics = $topicmap->topics @topics = $topicmap->topics ($selection-spec) This method expects a list containing topic valid identifiers and returns for each of the topics a "TM::DM::Topic" reference. If any of the input identifiers do not denote a valid topic in the map, undef will be returned in its place. If the parameter list is empty, all topics will be returned. Have fun, I mean, use with care. Examples: # round tripping topic ids print map { $_->id } $topicmap->topics ('abel', 'cain' ); print "he again" if $topicmap->topics ('god'); If a selection is specified then the same language as in TM (method "toplets") can be used. associations @as = $topicmap->associations @as = $topicmap->associations (%search_spec); This method retrieves the list of ALL associations when it is invoked without a search specification. See TM for that. reifier This returns the topic item which reifies the association. "undef" is returned if there is none. topic This returns a topic item with that id. This method will die if the id is invalid. Note that always new copies are made. TM::DM::Topic subjectLocators Returns the (only) subject locator (URI string) in the topic item or "undef" if there is none. subjectIdentifiers Returns a list of URI strings. Might be empty. id Returns the item id. parent Returns a TM::DM::TopicMap item in which this topic is embedded. names @names = $topic->names Returns a list of TMDM name items. occurrences @occurrences = $topic->occurrences Returns a list of TMDM occurrences items. roles @roles = $topic->roles Returns a list of TM::DM::Role items where this topic plays any role. TM::DM::Association id Returns the item id. type Returns a TM::DM::Topic item which is the type of the association. This is always defined. scope Returns the scope of the association in the form of a single TM::DM::Topic item. This is always defined as for the unconstrained scope the topic "us" is used (see TM::PSI). roles @roles = $assoc->roles Returns a list of roles of the association. Each role is a TM::DM::Role item. parent Returns a TM::DM::TopicMap item for the embedding map. reifier Returns a TM::DM::Topic item if this association is reified. "undef" otherwise. TM::DM::Occurrence id Returns the item id. value Returns the value (together with the data type) in the form of a TM::Literal object. type Returns a TM::DM::Topic item which is the type of the occurrence. This is always defined. scope Returns the scope of the occurrence in the form of a single TM::DM::Topic item. This is always defined. reifier Returns a TM::DM::Topic item if this occurrence is reified. "undef" otherwise. parent Returns the TM::DM::Topic item of the topic where this occurrence is part of. TM::DM::Name id Returns the item id. value Returns the string value of the name. type Returns a TM::DM::Topic item which is the type of the name. This is always defined. scope Returns the scope of the name in the form of a single TM::DM::Topic item. This is always defined. reifier Returns a TM::DM::Topic item if this name is reified. "undef" otherwise. parent Returns the TM::DM::Topic item of the topic where this name is part of. TM::DM::Role player Returns a TM::DM::Topic item for the topic which is the player in this role. type Returns a TM::DM::Topic item for the topic which is the type of this role. parent Returns a TM::DM::Association item of the association where this role is in. SEE ALSO
TM, TM::Easy COPYRIGHT AND LICENSE
Copyright 200[68] by Robert Barta, <drrho@cpan.org> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2008-05-07 TM::DM(3pm)
Man Page