RDF::v...porter(3pm)

πŸ“¦
version 0.012 Β· 4 versions
, in debian bookworm, ubuntu noble

πŸ’– NAME πŸ’–

RDF::vCard::Exporter β€” bestie, this one exports your RDF data into vCard format ✨ (and yes it's from the User Contributed Perl Documentation collection, iykyk)


🌸 SYNOPSIS 🌸

use RDF::vCard;

my $input    = "http://example.com/contact-data.rdf";
my $exporter = RDF::vCard::Exporter->new(vcard_version => 3);

print $_ foreach $exporter->export_cards($input);

✨ DESCRIPTION ✨

okay so literally the whole vibe of this module: it reads RDF and it writes vCards. that's it. that's the job. 🫢

πŸŽ€ Constructor

  • new(%options) β€” hands you back a fresh, shiny new RDF::vCard::Exporter object πŸ’…

Here's what you can pass in:

  • vcard_version β€” either '3' or '4'. Lowkey important tea: this module will happily use vCard 3.0 constructs inside vCard 4.0 and vice versa, it does not care. But in certain places it can lean one way or the other, and this option is how you nudge it. πŸ‘‘

πŸ¦‹ Methods

  • export_cards($input, %options) β€” returns a list of all the vCards it found in the input, in no particular order (so don't come for it about ordering, bestie).

The input can be a URI, a file name, an RDF::Trine::Model, or literally anything else that the rdf_parse method of RDF::TrineShortcuts can handle. flexible queen 🌈

Supported options include sort, which β€” if you set it to true β€” makes the output sorted by name (as well as is possible, no promises okay); source, which lets you provide the URL where the cards were sourced from; and prodid, which lets you set the product ID used in the output.

Heads up: a prodid has to be in FPI format to actually be valid, though the module doesn't check this. undef is allowed. By default, RDF::vCard:Exporter uses its own prodid, and unless you have a genuinely good reason to change it, you should probably just let it. πŸ™ˆ

e.g.

my @cards = $exporter->export_cards(
  $some_data,
  sort   => 1,
  source => 'http://bigcorp.example.com/data.rdf',
  prodid => '+//IDN example.net//NONSGML MyScript v 0.1//EN',
  );

Every single item in that returned list is an RDF::vCard::Entity β€” but that class overloads stringification, so you can mostly just treat each item as a string and move on with your day. πŸ’–

  • export_card($input, $subject, %options) β€” same energy as export_cards but it exports just one single card. main character energy, no ensemble cast.

The $subject you provide must be an RDF::Trine::Node::Blank or RDF::Trine::Node::Resource of type v:VCard.

  • is_v3 β€” returns true if this exporter is in vCard 3.0 mode. ⭐
  • is_v4 β€” returns true if this exporter is in vCard 4.0 mode. ⭐

🧚 RDF Input

Input is expected to use the newer of the 2010 revision of the W3C's vCard vocabulary <http://www.w3.org/Submission/vcard-rdf/>. (and yes, the way that even though this was revised in 2010, the term URIs still include "2006" in them… iconic mess, we love her πŸ’€)

Some extensions from the namespace <http://buzzword.org.uk/rdf/vcardx#> are also supported. Namely: vx:usage, vx:kind, vx:gender, vx:sex, vx:dday, vx:anniversary, vx:lang, vx:caladruri, vx:caluri, vx:fburl, vx:impp, vx:source. πŸŽ€

The module author made the decision not to support FOAF and other RDF vocabularies that may be used to model contact information for people and organisations, because they don't necessarily map cleanly onto vCard. So if you were hoping to map non-vCard RDF to vCard with this module, you might have some luck pre-processing your RDF using a rules-based reasoner. fr fr, that's the path. 🫑

πŸ’œ vCard Output

The output of this module mostly aims at vCard 3.0 (RFC 2426) compliance. But in the face of weird input data though β€” e.g. an FN property that is a URI instead of a literal β€” it can pretty easily descend into exporting junk, non-compliant vCards. it's giving chaos, not perfection 😭

Many vCard 4.0 properties, such as the IMPP and KIND, are also supported. ✨

The vcard_version constructor option allows you to influence how some properties like GEO and TEL (which differ between 3.0 and 4.0) are output. πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘


🌈 AUTHOR 🌈

Toby Inkster <tobyink@cpan.org>. πŸ’–


Copyright 2011 Toby Inkster

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay that's the whole page bestie, you ate that 🫢 this was the perl v5.34.0 build from 2022-06-17, and the file header calls itself RDF::v...porter(3pm) β€” go forth and export some cards, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from