RDF::LinkedData::ProviderRole - Role providing important functionality for Linked Data implementations
Version 0.04
From the Mojolicious::Lite example:
my $ld = RDF::LinkedData->new($config->{store}, $config->{base}); my $uri = $self->param('uri'); my $type = $self->param('type'); my $node = $ld->my_node($uri); if ($ld->count($node) > 0) { my $content = $ld->content($node, $type); $self->res->headers->header('Vary' => join(", ", qw(Accept))); $self->res->headers->content_type($content->{content_type}); $self->render_text($content->{body}); } else { $self->render_not_found; }
new ( config => $config, model => $model, base => $base, request => $request, headers_in => $headers_in )
Creates a new handler object based on named parameters, given a config string or model and a base URI. Optionally, you may pass a Apache request object, and you will need to pass a HTTP::Headers object if you plan to call content.
content
headers_in ( [ $headers ] )
Returns the HTTP::Headers object if it exists or sets it if a HTTP::Headers object is given as parameter.
type
Returns the chosen variant based on acceptable formats.
my_node
A node for the requested relative URI. This node is typically used as the subject to find which statements to return as data. Note that the base URI, set in the constructor or using the base method, is prepended to the argument.
base
count ( $node)
Returns the number of statements that has the $node as subject
content ( $node, $type)
Will return the a hashref with content for this URI, based on the $node subject, and the type of node, which may be either data or page. In the first case, an RDF document serialized to a format set by content negotiation. In the latter, a simple HTML document will be returned. The returned hashref has two keys: content_type and body. The former is self-explanatory, the latter contains the actual content.
data
page
content_type
body
model
Returns or sets the RDF::Trine::Model object.
Returns or sets the base URI for this handler.
Most of the code was written by Gregory Todd Williams <gwilliams@cpan.org> for RDF::LinkedData::Apache, but refactored into this class for use by other modules by Kjetil Kjernsmo, <kjetilk at cpan.org>
<gwilliams@cpan.org>
<kjetilk at cpan.org>
Please report any bugs or feature requests to bug-rdf-linkeddata at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=RDF-LinkedData. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-rdf-linkeddata at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc RDF::LinkedData
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=RDF-LinkedData
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/RDF-LinkedData
CPAN Ratings
http://cpanratings.perl.org/d/RDF-LinkedData
Search CPAN
http://search.cpan.org/dist/RDF-LinkedData
Copyright 2010 Gregory Todd Williams and ABC Startsiden AS.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install RDF::LinkedData, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RDF::LinkedData
CPAN shell
perl -MCPAN -e shell install RDF::LinkedData
For more information on module installation, please visit the detailed CPAN module installation guide.