Apache-XPointer-RDQL

 view release on metacpan or  search on metacpan

lib/Apache/XPointer/RDQL/RDFStore.pm  view on Meta::CPAN

# $Id: RDFStore.pm,v 1.9 2004/11/16 04:33:33 asc Exp $
use strict;

package Apache::XPointer::RDQL::RDFStore;
use base qw (Apache::XPointer::RDQL);

$Apache::XPointer::RDQL::RDFStore::VERSION = '1.1';

=head1 NAME

Apache::XPointer::RDQL::RDFStore - mod_perl handler to address XML fragments using the RDF Data Query Language.

=head1 SYNOPSIS

 <Directory /foo/bar>

  <FilesMatch "\.rdf$">
   SetHandler	perl-script
   PerlHandler	Apache::XPointer::RDQL::RDFStore

   PerlSetVar   XPointerSendRangeAs  "XML"
  </FilesMatch>

 </Directory>

 #

 my $ua  = LWP::UserAgent->new();
 my $req = HTTP::Request->new(GET => "http://example.com/foo/bar/baz.rdf");

 $req->header("Range" => qq(SELECT ?title, ?link
                            WHERE
                            (?item, <rdf:type>, <rss:item>),
                            (?item, <rss::title>, ?title),
                            (?item, <rss::link>, ?link)
                            USING
                            rdf for <http://www.w3.org/1999/02/22-rdf-syntax-ns#>,
                            rss for <http://purl.org/rss/1.0/>));

 $req->header("Accept" => "application/rdf+xml");

 my $res = $ua->request($req);

=head1 DESCRIPTION

Apache::XPointer::RDQL::RDFStore is a mod_perl handler to address XML fragments
using the HTTP 1.1 I<Range> and I<Accept> headers and the XPath scheme,
as described in the paper : I<A Semantic Web Resource Protocol: XPointer and HTTP>.

Additionally, the handler may also be configured to recognize a conventional
CGI parameter as a valid range identifier.

If no 'range' property is found, then the original document is
sent unaltered.

If an I<Accept> header is specified with no corresponding match, then the
server will return (406) HTTP_NOT_ACCEPTABLE.

Successful queries will return (206) HTTP_PARTIAL_CONTENT.

=head1 OPTIONS

=head2 XPointerSendRangeAs

Return matches as one of the following content-types :

=over 4

=item * B<multipart/mixed>

 --match
 Content-type: text/xml; charset=UTF-8

 <rdf:RDF
      xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
      xmlns:rdfstore='http://rdfstore.sourceforge.net/contexts/'
      xmlns:voc0='http://purl.org/rss/1.0/'>
  <rdf:Description rdf:about='rdf:resource:rdfstore123'>
   <voc0:title>The Daily Cartoon for November 15</voc0:title>
   <voc0:link>http://feeds.feedburner.com/BenHammersleysDangerousPrecedent?m=1</voc0:link>
  </rdf:Description>
 </rdf:RDF>

 --match
 Content-type: text/xml; charset=UTF-8

 <rdf:RDF
      xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
      xmlns:rdfstore='http://rdfstore.sourceforge.net/contexts/'



( run in 1.809 second using v1.01-cache-2.11-cpan-5837b0d9d2c )