NAME
RDF::LinkedData - A Linked Data server implementation
VERSION
Version 0.21_2
SYNOPSIS
A simple Plack server illustrates the usage nicely:
use RDF::LinkedData;
use Plack::Request;
use RDF::Trine;
my $parser = RDF::Trine::Parser->new( 'turtle' );
my $model = RDF::Trine::Model->temporary_model;
my $base_uri = 'http://localhost:5000';
$parser->parse_file_into_model( $base_uri, 't/data/basic.ttl', $model );
my $ld = RDF::LinkedData->new(model => $model, base_uri=>$base_uri);
my $linked_data = sub {
my $env = shift;
my $req = Plack::Request->new($env);
my $uri = $req->path_info;
if ($req->path_info =~ m!^(.+?)/?(page|data)$!) {
$uri = $1;
$ld->type($2);
}
$ld->headers_in($req->headers);
return $ld->response($uri)->finalize;
}
DESCRIPTION
This class provides a server implementation for serving Linked Data from the host it is configured for. Its main feature is that it can take an RDF model optionally read from file(s) or from a SPARQL endpoint and serve the URIs of those resources according to Linked Data best practices. It will do content negotation, supports many seralizations, and it will do 303 redirects as needed.
For example, say you control a host lod.example.org
and wish to use it to serve Linked Data. On file, you have a bit of RDF that you want to serve, like:
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://lod.example.org/foo> rdfs:label "DAHUT" ;
rdfs:seeAlso <http://lod.example.org/bar> .
<http://lod.example.org/bar> rdfs:label "More here" .
Then configuring this server to use the above file will make http://lod.example.org/foo
and http://lod.example.org/bar
dereferenceable with no further effort. The server will also return an appropriate 303 redirect to either a data
or page
suffix depending on the client's Accept
header and return a representation of the data.
METHODS
This module simply uses the default implementation in RDF::LinkedData::ProviderRole, and does nothing on its own. However, there is a quirk which is only relevant to a developer of this package.
- with_role
-
I had to redefine Moose::Role's with due to a conflict with Error described in the documentation of the latter. Users will never see this.
AUTHOR
This module was started by by Gregory Todd Williams <gwilliams@cpan.org>
for RDF::LinkedData::Apache, but heavily refactored and rewritten 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.
WARNING
Do 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!
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc RDF::LinkedData
The perlrdf mailing list is the right place to seek help and discuss this module:
http://lists.perlrdf.org/listinfo/dev
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-2011 Kjetil Kjernsmo, 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.