NAME
linked_data_mojoserver.pl - A simple Mojolicious::Lite server for RDF as linked data
SYNOPSIS
linked_data_mojoserver.pl daemon
DESCRIPTION
To use a server based on RDF::LinkedData, create a database with triples, using RDF::Trine. There is an example in write_sqlite-db.pl
in the distribution that converts a Turtle file to a suitable SQLite database, other databases can be handled in a similar manner.
Next, you need to construct a RDF::Trine::Store config string, see the documentation in that module for further information, and also the above mentioned script.
Then, you need a config file. There's a companion linked_data_mojoserver.json
that contains a JSON file that configures this script to use a minimal example database with just two triples. In this file, there is a store parameter, which must contain the RDF::Trine::Store config string and a base
URI. This defaults to http://localhost:3000, which is what this script also defaults to.
The following documentation is adapted from the RDF::LinkedData::Apache, which preceeded this script.
* http://host.name/rdf/example
Will return an HTTP 303 redirect based on the value of the request's Accept header. If the Accept header contains a recognized RDF media type, the redirect will be to http://host.name/rdf/example/data, otherwise to http://host.name/rdf/example/page
* http://host.name/rdf/example/data
Will return a bounded description of the http://host.name/rdf/example resource in an RDF serialization based on the Accept header. If the Accept header does not contain a recognized media type, RDF/XML will be returned.
* http://host.name/rdf/example/page
Will return an HTML description of the http://host.name/rdf/example resource including RDFa markup.
If the RDF resource for which data is requested is not the subject of any RDF triples in the underlying triplestore, the /page and /data redirects will not take place, and a HTTP 404 (Not Found) will be returned.
The HTML description of resources will be enhanced by having metadata about the predicate of RDF triples loaded into the same triplestore. Currently, the relevant metadata includes rdfs:label and dc:description statements about predicates. For example, if the triplestore contains the statement
<http://host.name/rdf/example> <http://example/date> "2010" .
then also including the triple
<http://example/date> <http://www.w3.org/2000/01/rdf-schema#label> "Creation Date" .
Would allow the HTML description of http://host.name/rdf/example to include a description including:
Creation Date: 2010
instead of the less specific:
date: 2010
which is simply based on attempting to extract a useful suffix from the predicate URI.
AUTHOR
Kjetil Kjernsmo <kjetilk@cpan.org>
COPYRIGHT
Copyright (c) 2010 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 147:
=back without =over