.\" 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::Serializable::CSV 3pm" .TH TM::Serializable::CSV 3pm "2012-06-05" "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::Serializable::CSV \- Topic Maps, trait for parsing (and later dumping) CSV stream .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& # 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 \*(Aqmyugly.csv\*(Aq); \& \& # 2) exploiting the timed sync in/out mechanism \& my $tm = new TM::.... (url => \*(Aqfile:myugly.csv\*(Aq); # get a RESOURCEABLE map from somewhere \& $tm\->sync_in; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This trait provides parsing and dumping from \s-1CSV\s0 formatted text streams. .SH "INTERFACE" .IX Header "INTERFACE" .SS "Methods" .IX Subsection "Methods" .IP "\fBdeserialize\fR" 4 .IX Item "deserialize" \&\fI\f(CI$tm\fI\fR\->deserialize (\fI\f(CI$text\fI\fR) .Sp This method consumes the text string passed in and interprets it as \s-1CSV\s0 formatted information. What topic map information is generated, depends on the header line (the first line): .RS 4 .IP "\(bu" 4 If the header line contains a field called \f(CW\*(C`association\-type\*(C'\fR, 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 \s-1CSV\s0 stream, the position where the \f(CW\*(C`association\-type\*(C'\fR field was is ignored. The other fields (in that order) are affiliated with the corresponding roles. .Sp Example: .Sp .Vb 3 \& association\-type,location,bio\-unit \& is\-born,gold\-coast,rumsti \& is\-born,vienna,ramsti .Ve .Sp Scoping cannot be controlled. Also all players and roles (obviously) are directly interpreted as identifiers. Subject identifiers and locators are not (yet) implemented. .IP "\(bu" 4 If the header line contains a field called \f(CW\*(C`id\*(C'\fR, then all further rows will be interpreted as topic characteristics, with each topic on one line. The column position where the \f(CW\*(C`id\*(C'\fR field in the header is will be interpreted as toplet identifier. .Sp All further columns will be interpreted according to the following: .RS 4 .IP "\(bu" 4 If the header column is named \f(CW\*(C`name\*(C'\fR, the values will be used as topic names. .IP "\(bu" 4 Otherwise if the value looks like a \s-1URI\s0, an occurrence with that \s-1URI\s0 value will be be added to the topic. .IP "\(bu" 4 Otherwise an occurrence with a string value will be added to the topic. .RE .RS 4 .Sp Example: .Sp .Vb 3 \& name,id,location,homepage \& "Rumsti",rumsti,gold\-coast,http://rumsti.com \& "Ramsti",ramsti,vienna,http://ramsti.com .Ve .RE .RE .RS 4 .RE .IP "\fBserialize\fR" 4 .IX Item "serialize" \&\fI\f(CI$tm\fI\fR\->serialize .Sp [Since \s-1TM\s0 1.53] This method serializes a fragment of a topic map into \s-1CSV\s0. \fBWhich\fR fragment can be controlled with the \fIheader line\fR and options (see constructor). .RS 4 .ie n .IP """header_line"" (only for serialization)" 4 .el .IP "\f(CWheader_line\fR (only for serialization)" 4 .IX Item "header_line (only for serialization)" This string contains a comma separated list (\s-1CSV\s0 parseable) of headings. If one of the headings is \&\f(CW\*(C`association\-type\*(C'\fR, then the generated \s-1CSV\s0 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 \s-1CSV\s0 content. If a particular role type has more than one player, then \fBall\fR players are included. .Sp \&\fB\s-1NOTE\s0\fR: As this is inconsistent, this will have to change. .ie n .IP """type"" (only for serialization)" 4 .el .IP "\f(CWtype\fR (only for serialization)" 4 .IX Item "type (only for serialization)" If existing, then this controls which association type is to be taken. .ie n .IP """baseuri"" (only for serialization)" 4 .el .IP "\f(CWbaseuri\fR (only for serialization)" 4 .IX Item "baseuri (only for serialization)" If existing and non-zero, the base \s-1URI\s0 of the map will remain in the identifiers. Otherwise it will be removed. .ie n .IP """specification""" 4 .el .IP "\f(CWspecification\fR" 4 .IX Item "specification" If existing (and when selecting only associations), this specification will be interpreted in the sense of \f(CW\*(C`asserts\*(C'\fR (see \s-1TM\s0). .RE .RS 4 .Sp Example: .Sp .Vb 3 \& $tm\->serialize (header_line => \*(Aqassociation\-type,location,bio\-unit\*(Aq, \& type => \*(Aqis\-born\*(Aq, \& baseuri => 0); .Ve .RE .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1TM\s0, TM::Serializable .SH "AUTHOR INFORMATION" .IX Header "AUTHOR INFORMATION" Copyright 2010 Robert Barta. .PP 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