.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "RDF::Query::Client 3pm" .TH RDF::Query::Client 3pm "2019-02-07" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" RDF::Query::Client \- get data from W3C SPARQL Protocol 1.0 servers .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use RDF::Query::Client; \& \& my $query = RDF::Query::Client \& \->new(\*(AqSELECT DISTINCT ?s WHERE { ?s ?p ?o . }\*(Aq); \& \& my $iterator = $query\->execute(\*(Aqhttp://example.com/sparql\*(Aq); \& \& while (my $row = $iterator\->next) { \& print $row\->{s}\->as_string; \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" .SS "Constructor" .IX Subsection "Constructor" .ie n .IP """new ( $sparql, \e%opts )""" 4 .el .IP "\f(CWnew ( $sparql, \e%opts )\fR" 4 .IX Item "new ( $sparql, %opts )" Returns a new RDF::Query::Client object for the specified \f(CW$sparql\fR. The object's interface is designed to be roughly compatible with RDF::Query objects, though RDF::Query is not required by this module. .Sp Options include: .RS 4 .IP "\fBUserAgent\fR \- an LWP::UserAgent to handle \s-1HTTP\s0 requests." 4 .IX Item "UserAgent - an LWP::UserAgent to handle HTTP requests." .RE .RS 4 .Sp 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 \s-1RDQL\s0 queries on remote \s-1SPARQL\s0 stores though (by transforming \&\s-1RDQL\s0 to \s-1SPARQL\s0). .RE .SS "Public Methods" .IX Subsection "Public Methods" .ie n .IP """execute ( $endpoint, \e%opts )""" 4 .el .IP "\f(CWexecute ( $endpoint, \e%opts )\fR" 4 .IX Item "execute ( $endpoint, %opts )" \&\f(CW$endpoint\fR is a \s-1URI\s0 object or string containing the endpoint \&\s-1URI\s0 to be queried. .Sp Options include: .RS 4 .IP "\(bu" 4 \&\fBUserAgent\fR \- an LWP::UserAgent to handle \s-1HTTP\s0 requests. .IP "\(bu" 4 \&\fBQueryMethod\fR \- '\s-1GET\s0', '\s-1POST\s0', '\s-1PATCH\s0' or undef (automatic). .IP "\(bu" 4 \&\fBQueryParameter\fR \- defaults to 'query'. .IP "\(bu" 4 \&\fBAuthUsername\fR \- \s-1HTTP\s0 Basic authorization. .IP "\(bu" 4 \&\fBAuthPassword\fR \- \s-1HTTP\s0 Basic authorization. .IP "\(bu" 4 \&\fBHeaders\fR \- additional headers to include (hashref). .IP "\(bu" 4 \&\fBParameters\fR \- additional \s-1GET/POST\s0 fields to include (hashref). .IP "\(bu" 4 \&\fBContentType\fR \- 'application/sparql\-query', \&'application/sparql\-update' or 'application/x\-www\-form\-urlencoded' (default). .RE .RS 4 .Sp Returns undef on error; an RDF::Trine::Iterator if called in a scalar context; an array obtained by calling \f(CW\*(C`get_all\*(C'\fR on the iterator if called in list context. .RE .ie n .IP """discover_execute( $resource_uri, \e%opts )""" 4 .el .IP "\f(CWdiscover_execute( $resource_uri, \e%opts )\fR" 4 .IX Item "discover_execute( $resource_uri, %opts )" Experimental feature. Discovers a \s-1SPARQL\s0 endpoint relevant to \f(CW$resource_uri\fR and then calls \f(CW\*(C`$query\->execute\*(C'\fR against that. Uses an LRDD-like method to discover the endpoint. If you're publishing data and want people to be able to find your \s-1SPARQL\s0 endpoint automatically, the easiest way is to include an Link header in \s-1HTTP\s0 responses: .Sp .Vb 1 \& Link: ; rel="http://ontologi.es/sparql#endpoint" .Ve .Sp Change the \s-1URL\s0 in the angled brackets, but not the \s-1URL\s0 in the rel string. .Sp This feature requires the \s-1HTTP::LRDD\s0 package to be installed. .ie n .IP """get ( $endpoint, \e%opts )""" 4 .el .IP "\f(CWget ( $endpoint, \e%opts )\fR" 4 .IX Item "get ( $endpoint, %opts )" Executes the query using the specified endpoint, and returns the first matching row as a \s-1LIST\s0 of values. Takes the same arguments as \f(CW\*(C`execute\*(C'\fR. .ie n .IP """as_sparql""" 4 .el .IP "\f(CWas_sparql\fR" 4 .IX Item "as_sparql" Returns the query as a string in the \s-1SPARQL\s0 syntax. .ie n .IP """useragent""" 4 .el .IP "\f(CWuseragent\fR" 4 .IX Item "useragent" Returns the LWP::UserAgent object used for retrieving web content. .ie n .IP """http_response""" 4 .el .IP "\f(CWhttp_response\fR" 4 .IX Item "http_response" Returns the last \s-1HTTP\s0 Response the client experienced. .ie n .IP """error""" 4 .el .IP "\f(CWerror\fR" 4 .IX Item "error" Returns the last error the client experienced. .SS "Security" .IX Subsection "Security" The \f(CW\*(C`execute\*(C'\fR and \f(CW\*(C`get\*(C'\fR methods allow AuthUsername and AuthPassword options to be passed to them for \s-1HTTP\s0 Basic authentication. For more complicated authentication (Digest, OAuth, Windows, etc), it is also possible to pass these methods a customised LWP::UserAgent. .PP If you have the Crypt::SSLeay package installed, requests to \s-1HTTPS\s0 endpoints should work. It's possible to specify a client X.509 certificate (e.g. for WebID authentication) by setting particular environment variables. See Crypt::SSLeay documentation for details. .SH "BUGS" .IX Header "BUGS" Probably. .PP Please report any you find here: . .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 RDF::Trine, RDF::Trine::Iterator .IP "\(bu" 4 RDF::Query .IP "\(bu" 4 LWP::UserAgent .IP "\(bu" 4 .IP "\(bu" 4 .IP "\(bu" 4 .SH "AUTHOR" .IX Header "AUTHOR" Toby Inkster, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2009\-2013 by Toby Inkster .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "DISCLAIMER OF WARRANTIES" .IX Header "DISCLAIMER OF WARRANTIES" \&\s-1THIS PACKAGE IS PROVIDED \*(L"AS IS\*(R" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\s0