OpenGuides::RDF - An OpenGuides plugin to output RDF/XML.
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.
use CGI::Wiki; use OpenGuides::Config; use OpenGuides::RDF; my $wiki = CGI::Wiki->new( ... ); my $config = OpenGuides::Config->new( file => "wiki.conf" ); my $rdf_writer = OpenGuides::RDF->new( wiki => $wiki, config => $config ); # RDF version of a node. print "Content-Type: text/plain\n\n"; print $rdf_writer->emit_rdfxml( node => "Masala Zone, N1 0NU" ); # Ten most recent changes. print "Content-Type: text/plain\n"; print "Last-Modified: " . $self->rss_timestamp( items => 10 ) . "\n\n"; print $rdf_writer->make_recentchanges_rss( items => 10 );
my $rdf_writer = OpenGuides::RDF->new( wiki => $wiki, config => $config );
wiki must be a CGI::Wiki object and config must be an OpenGuides::Config object. Both arguments mandatory.
wiki
config
$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:
write_node
default_city
new
default_country
Neighbourhood
Returns a raw CGI::Wiki::Plugin::RSS::ModWiki object created with the values you invoked this module with.
# Ten most recent changes. print "Content-Type: text/plain\n"; print "Last-Modified: " . $rdf_writer->rss_timestamp( items => 10 ) . "\n\n"; print $rdf_writer->make_recentchanges_rss( items => 10 ); # All the changes made by bob in the past week, ignoring minor edits. my %args = ( days => 7, ignore_minor_edits => 1, filter_on_metadata => { username => "bob" }, ); print "Content-Type: text/plain\n"; print "Last-Modified: " . $rdf_writer->rss_timestamp( %args ) . "\n\n"; print $rdf_writer->make_recentchanges_rss( %args );
print "Last-Modified: " . $rdf_writer->rss_timestamp( %args ) . "\n\n";
Returns the timestamp of the RSS feed in POSIX::strftime style ("Tue, 29 Feb 2000 12:34:56 GMT"), which is equivalent to the timestamp of the most recent item in the feed. Takes the same arguments as make_recentchanges_rss(). You will most likely need this to print a Last-Modified HTTP header so user-agents can determine whether they need to reload the feed or not.
CGI::Wiki
http://openguides.org/
http://chefmoz.org/
The OpenGuides Project (openguides-dev@openguides.org)
Copyright (C) 2003-2005 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.
Code in this module written by Kake Pugh and Earle Martin. Dan Brickley, Matt Biddulph and other inhabitants of #swig on irc.freenode.net gave useful feedback and advice.
To install OpenGuides, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenGuides
CPAN shell
perl -MCPAN -e shell install OpenGuides
For more information on module installation, please visit the detailed CPAN module installation guide.