.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.14) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "TM::DM 3pm" .TH TM::DM 3pm "2008-05-07" "perl v5.10.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" TM::DM \- Topic Maps, read\-only TMDM layer .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # 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 (\*(Aqadam\*(Aq); \& \& # 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 => \*(Aqadam\*(Aq); \& $as[0]\->type; \& $as[0]\->parent; \& my @rs = $as[0]\->roles; .Ve .SH "ABSTRACT" .IX Header "ABSTRACT" This package provides a TMDM-ish (read-only) view on an existing topic map. .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\s-1TMDM\s0, the Topic Maps Data Model .PP .Vb 1 \& http://www.isotopicmaps.org/sam/sam\-model/ .Ve .PP is the \s-1ISO\s0 standard for the \fIhigh-level\fR model for Topic Maps. .SS "\s-1TMDM\s0 Concepts" .IX Subsection "TMDM Concepts" \&\s-1TMDM\s0's main concepts are the .IP "\fItopic map item\fR" 4 .IX Item "topic map item" containing any number of topic and association items .IP "\fItopic item\fR" 4 .IX Item "topic item" containing any number of names, occurrence items, subject locators and subject identifiers .IP "\fIassociation item\fR" 4 .IX Item "association item" containing a type, a scope and any number of role items .IP "\fIname item\fR" 4 .IX Item "name item" containing a string, a type and a scope .IP "\fIoccurrence item\fR" 4 .IX Item "occurrence item" containing a data value (together with its data type), a type and a scope .IP "\fIrole item\fR" 4 .IX Item "role item" containing a type and a player .PP All items have an \fIitem id\fR and all (except the map) have a parent which links back to where the item belongs. .PP 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 \s-1TMDM:\s0 .IP "\(bu" 4 only \s-1ONE\s0 identifier per item is supported .IP "\(bu" 4 at most \s-1ONE\s0 subject locator per topic is supported .IP "\(bu" 4 no variants are supported (might be added at some stage, poke me) .IP "\(bu" 4 a scope consists only of a single topic .IP "\(bu" 4 role items do not have an identity, so they also cannot be reified .SS "Modus Operandi" .IX Subsection "Modus Operandi" Before you can use the \s-1TMDM\s0 layer, you need \s-1TM\s0 information in the form of a \s-1TM\s0 object. Any subclass should do, materialized and non-materialized maps should both be fine. Only with such a map you can instantiate a \s-1TMDM\s0 layer: .PP .Vb 2 \& use TM::Materialized::AsTMa; \& my $tm = new TM::Materialized::AsTMa (file => \*(Aqtest.atm\*(Aq); \& \& use TM::DM; \& my $tmdm = new TM::DM (map => $tm); .Ve .PP Probably the first thing you need to do is to get a handle on the whole topic map: .PP .Vb 1 \& my $topicmap = $tmdm\->topicmap; .Ve .PP 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. .SS "Implementation Notes" .IX Subsection "Implementation Notes" This implementation only supports \fBreading\fR 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. .PP All objects generated here are \fBephemeral\fR, 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: .PP .Vb 2 \& my $t0 = $topicmap\->topic (\*(Aqadam\*(Aq); \& my $t1 = $topicmap\->topic (\*(Aqadam\*(Aq); \& \& warn "have the same topic!" if $t0 == $t1; .Ve .PP This will work: .PP .Vb 1 \& warn "have the same topic!" if $t0\->id eq $t1\->id; .Ve .SH "INTERFACES" .IX Header "INTERFACES" .SS "\s-1TM::DM\s0" .IX Subsection "TM::DM" The \s-1TM::DM\s0 class itself does not offer much functionality itself. It only keeps the connection to the background map. .PP \fIConstructor\fR .IX Subsection "Constructor" .PP The constructor expects exactly one parameter, namely the background map. .PP \&\fI\f(CI$tmdm\fI\fR = new \s-1TM::DM\s0 (map => \fI\f(CI$tm\fI\fR) .PP \fIMethods\fR .IX Subsection "Methods" .IP "\fBtopicmap\fR" 4 .IX Item "topicmap" \&\fI\f(CI$topicmap\fI\fR = \fI\f(CI$tmdm\fI\fR\->topicmap .Sp This method generates a Topic Map item. See TM::DM::TopicMap . .SS "TM::DM::TopicMap" .IX Subsection "TM::DM::TopicMap" This class provides access to all \s-1TMDM\s0 properties: .IP "\fBid\fR" 4 .IX Item "id" This returns the item identifier. .IP "\fBtopics\fR" 4 .IX Item "topics" \&\fI\f(CI@topics\fI\fR = \fI\f(CI$topicmap\fI\fR\->topics (\fI\f(CI@list\fI\-of\-ids\fR) .Sp \&\fI\f(CI@topics\fI\fR = \fI\f(CI$topicmap\fI\fR\->topics .Sp \&\fI\f(CI@topics\fI\fR = \fI\f(CI$topicmap\fI\fR\->topics (\fI\f(CI$selection\fI\-spec\fR) .Sp This method expects a list containing topic valid identifiers and returns for each of the topics a \&\f(CW\*(C`TM::DM::Topic\*(C'\fR 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, \fBall\fR topics will be returned. Have fun, I mean, use with care. .Sp Examples: .Sp .Vb 2 \& # round tripping topic ids \& print map { $_\->id } $topicmap\->topics (\*(Aqabel\*(Aq, \*(Aqcain\*(Aq ); \& \& print "he again" if $topicmap\->topics (\*(Aqgod\*(Aq); .Ve .Sp If a selection is specified then the same language as in \s-1TM\s0 (method \f(CW\*(C`toplets\*(C'\fR) can be used. .IP "\fBassociations\fR" 4 .IX Item "associations" \&\fI\f(CI@as\fI\fR = \fI\f(CI$topicmap\fI\fR\->associations .Sp \&\fI\f(CI@as\fI\fR = \fI\f(CI$topicmap\fI\fR\->associations (\fI\f(CI%search_spec\fI\fR); .Sp This method retrieves the list of \s-1ALL\s0 associations when it is invoked without a search specification. See \s-1TM\s0 for that. .IP "\fBreifier\fR" 4 .IX Item "reifier" This returns the topic item which reifies the association. \f(CW\*(C`undef\*(C'\fR is returned if there is none. .IP "\fBtopic\fR" 4 .IX Item "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. .SS "TM::DM::Topic" .IX Subsection "TM::DM::Topic" .IP "\fBsubjectLocators\fR" 4 .IX Item "subjectLocators" Returns the (only) subject locator (\s-1URI\s0 string) in the topic item or \f(CW\*(C`undef\*(C'\fR if there is none. .IP "\fBsubjectIdentifiers\fR" 4 .IX Item "subjectIdentifiers" Returns a list of \s-1URI\s0 strings. Might be empty. .IP "\fBid\fR" 4 .IX Item "id" Returns the item id. .IP "\fBparent\fR" 4 .IX Item "parent" Returns a TM::DM::TopicMap item in which this topic is embedded. .IP "\fBnames\fR" 4 .IX Item "names" \&\fI\f(CI@names\fI\fR = \fI\f(CI$topic\fI\fR\->names .Sp Returns a list of \s-1TMDM\s0 name items. .IP "\fBoccurrences\fR" 4 .IX Item "occurrences" \&\fI\f(CI@occurrences\fI\fR = \fI\f(CI$topic\fI\fR\->occurrences .Sp Returns a list of \s-1TMDM\s0 occurrences items. .IP "\fBroles\fR" 4 .IX Item "roles" \&\fI\f(CI@roles\fI\fR = \fI\f(CI$topic\fI\fR\->roles .Sp Returns a list of TM::DM::Role items where this topic plays any role. .SS "TM::DM::Association" .IX Subsection "TM::DM::Association" .IP "\fBid\fR" 4 .IX Item "id" Returns the item id. .IP "\fBtype\fR" 4 .IX Item "type" Returns a TM::DM::Topic item which is the type of the association. This is always defined. .IP "\fBscope\fR" 4 .IX Item "scope" Returns the scope of the association in the form of a single TM::DM::Topic item. This is always defined as for the \fIunconstrained scope\fR the topic \f(CW\*(C`us\*(C'\fR is used (see \s-1TM::PSI\s0). .IP "\fBroles\fR" 4 .IX Item "roles" \&\fI\f(CI@roles\fI\fR = \fI\f(CI$assoc\fI\fR\->roles .Sp Returns a list of roles of the association. Each role is a TM::DM::Role item. .IP "\fBparent\fR" 4 .IX Item "parent" Returns a TM::DM::TopicMap item for the embedding map. .IP "\fBreifier\fR" 4 .IX Item "reifier" Returns a TM::DM::Topic item if this association is reified. \f(CW\*(C`undef\*(C'\fR otherwise. .SS "TM::DM::Occurrence" .IX Subsection "TM::DM::Occurrence" .IP "\fBid\fR" 4 .IX Item "id" Returns the item id. .IP "\fBvalue\fR" 4 .IX Item "value" Returns the value (together with the data type) in the form of a TM::Literal object. .IP "\fBtype\fR" 4 .IX Item "type" Returns a TM::DM::Topic item which is the type of the occurrence. This is always defined. .IP "\fBscope\fR" 4 .IX Item "scope" Returns the scope of the occurrence in the form of a single TM::DM::Topic item. This is always defined. .IP "\fBreifier\fR" 4 .IX Item "reifier" Returns a TM::DM::Topic item if this occurrence is reified. \f(CW\*(C`undef\*(C'\fR otherwise. .IP "\fBparent\fR" 4 .IX Item "parent" Returns the TM::DM::Topic item of the topic where this occurrence is part of. .SS "TM::DM::Name" .IX Subsection "TM::DM::Name" .IP "\fBid\fR" 4 .IX Item "id" Returns the item id. .IP "\fBvalue\fR" 4 .IX Item "value" Returns the string value of the name. .IP "\fBtype\fR" 4 .IX Item "type" Returns a TM::DM::Topic item which is the type of the name. This is always defined. .IP "\fBscope\fR" 4 .IX Item "scope" Returns the scope of the name in the form of a single TM::DM::Topic item. This is always defined. .IP "\fBreifier\fR" 4 .IX Item "reifier" Returns a TM::DM::Topic item if this name is reified. \f(CW\*(C`undef\*(C'\fR otherwise. .IP "\fBparent\fR" 4 .IX Item "parent" Returns the TM::DM::Topic item of the topic where this name is part of. .SS "TM::DM::Role" .IX Subsection "TM::DM::Role" .IP "\fBplayer\fR" 4 .IX Item "player" Returns a TM::DM::Topic item for the topic which is the player in this role. .IP "\fBtype\fR" 4 .IX Item "type" Returns a TM::DM::Topic item for the topic which is the type of this role. .IP "\fBparent\fR" 4 .IX Item "parent" Returns a TM::DM::Association item of the association where this role is in. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1TM\s0, TM::Easy .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright 200[68] by Robert Barta, .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.