NAME
RDF::LinkedData::ProviderRole - Role providing important functionality for Linked Data implementations
VERSION
Version 0.09_1
SYNOPSIS
See RDF::LinkedData for default usage.
DISCUSSION
This module is now a Moose::Role. The intention with this role is threefold:
This module may run standalone, in which case the default implementation in this role should be sufficient for a working Linked Data server. The empty RDF::LinkedData class should provide such a default implementation.
This role may be implemented in classes that need to change some parts of its functionality, such as a mod_perl-based server.
It may be a part of a larger server framework, for example a server that supports the SPARQL protocol and the SPARQL RESTful protocol.
It is not completely clear at this point what the requirements are for these three scenarios, but it currently satisfies the first scenario. Thus, the role may need to be changed substantially and possibly split into different roles based on the usage that evolves over time.
Consequently, one should not rely in the current API unless you are planning to keep track of the development of this module. It is still very much in flux, and may change without warning.
METHODS
new ( store => $store, model => $model, base => $base, headers_in => $headers_in )
-
Creates a new handler object based on named parameters, given a store config (which is a hashref that can be passed to RDF::Trine::Store->new_with_config) 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
. headers_in ( [ $headers ] )
-
Returns the HTTP::Headers object if it exists or sets it if a HTTP::Headers object is given as parameter.
helper_properties ( )
-
Returns the RDF::Helper::Properties object if it exists or sets it if a RDF::Helper::Properties object is given as parameter.
type
-
Returns or sets the type of result to return, i.e.
page
, in the case of a human-intended page ordata
for machine consumption, or an empty string if it is an actual resource URI that should be redirected. 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, or all if $node is undef.
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.One may argue that a hashref with magic keys should be a class of its own, and for that reason, this method should be considered "at risk". Currently, it is only used in one place, and it may be turned into a private method, get passed the Plack::Response object, removed altogether or turned into a role of its own, depending on the actual use cases that surfaces in the future.
model
-
Returns or sets the RDF::Trine::Model object.
base
-
Returns or sets the base URI for this handler.
response ( $uri )
-
Will look up what to do with the given URI and populate the response object.
- namespaces ( { skos => 'http://www.w3.org/2004/02/skos/core#', dct => 'http://purl.org/dc/terms/' } )
-
Gets or sets the namespaces that some serializers use for pretty-printing.
AUTHOR
This module was started by by Gregory Todd Williams <gwilliams@cpan.org>
for RDF::LinkedData::Apache, but heavily refactored and rewritten by by Kjetil Kjernsmo, <kjetilk@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::ProviderRole
The perlrdf mailing list is the right place to seek help and discuss this module:
http://lists.perlrdf.org/listinfo/dev
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.