NAME
RDF::LinkedData - Base class for Linked Data implementations
VERSION
Version 0.02
SYNOPSIS
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;
}
METHODS
new ( config => $config, model => $model, base => $base, request => $request, headers => $headers )
-
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
. request
-
Returns the Apache request object if it exists.
headers ( [ $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. 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
orpage
. 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
andbody
. The former is self-explanatory, the latter contains the actual content. model
-
Returns the RDF::Trine::Model object.
base
-
Returns the base URI for this handler.
title ( $node )
-
A suitable title for the document will be returned, based on document contents
description ( $node )
-
A suitable description for the document will be returned, based on document contents
html_node_value
-
Formats the nodes for HTML output.
AUTHOR
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>
BUGS
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.
SUPPORT
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
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
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.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 113:
Non-ASCII character seen before =encoding in '[ $headers'. Assuming UTF-8