NAME
Formatter::FOAFKnows::vCard - Formatter to create simple foaf:knows records from vCards
SYNOPSIS
use Formatter::FOAFKnows::vCard;
# read a vCard file into $data
my $formatter = Formatter::FOAFKnows::vCard->format($data, (uri => 'uri#me'));
print $formatter->fragment;
DESCRIPTION
This module takes a vCard string parses it using Text::vCard and attempts to make foaf:knows
records from it. It's scope is limited to that, it is not intended to be a full vCard to RDF conversion module, it just wants to make reasonable knows records of your contacts.
It is also conservative in what it outputs. If a vCard contains a "CONFIDENTIAL" class, it will write nothing, and unless a there is a "PUBLIC" class, it will only output the SHA1-hashed mailbox, a nick if it exists and a homepage if it exists. A discussion of these issues will appear in this module later.
METHODS
This module conforms with the Formatter API specification, version 0.93, with a slight extension that may appear in later versions of the specification.
format($string, (uri =
your_uri) )>-
The format function that you call to initialise the formatter. It takes the plain text as a string argument and returns an object of this class. In the present implementation, it does pretty much all the parsing and building of the output, so this is the only really expensive call of this module.
In addition to the string, it can take a hash containing an
uri
key. If you want to build a full document, you may use this to specify your canonical URI, the URI that represents you. This is to identify you as a person. document([$charset])
-
This will return a full RDF document. The FOAF knows records will be wrapped in a Person element, which has to represent you somehow, see above.
fragment
-
This will return the FOAF knows records.
links
-
Will return all links found the input plain text string as an arrayref. The arrayref will for each element contain keys url and title, the former containing the URL, the latter the full name of the person if it exists.
title
-
Is meaningless for vCards, so will return
undef
.
BUGS/TODO
This is presently an alpha release. It should do most things OK, but it is only tested on my own KAddressbook files, and works there. On other files, it may not produce good results, in fact, it may even croak on data it doesn't understand.
Also, it is problematic to produce a full FOAF document, since the vCard has no concept at all of who knows all these folks. I have tried to approach this by allowing the URI of the person to be entered, but I don't know if this is workable.
Feedback is very much appreciated.
SEE ALSO
Text::vCard, http://www.foaf-project.org/
AUTHOR
Kjetil Kjernsmo, <kjetilk@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2005 by Kjetil Kjernsmo
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 202:
You forgot a '=back' before '=head1'