The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

OpenGuides::RDF - An OpenGuides plugin to output RDF/XML.

DESCRIPTION

Does all the RDF stuff for OpenGuides. Distributed and installed as part of the OpenGuides project, not intended for independent installation. This documentation is probably only useful to OpenGuides developers

SYNOPSIS

  use CGI::Wiki;
  use OpenGuides::RDF;

  my $wiki = CGI::Wiki->new;
  my $rdf_writer = OpenGuides::RDF->new( wiki => $wiki );

  $rdf_writer->emit_rdfxml( node => "Masala Zone, N1 0NU" );

METHODS

new
  my $rdf_writer = OpenGuides::RDF->new(
      wiki      => $wiki,
      site_name => "grubstreet",
      site_description => "The Open Community Guide To London", # optional
      make_node_url        => sub {
          my ($node_name, $version) = @_;
          if ( defined $version ) {
              return "http://wiki.example.com/?id="
                   . uri_escape($node_name)
                   . ";version=" . uri_escape($version);
          } else {
              return "http://wiki.example.com/?" . uri_escape($node_name);
          }
                                  },
      default_city => "London", # optional
      default_country => "United Kingdom" # optional
  );

wiki must be a CGI::Wiki object. All arguments mandatory except site_description, default_city, default_country.

make_node_url should be a sub taking either one or two arguments. If a single argument is supplied, it will be the node name, and the return value should be the URL for the version-independent location of the node. If a second argument is supplied, it will be the node version. The return value should be either the same as in the single-argument case (for wikis that don't keep old versions) or should be the URL for this version of this node.

emit_rdfxml
  $wiki->write_node( "Masala Zone, N1 0NU",
                     "Quick and tasty Indian food",
                     $checksum,
                     { comment  => "New page",
                       username => "Kake",
                       locale   => "Islington"
                     }
  );

  print "Content-type: text/plain\n\n";
  print $rdf_writer->emit_rdfxml( node => "Masala Zone, N1 0NU" );

Note: Some of the fields emitted by the RDF/XML generator are taken from the node metadata. The form of this metadata is not mandated by CGI::Wiki. Your wiki application should make sure to store some or all of the following metadata when calling write_node:

postcode - The postcode or zip code of the place discussed by the node. Defaults to the empty string.
city - The name of the city that the node is in. If not supplied, then the value of default_city as supplied to new will be used, if available, otherwise the empty string.
country - The name of the country that the node is in. If not supplied, then the value of default_country as supplied to new will be used, if available, otherwise the empty string.
username - An identifier for the person who made the latest edit to the node. This person will be listed as a contributor (Dublin Core). Defaults to empty string.
locale - The value of this can be a scalar or an arrayref, since some places have a plausible claim to being in more than one locale. Each of these is put in as a Neighbourhood attribute.
phone - Only one number supported at the moment. No validation.
website - No validation.
opening_hours_text - A freeform text field.

SEE ALSO

AUTHOR

The OpenGuides Project (grubstreet@hummous.earth.li)

COPYRIGHT

     Copyright (C) 2003 The OpenGuides Project.  All Rights Reserved.

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

CREDITS

Code in this module written by Kake Pugh and Earle Martin. Dan Brickley, Matt Biddulph and other inhabitants of #core gave useful feedback and advice.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 100:

'=item' outside of any '=over'

Around line 215:

You forgot a '=back' before '=head1'