NAME
    RDF::Query::Client - Get data from W3C SPARQL Protocol 1.0 servers

VERSION
    0.05

SYNOPSIS
      use RDF::Query::Client;
  
      my $query = new RDF::Query::Client ("SELECT * WHERE {?s ?p ?o. ?o ?p ?s.}");
      my $iterator = $query->execute('http://example.com/sparql');
      while (my $row = $iterator->next) {
        print $row->{'s'}->as_string;
      }

METHODS
    "$query = RDF::Query::Client->new ( $sparql, \%opts )"
        Returns a new RDF::Query::Client object for the specified $sparql.
        The object's interface is designed to be roughly compatible with
        RDF::Query objects, though RDF::Query is not required by this
        module.

        Unlike RDF::Query, where you get a choice of query language, the
        query language for RDF::Query::Client is always 'sparql'.
        RDF::TrineShortcuts offers a way to perform RDQL queries on remote
        SPARQL stores though (by transforming RDQL to SPARQL).

        Options include:

        UserAgent - an LWP::UserAgent to handle HTTP requests.

    "$query->execute ( $endpoint, \%opts )"
        $endpoint is a URI object or string containing the endpoint URI to
        be queried.

        Options include:

        *   UserAgent - an LWP::UserAgent to handle HTTP requests.

        *   QueryMethod - 'GET', 'POST' or undef (automatic).

        *   QueryParameter - defaults to 'query'.

        *   AuthUsername - HTTP Basic authorization.

        *   AuthPassword - HTTP Basic authorization.

        *   Headers - additional headers to include (hashref).

        *   Parameters - additional GET/POST fields to include (hashref).

        Returns undef on error; an RDF::Trine::Iterator if called in a
        scalar context; an array obtained by calling "get_all" on the
        iterator if called in list context.

    "$query->get ( $endpoint, \%opts )"
        Executes the query using the specified endpoint, and returns the
        first matching row as a LIST of values. Takes the same arguments as
        "execute()".

    "$query->as_sparql"
        Returns the query as a string in the SPARQL syntax.

    "$query->useragent"
        Returns the LWP::UserAgent object used for retrieving web content.

    "$query->http_response"
        Returns the last HTTP Response the client experienced.

    "$query->error"
        Returns the last error the client experienced.

SECURITY
    The "<execute()"> and "<get()"> methods allow AuthUsername and
    AuthPassword options to be passed to them for HTTP Basic authentication.
    For more complicated Authentication (Digest, OAuth, Windows, etc), it is
    also possible to pass these methods a customised LWP::UserAgent.

    If you have the Crypt::SSLeay package installed, requests to HTTPS
    endpoints should work. It's possible to specify a client X.509
    certificate (e.g. for FOAF+SSL authentication) by setting particular
    environment variables. See Crypt::SSLeay documentation for details.

BUGS
    Probably.

SEE ALSO
    *   RDF::Trine, RDF::Trine::Iterator

    *   RDF::Query

    *   RDF::TrineShortcuts

    *   LWP::UserAgent

    *   http://www.w3.org/TR/rdf-sparql-protocol/

    *   http://www.w3.org/TR/rdf-sparql-query/

    *   http://www.perlrdf.org/

AUTHOR
    Toby Inkster, <tobyink@cpan.org>

COPYRIGHT AND LICENSE
    Copyright (C) 2009-2010 by Toby Inkster

    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself, either Perl version 5.6.0 or, at
    your option, any later version of Perl 5 you may have available.

