CONTRIBUTING000664001750001750 614612404711216 15107 0ustar00taitai000000000000RDF-Query-Client-0.114NAME CONTRIBUTING DESCRIPTION If you're reading this document, that means you might be thinking about helping me out with this project. Thanks! Here's some ways you could help out: * Bug reports Found a bug? Great! (Well, not so great I suppose.) The place to report them is . Don't e-mail me about it, as your e-mail is more than likely to get lost amongst the spam. An example script clearly demonstrating the bug (preferably written using Test::More) would be greatly appreciated. * Patches If you've found a bug and written a fix for it, even better! Generally speaking you should check out the latest copy of the code from the source repository rather than using the CPAN distribution. The file META.yml should contain a link to the source repository. If not, then try or submit a bug report. (As far as I'm concerned the lack of a link is a bug.) Many of my distributions are also mirrored at . To submit the patch, do a pull request on GitHub or Bitbucket, or attach a diff file to a bug report. Unless otherwise stated, I'll assume that your contributions are licensed under the same terms as the rest of the project. (If using git, feel free to work in a branch. For Mercurial, I'd prefer bookmarks within the default branch.) * Documentation If there's anything unclear in the documentation, please submit this as a bug report or patch as above. Non-toy example scripts that I can bundle would also be appreciated. * Translation Translations of documentation would be welcome. For translations of error messages and other strings embedded in the code, check with me first. Sometimes the English strings may not in a stable state, so it would be a waste of time translating them. Coding Style I tend to write using something approximating the Allman style, using tabs for indentation and Unix-style line breaks. * * I nominally encode all source files as UTF-8, though in practice most of them use a 7-bit-safe ASCII-compatible subset of UTF-8. AUTHOR Toby Inkster . COPYRIGHT AND LICENCE Copyright (c) 2012-2014 by Toby Inkster. CONTRIBUTING is available under three different licences permitting its redistribution: the CC-BY-SA_UK-2.0 licence, plus the same licences as Perl itself, which is distributed under the GNU General Public Licence version 1, and the Artistic Licence. This file is licensed under the Creative Commons Attribution-ShareAlike 2.0 UK: England & Wales License. To view a copy of this license, visit . This file is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. COPYRIGHT000664001750001750 214612404711216 14544 0ustar00taitai000000000000RDF-Query-Client-0.114Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: RDF-Query-Client Upstream-Contact: TOBYINK and Toby Inkster Source: https://metacpan.org/release/RDF-Query-Client Files: Changes META.json META.yml dist.ini doap.ttl t/01basic.t Copyright: Copyright 2014 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: CONTRIBUTING INSTALL LICENSE examples/example1.pl Copyright: Unknown License: Unknown Files: COPYRIGHT CREDITS SIGNATURE Copyright: None License: public-domain Files: README lib/RDF/Query/Client.pm Copyright: Copyright (C) 2009-2013 by Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: Makefile.PL Copyright: Copyright 2013 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 License: Artistic-1.0 This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The Artistic License 1.0 License: GPL-1.0 This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 CREDITS000664001750001750 24012404711212 14236 0ustar00taitai000000000000RDF-Query-Client-0.114Maintainer: - TOBYINK - Toby Inkster Contributor: - Jonas Smedegaard - TOBYINK Thanks: - Changes000664001750001750 440412404711212 14537 0ustar00taitai000000000000RDF-Query-Client-0.114RDF-Query-Client ================ Created: 2009-11-10 Home page: Bug tracker: Maintainer: Toby Inkster 0.114 2014-09-13 [ Test Suite ] - Use Test::RequiresInternet. [ Other ] - Drop dependency on Role::Commons. - General tidy up. 0.113 2014-09-10 [ Packaging ] - Switch to Dist::Inkt. 0.112 2013-07-16 - Prefer SPARQL results in XML over JSON. (This partially rolls back a change from 0.104.) 0.111 2013-07-02 [ Bug Fixes ] - Stop bundling old version of Scalar::Util in 'inc'. 0.110 2012-03-13 [ Bug Fixes ] - sparql.org changed some URIs, breaking our tests. Fixes RT#75676. 0.109 2012-02-08 [ Bug Fixes ] 0.108 2012-02-08 - Updated: Stop using deprecated UNIVERSAL::AUTHORITY. Jonas Smedegaard++ 0.107 2011-12-03 [ Bug Fixes ] - Update to newer Module::Package::RDF 0.106 2011-11-26 [ Packaging ] - Module::Package::RDF [ Other ] - General tidy-up. - Support 'Content-Type: application/sparql-(query|update)'. - Support HTTP 'PATCH' method. - Updated: use 5.010 0.105 2011-03-04 - Fix annoying warning message. 0.104 2011-02-23 - Accept (and prefer) JSON results format. - Clean up media-type handling. - Delegate media-type-to-parser mapping to RDF::Trine. 0.103 2010-07-08 [ Bug Fixes ] - use Scalar::Util qw'blessed' 0.102 2010-07-07 [ Bug Fixes ] - Construct HTTP::LRDD object just in time. 0.101 2010-07-03 [ Bug Fixes ] - Possibly this will fix some cpan-tester fails, though I'm not entirely sure. 0.100 2010-06-30 - Added: Automatic endpoint discovery. 0.05 2010-03-20 - Minor documentation improvements. - Updated: Test script now checks HTTP connectivity to sparql.org before using it for tests. 0.04 2010-01-27 - Updated: Use my new build system. 0.03 2009-12-07 - Makefile.PL compatibility with earlier Perl versions. - Remove documentation for RDF::Query-compatible stub functions; issue warnings when they're called. 0.02 2009-11-12 - Add security notes to documentation - Added: Implement get() method - Added: Support for HTTP Basic Auth - lib/RDF/Query/Client.pm: use 5.006 0.01 2009-11-10 INSTALL000664001750001750 172112404711210 14272 0ustar00taitai000000000000RDF-Query-Client-0.114 Installing RDF-Query-Client should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm RDF::Query::Client If you are installing into a system-wide directory, you may need to pass the "-S" flag to cpanm, which uses sudo to install the module: % cpanm -S RDF::Query::Client INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan RDF::Query::Client MANUAL INSTALLATION As a last resort, you can manually install it. Download the tarball and unpack it. Consult the file META.json for a list of pre-requisites. Install these first. To build RDF-Query-Client: % perl Makefile.PL % make && make test Then install it: % make install If you are installing into a system-wide directory, you may need to run: % sudo make install LICENSE000664001750001750 4365512404711211 14303 0ustar00taitai000000000000RDF-Query-Client-0.114This software is copyright (c) 2014 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Toby Inkster. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Toby Inkster. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End MANIFEST000664001750001750 27312404711216 14361 0ustar00taitai000000000000RDF-Query-Client-0.114CONTRIBUTING COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE dist.ini doap.ttl examples/example1.pl lib/RDF/Query/Client.pm t/01basic.t META.json000664001750001750 415112404711216 14670 0ustar00taitai000000000000RDF-Query-Client-0.114{ "abstract" : "get data from W3C SPARQL Protocol 1.0 servers", "author" : [ "Toby Inkster ", "TOBYINK " ], "dynamic_config" : 0, "generated_by" : "Dist::Inkt::Profile::TOBYINK version 0.016, CPAN::Meta::Converter version 2.140640", "keywords" : [ "HTTP", "Protocol", "Query", "RDF", "REST", "SPARQL" ], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "RDF-Query-Client", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : {}, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "runtime" : { "recommends" : { "HTTP::LRDD" : "0" }, "requires" : { "HTTP::Request" : "0", "LWP::UserAgent" : "0", "RDF::Trine" : "0.133", "URI::Escape" : "0", "namespace::clean" : "0.20" } }, "test" : { "requires" : { "Test::More" : "0.61", "Test::RequiresInternet" : "0" } } }, "provides" : { "RDF::Query::Client" : { "file" : "lib/RDF/Query/Client.pm", "version" : "0.114" } }, "release_status" : "stable", "resources" : { "X_identifier" : "http://purl.org/NET/cpan-uri/dist/RDF-Query-Client/project", "bugtracker" : { "web" : "http://rt.cpan.org/Dist/Display.html?Queue=RDF-Query-Client" }, "homepage" : "https://metacpan.org/release/RDF-Query-Client", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/tobyink/p5-rdf-query-client.git", "web" : "https://github.com/tobyink/p5-rdf-query-client" } }, "version" : "0.114", "x_contributors" : [ "Jonas Smedegaard", "TOBYINK" ] } META.yml000664001750001750 242112404711216 14516 0ustar00taitai000000000000RDF-Query-Client-0.114--- abstract: 'get data from W3C SPARQL Protocol 1.0 servers' author: - 'Toby Inkster ' - 'TOBYINK ' build_requires: Test::More: '0.61' Test::RequiresInternet: '0' configure_requires: ExtUtils::MakeMaker: '6.17' dynamic_config: 0 generated_by: 'Dist::Inkt::Profile::TOBYINK version 0.016, CPAN::Meta::Converter version 2.140640' keywords: - HTTP - Protocol - Query - RDF - REST - SPARQL license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: RDF-Query-Client no_index: directory: - eg - examples - inc - t - xt optional_features: {} provides: RDF::Query::Client: file: lib/RDF/Query/Client.pm version: '0.114' recommends: HTTP::LRDD: '0' requires: HTTP::Request: '0' LWP::UserAgent: '0' RDF::Trine: '0.133' URI::Escape: '0' namespace::clean: '0.20' resources: X_identifier: http://purl.org/NET/cpan-uri/dist/RDF-Query-Client/project bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=RDF-Query-Client homepage: https://metacpan.org/release/RDF-Query-Client license: http://dev.perl.org/licenses/ repository: git://github.com/tobyink/p5-rdf-query-client.git version: '0.114' x_contributors: - 'Jonas Smedegaard' - TOBYINK Makefile.PL000664001750001750 1266712404711216 15254 0ustar00taitai000000000000RDF-Query-Client-0.114use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "get data from W3C SPARQL Protocol 1.0 servers", "author" => [ "Toby Inkster ", "TOBYINK ", ], "dynamic_config" => 0, "generated_by" => "Dist::Inkt::Profile::TOBYINK version 0.016, CPAN::Meta::Converter version 2.140640", "keywords" => ["HTTP", "Protocol", "Query", "RDF", "REST", "SPARQL"], "license" => ["perl_5"], "meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => 2, }, "name" => "RDF-Query-Client", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "prereqs" => { configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } }, runtime => { recommends => { "HTTP::LRDD" => 0 }, requires => { "HTTP::Request" => 0, "LWP::UserAgent" => 0, "namespace::clean" => "0.20", "RDF::Trine" => 0.133, "URI::Escape" => 0, }, }, test => { requires => { "Test::More" => 0.61, "Test::RequiresInternet" => 0 }, }, }, "provides" => { "RDF::Query::Client" => { file => "lib/RDF/Query/Client.pm", version => 0.114 }, }, "release_status" => "stable", "resources" => { bugtracker => { web => "http://rt.cpan.org/Dist/Display.html?Queue=RDF-Query-Client", }, homepage => "https://metacpan.org/release/RDF-Query-Client", license => ["http://dev.perl.org/licenses/"], repository => { type => "git", url => "git://github.com/tobyink/p5-rdf-query-client.git", web => "https://github.com/tobyink/p5-rdf-query-client", }, X_identifier => "http://purl.org/NET/cpan-uri/dist/RDF-Query-Client/project", }, "version" => 0.114, "x_contributors" => ["Jonas Smedegaard", "TOBYINK"], }; my %dynamic_config; my %WriteMakefileArgs = ( ABSTRACT => $meta->{abstract}, AUTHOR => ($EUMM >= 6.5702 ? $meta->{author} : $meta->{author}[0]), DISTNAME => $meta->{name}, VERSION => $meta->{version}, EXE_FILES => [ map $_->{file}, values %{ $meta->{x_provides_scripts} || {} } ], NAME => do { my $n = $meta->{name}; $n =~ s/-/::/g; $n }, test => { TESTS => "t/*.t" }, %dynamic_config, ); $WriteMakefileArgs{LICENSE} = $meta->{license}[0] if $EUMM >= 6.3001; sub deps { my %r; for my $stage (@_) { for my $dep (keys %{$meta->{prereqs}{$stage}{requires}}) { next if $dep eq 'perl'; my $ver = $meta->{prereqs}{$stage}{requires}{$dep}; $r{$dep} = $ver if !exists($r{$dep}) || $ver >= $r{$dep}; } } \%r; } my ($build_requires, $configure_requires, $runtime_requires, $test_requires); if ($EUMM >= 6.6303) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{TEST_REQUIRES} ||= deps('test'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.5503) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build', 'test'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.52) { $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime', 'build', 'test'); } else { $WriteMakefileArgs{PREREQ_PM} ||= deps('configure', 'build', 'test', 'runtime'); } { my ($minperl) = reverse sort( grep defined && /^[0-9]+(\.[0-9]+)?$/, map $meta->{prereqs}{$_}{requires}{perl}, qw( configure build runtime ) ); if (defined($minperl)) { die "Installing $meta->{name} requires Perl >= $minperl" unless $] >= $minperl; $WriteMakefileArgs{MIN_PERL_VERSION} ||= $minperl if $EUMM >= 6.48; } } sub FixMakefile { return unless -d 'inc'; my $file = shift; local *MAKEFILE; open MAKEFILE, "< $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; my $makefile = do { local $/; }; close MAKEFILE or die $!; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; open MAKEFILE, "> $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; print MAKEFILE $makefile or die $!; close MAKEFILE or die $!; } my $mm = WriteMakefile(%WriteMakefileArgs); FixMakefile($mm->{FIRST_MAKEFILE} || 'Makefile'); exit(0); README000664001750001750 1071612404711210 14145 0ustar00taitai000000000000RDF-Query-Client-0.114NAME RDF::Query::Client - get data from W3C SPARQL Protocol 1.0 servers SYNOPSIS use RDF::Query::Client; my $query = RDF::Query::Client ->new('SELECT DISTINCT ?s WHERE { ?s ?p ?o . }'); my $iterator = $query->execute('http://example.com/sparql'); while (my $row = $iterator->next) { print $row->{s}->as_string; } DESCRIPTION Constructor `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. Options include: UserAgent - an LWP::UserAgent to handle HTTP requests. 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). Public Methods `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', 'PATCH' 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). * ContentType - 'application/sparql-query', 'application/sparql-update' or 'application/x-www-form-urlencoded' (default). 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. `discover_execute( $resource_uri, \%opts )` Experimental feature. Discovers a SPARQL endpoint relevant to $resource_uri and then calls `$query->execute` 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 SPARQL endpoint automatically, the easiest way is to include an Link header in HTTP responses: Link: ; rel="http://ontologi.es/sparql#endpoint" Change the URL in the angled brackets, but not the URL in the rel string. This feature requires the HTTP::LRDD package to be installed. `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`. `as_sparql` Returns the query as a string in the SPARQL syntax. `useragent` Returns the LWP::UserAgent object used for retrieving web content. `http_response` Returns the last HTTP Response the client experienced. `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 WebID authentication) by setting particular environment variables. See Crypt::SSLeay documentation for details. BUGS Probably. Please report any you find here: . SEE ALSO * RDF::Trine, RDF::Trine::Iterator * RDF::Query * LWP::UserAgent * * * AUTHOR Toby Inkster, COPYRIGHT AND LICENSE Copyright (C) 2009-2013 by Toby Inkster This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. SIGNATURE000664001750001750 313412404711217 14534 0ustar00taitai000000000000RDF-Query-Client-0.114This file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.73. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SHA1 33317486c4fa2cf7fec85bf92ed38ac0f64233a0 CONTRIBUTING SHA1 0e533944c74943482b37df0f2095c4ce7079711b COPYRIGHT SHA1 e91ae2078a287a39bec08528536e31e52d2c5f37 CREDITS SHA1 b5397cfed73d02c685fbe80742e882b39f06147d Changes SHA1 38ae1b10f9abc657f41c808f86d4c0fe4bd5170f INSTALL SHA1 34f5e12514b91055de4b164a1f2327ef5c30ba53 LICENSE SHA1 ad84d26a8cc23226d392df207c610533c08938e1 MANIFEST SHA1 29b722a464a246f7a1c83a480ed2774a8e971113 META.json SHA1 abaefc22cf56be26062411cca42b97fcfe9a0183 META.yml SHA1 e7f3dd3762b83a5da6bcbf519a7f61ce2334a4e4 Makefile.PL SHA1 03674b3572987abc373b674ad473fa2ccfb7afa4 README SHA1 940f37677ff88225d4b150594153edf2ec5150d1 dist.ini SHA1 eb4f7d950665b824815e7eb28d793871cbd8c7fa doap.ttl SHA1 5af679c3d2ee06a149185155890661da87bccf86 examples/example1.pl SHA1 44907a4e17cb5c0a2089b9c63c8432e88b85f169 lib/RDF/Query/Client.pm SHA1 769b9f45fe6c3a5a5d2d8b98a25b8522dda00e60 t/01basic.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlQTko8ACgkQzr+BKGoqfTko6wCfXHogpyya88Juw2UHt2NTUGQY LGkAn2t/JTsRSgvBOb23GAdhnrv/x/nq =5C9X -----END PGP SIGNATURE----- dist.ini000664001750001750 10112404711210 14654 0ustar00taitai000000000000RDF-Query-Client-0.114;;class='Dist::Inkt::Profile::TOBYINK' ;;name='RDF-Query-Client' doap.ttl000664001750001750 4032412404711216 14741 0ustar00taitai000000000000RDF-Query-Client-0.114@prefix dc: . @prefix doap: . @prefix doap-bugs: . @prefix doap-changeset: . @prefix doap-deps: . @prefix foaf: . @prefix owl: . @prefix rdfs: . @prefix xsd: . a doap:Project; dc:contributor ; doap-bugs:issue , ; doap-deps:runtime-recommendation [ doap-deps:on "HTTP::LRDD"^^doap-deps:CpanId ]; doap-deps:runtime-requirement [ doap-deps:on "HTTP::Request"^^doap-deps:CpanId ], [ doap-deps:on "LWP::UserAgent"^^doap-deps:CpanId ], [ doap-deps:on "RDF::Trine 0.133"^^doap-deps:CpanId ], [ doap-deps:on "URI::Escape"^^doap-deps:CpanId ], [ doap-deps:on "namespace::clean 0.20"^^doap-deps:CpanId; ]; doap-deps:test-requirement [ doap-deps:on "Test::RequiresInternet"^^doap-deps:CpanId; ], [ doap-deps:on "Test::More 0.61"^^doap-deps:CpanId ]; doap:bug-database ; doap:category [ rdfs:label "REST" ], [ rdfs:label "SPARQL" ], [ rdfs:label "RDF" ], [ rdfs:label "Query" ], [ rdfs:label "Protocol" ], [ rdfs:label "HTTP" ]; doap:created "2009-11-10"^^xsd:date; doap:developer ; doap:documenter ; doap:download-page ; doap:homepage ; doap:license ; doap:maintainer ; doap:name "RDF-Query-Client"; doap:programming-language "Perl"; doap:release , , , , , , , , , , , , , , , , , , , ; doap:repository [ a doap:GitRepository; doap:browse ; ]; doap:shortdesc "get data from W3C SPARQL Protocol 1.0 servers"@en; doap:tester . a doap:Version; dc:issued "2009-11-10"^^xsd:date; doap:file-release ; doap:revision "0.01"^^xsd:string; rdfs:comment "Original version"@en. a doap:Version; dc:issued "2009-11-12"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Support for HTTP Basic Auth"; ], [ rdfs:label "Add security notes to documentation" ], [ a doap-changeset:Addition; rdfs:label "Implement get() method"; ], [ rdfs:label "lib/RDF/Query/Client.pm: use 5.006" ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.02"^^xsd:string. a doap:Version; dc:issued "2009-12-07"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ rdfs:label "Makefile.PL compatibility with earlier Perl versions."; ], [ rdfs:label "Remove documentation for RDF::Query-compatible stub functions; issue warnings when they're called."; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.03"^^xsd:string. a doap:Version; dc:issued "2010-01-27"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Use my new build system."; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.04"^^xsd:string. a doap:Version; dc:issued "2010-03-20"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Test script now checks HTTP connectivity to sparql.org before using it for tests."; ], [ rdfs:label "Minor documentation improvements." ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.05"^^xsd:string. a doap:Version; dc:issued "2010-06-30"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Automatic endpoint discovery."@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.100"^^xsd:string. a doap:Version; dc:issued "2010-07-03"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Possibly this will fix some cpan-tester fails, though I'm not entirely sure."@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.101"^^xsd:string. a doap:Version; dc:issued "2010-07-07"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Construct HTTP::LRDD object just in time."@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.102"^^xsd:string. a doap:Version; dc:issued "2010-07-08"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "use Scalar::Util qw'blessed'"@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.103"^^xsd:string. a doap:Version; dc:issued "2011-02-23"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ rdfs:label "Accept (and prefer) JSON results format."@en; ], [ rdfs:label "Clean up media-type handling."@en ], [ rdfs:label "Delegate media-type-to-parser mapping to RDF::Trine."@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.104"^^xsd:string. a doap:Version; dc:issued "2011-03-04"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ rdfs:label "Fix annoying warning message."@en ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.105"^^xsd:string. a doap:Version; dc:issued "2011-11-26"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ rdfs:label "Support 'Content-Type: application/sparql-(query|update)'."@en; ], [ rdfs:label "Support HTTP 'PATCH' method."@en ], [ rdfs:label "General tidy-up."@en ], [ a doap-changeset:Update; rdfs:label "use 5.010"@en; ], [ a doap-changeset:Packaging; rdfs:label "Module::Package::RDF"@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.106"^^xsd:string. a doap:Version; dc:issued "2011-12-03"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix, doap-changeset:Packaging; rdfs:label "Update to newer Module::Package::RDF"@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.107"^^xsd:string. a doap:Version; dc:issued "2012-02-08"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Stop using deprecated UNIVERSAL::AUTHORITY."@en; doap-changeset:blame [ foaf:name "Jonas Smedegaard" ]; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.108"^^xsd:string. a doap:Version; dc:issued "2012-02-08"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix, doap-changeset:Packaging ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.109"^^xsd:string. a doap:Version; dc:issued "2012-03-13"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix, doap-changeset:Packaging; rdfs:label "sparql.org changed some URIs, breaking our tests."@en; doap-changeset:fixes ; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.110"^^xsd:string. a doap:Version; dc:issued "2013-07-02"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix, doap-changeset:Packaging; rdfs:label "Stop bundling old version of Scalar::Util in 'inc'."@en; doap-changeset:fixes ; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.111"^^xsd:string. a doap:Version; dc:issued "2013-07-16"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Prefer SPARQL results in XML over JSON. (This partially rolls back a change from 0.104.)"@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.112"^^xsd:string. a doap:Version; dc:identifier "RDF-Query-Client-0.113"^^xsd:string; dc:issued "2014-09-10"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Switch to Dist::Inkt."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.113"^^xsd:string. a doap:Version; dc:identifier "RDF-Query-Client-0.114"^^xsd:string; dc:issued "2014-09-13"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Drop dependency on Role::Commons."; ], [ a doap-changeset:Tests; rdfs:label "Use Test::RequiresInternet."; ], [ a doap-changeset:Change; rdfs:label "General tidy up."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.114"^^xsd:string. a doap-bugs:Issue; rdfs:label "accepted ContentType does not include sparql-results+xml"; dc:created "2012-02-01T16:52:08"^^xsd:dateTime; dc:modified "2012-02-07T09:56:40"^^xsd:dateTime; doap-bugs:assignee _:B1; doap-bugs:id "74592"^^xsd:string; doap-bugs:page ; doap-bugs:reporter [ a foaf:Agent; foaf:mbox ; ]; doap-bugs:status . a doap-bugs:Issue; rdfs:label "test failure due to change in sparql resource location"; dc:created "2012-03-10T19:30:54"^^xsd:dateTime; dc:modified "2012-03-13T17:24:24"^^xsd:dateTime; doap-bugs:assignee _:B1; doap-bugs:id "75676"^^xsd:string; doap-bugs:page ; doap-bugs:reporter [ a foaf:Agent; foaf:mbox ; ]; doap-bugs:status . a foaf:Person; foaf:homepage ; foaf:mbox ; foaf:name "Toby Inkster"; foaf:page ; owl:sameAs . _:B1 a foaf:Agent; foaf:nick "TOBYINK". example1.pl000664001750001750 306412404711210 17132 0ustar00taitai000000000000RDF-Query-Client-0.114/examples#!/usr/bin/perl use strict; use warnings; use lib 'lib/'; use feature ":5.10"; use RDF::Query::Client; use Data::Dumper; my $sparql_ask = "PREFIX dc: \n" . "ASK WHERE { ?book dc:title ?title . }" ; my $sparql_select = "PREFIX dc: \n" . "SELECT * WHERE { ?book dc:title ?title . } ORDER BY ?book" ; my $sparql_construct = "PREFIX dc: \n" . "CONSTRUCT { ?book ?title . }\n" . "WHERE { ?book dc:title ?title . }" ; my $q_ask = new RDF::Query::Client($sparql_ask); my $q_select = new RDF::Query::Client($sparql_select); my $q_construct = new RDF::Query::Client($sparql_construct); my $r_ask = $q_ask->execute('http://sparql.org/books') or die $q_ask->error; my $r_select = $q_select->execute('http://sparql.org/books') or die $q_select->error; my $r_construct = $q_construct->execute('http://sparql.org/books') or die $q_construct->error; say "ASK results in a boolean" if $r_ask->is_boolean; say $r_ask->get_boolean ? 'true' : 'false'; say "===="; say "SELECT results in bindings" if $r_select->is_bindings; while (my $row = $r_select->next) { foreach my $k (keys %$row) { my $v = $row->{$k}; say sprintf("%s=%s", $k, $v->as_string); } say "--"; } say "===="; say "CONSTRUCT results in a graph" if $r_construct->is_graph; while (my $row = $r_construct->next) { say $row->as_string; } say "===="; say "Testing get()"; my @list = $q_select->get('http://sparql.org/books'); print Dumper(\@list); say "===="; 01basic.t000664001750001750 300512404711210 15110 0ustar00taitai000000000000RDF-Query-Client-0.114/tuse LWP::UserAgent; use Test::RequiresInternet 'sparql.org' => 80; use Test::More tests => 5; BEGIN { use_ok('RDF::Query::Client') }; SKIP: { my $response = LWP::UserAgent -> new -> get('http://sparql.org/books/sparql?query=SELECT+*+{$s+$p+$o}'); unless ($response->is_success) { diag $response->as_string; skip "need network access and ability to connect to sparql.org", 4; } my $sparql_ask = "PREFIX dc: \n" . "ASK WHERE { ?book dc:title ?title . }" ; my $sparql_select = "PREFIX dc: \n" . "SELECT * WHERE { ?book dc:title ?title . }" ; my $sparql_construct = "PREFIX dc: \n" . "CONSTRUCT { ?book ?title . }\n" . "WHERE { ?book dc:title ?title . }" ; my $q_ask = new RDF::Query::Client($sparql_ask); my $q_select = new RDF::Query::Client($sparql_select); my $q_construct = new RDF::Query::Client($sparql_construct); my $r_ask = $q_ask->execute('http://sparql.org/books/sparql'); my $r_select = $q_select->execute('http://sparql.org/books/sparql'); my $r_construct = $q_construct->execute('http://sparql.org/books/sparql'); ok($r_ask->is_boolean, "ASK results in a boolean"); ok($r_select->is_bindings, "SELECT results in bindings"); ok($r_construct->is_graph, "CONSTRUCT results in a graph"); ok($r_ask->get_boolean, "ASK results as expected"); diag("You can safely ignore warnings from DBD about tables being locked.\n"); } Client.pm000664001750001750 2565212404711210 17334 0ustar00taitai000000000000RDF-Query-Client-0.114/lib/RDF/Queryuse 5.010; use strict; use warnings; package RDF::Query::Client; BEGIN { $RDF::Query::Client::AUTHORITY = 'cpan:TOBYINK'; $RDF::Query::Client::VERSION = '0.114'; } use Carp 0 qw/carp/; use LWP::UserAgent 0 qw//; use RDF::Trine 0.133 qw//; use Scalar::Util 0 qw/blessed/; use URI::Escape 0 qw/uri_escape/; use namespace::clean; sub new { my $class = shift; my ($query, $opts) = @_; bless { query => $query , useragent => ($opts->{UserAgent} // undef) , results => [] , error => undef , }, $class; } sub execute { my $self = shift; my ($endpoint, $opts) = @_; my $ua = $opts->{UserAgent} // $self->useragent; my $request = $self->_prepare_request($endpoint, $opts); my $response = $ua->request($request); push @{ $self->{results} }, { response => $response }; my $iterator = $self->_create_iterator($response); return unless defined $iterator; $self->{results}[-1]{iterator} = $iterator; wantarray ? $iterator->get_all : $iterator; } our $LRDD; sub discover_execute { my $self = shift; my ($resource_uri, $opts) = @_; unless ($LRDD) { no warnings; eval 'use HTTP::LRDD;'; eval { $LRDD = HTTP::LRDD->new('http://ontologi.es/sparql#endpoint', 'http://ontologi.es/sparql#fingerpoint') if HTTP::LRDD->can('new'); }; } unless (blessed($LRDD) and $LRDD->isa('HTTP::LRDD')) { $self->{error} = "Need HTTP::LRDD to use the discover_execute feature."; return; } my $endpoint = $LRDD->discover($resource_uri) or return; return $self->execute($endpoint, $opts); } sub get { my $self = shift; my $stream = $self->execute(@_); if (ref $stream) { if ($stream->is_bindings) { my $row = $stream->next; return $stream->binding_values; } if ($stream->is_graph) { my $st = $stream->next; return ($st->subject, $st->predicate, $st->object); } if ($stream->is_boolean) { my @rv; push @rv, 1 if $stream->get_boolean; return @rv; } } return; } sub as_sparql { return (shift)->{query}; } sub http_response { return (shift)->{results}[-1]{response}; } sub error { return (shift)->{error}; } sub prepare { carp "Method not implemented"; } sub execute_plan { carp "Method not implemented"; } sub execute_with_named_graphs { carp "Method not implemented"; } sub aggregate { carp "Method not implemented"; } sub pattern { carp "Method not implemented"; } sub sse { carp "Method not implemented"; } sub algebra_fixup { carp "Method not implemented"; } sub add_function { carp "Method not implemented"; } sub supported_extensions { carp "Method not implemented"; } sub supported_functions { carp "Method not implemented"; } sub add_computed_statement_generator { carp "Method not implemented"; } sub get_computed_statement_generators { carp "Method not implemented"; } sub net_filter_function { carp "Method not implemented"; } sub add_hook_once { carp "Method not implemented"; } sub add_hook { carp "Method not implemented"; } sub parsed { carp "Method not implemented"; } sub bridge { carp "Method not implemented"; } sub log { carp "Method not implemented"; } sub logger { carp "Method not implemented"; } sub costmodel { carp "Method not implemented"; } sub useragent { my $self = shift; unless (defined $self->{useragent}) { my $accept = join q{, } => ( 'application/sparql-results+xml', 'application/sparql-results+json;q=0.9', 'application/rdf+xml', 'application/x-turtle', 'text/turtle', ); my $agent = sprintf( '%s/%s (%s) ', __PACKAGE__, __PACKAGE__->VERSION, do { no strict "refs"; ${ref($self)."::AUTHORITY"} }, ); $self->{useragent} = LWP::UserAgent->new( agent => $agent, max_redirect => 2, parse_head => 0, protocols_allowed => [qw/http https/], ); $self->{useragent}->default_header(Accept => $accept); } $self->{useragent}; } sub _prepare_request { my $self = shift; my ($endpoint, $opts) = @_; my $method = uc($opts->{QueryMethod} // ''); if ($method !~ /^(get|post|patch)$/i) { $method = (length $self->{'query'} > 511) ? 'POST' : 'GET'; } my $param = $opts->{QueryParameter} // 'query'; my $uri = ''; my $cnt = ''; if ($method eq 'GET') { $uri = $endpoint . ($endpoint =~ /\?/ ? '&' : '?'); $uri .= sprintf( "%s=%s", uri_escape($param), uri_escape($self->{query}) ); if ($opts->{Parameters}) { foreach my $field (keys %{$opts->{Parameters}}) { $uri .= sprintf( "&%s=%s", uri_escape($field), uri_escape($opts->{Parameters}->{$field}), ); } } } elsif ($method eq 'POST') { $uri = $endpoint; $cnt = sprintf( "%s=%s", uri_escape($param), uri_escape($self->{query}) ); if ($opts->{Parameters}) { foreach my $field (keys %{$opts->{Parameters}}) { $cnt .= sprintf( "&%s=%s", uri_escape($field), uri_escape($opts->{Parameters}{$field}), ); } } } my $req = HTTP::Request->new($method => $uri); my $type = $opts->{ContentType} // ''; if ($type =~ m{^application/sparql-query}i) { $req->content_type('application/sparql-query'); $req->content($self->{query}); } elsif ($type =~ m{^application/sparql-update}i) { $req->content_type('application/sparql-update'); $req->content($self->{query}); } else { $req->content_type('application/x-www-form-urlencoded'); $req->content($cnt); } $req->authorization_basic($opts->{AuthUsername}, $opts->{AuthPassword}) if defined $opts->{AuthUsername}; foreach my $k (keys %{$opts->{Headers}}) { $req->header($k => $opts->{Headers}{$k}); } $req; } sub _create_iterator { my $self = shift; my ($response) = @_; unless ($response->is_success) { $self->{error} = $response->message; return; } if ($response->content_type =~ /sparql.results/) { local $@ = undef; my $iterator = eval { if ($response->content_type =~ /json/) { RDF::Trine::Iterator->from_json($response->decoded_content); } else { RDF::Trine::Iterator->from_string($response->decoded_content); } }; return $iterator if $iterator; $self->{error} = $@; return; } else { my $model; eval { my $parser = RDF::Trine::Parser->parser_by_media_type($response->content_type); my $tmp = RDF::Trine::Model->temporary_model; $parser->parse_into_model($response->base, $response->decoded_content, $tmp); $model = $tmp; }; return $model->as_stream if defined $model; $self->{error} = sprintf("Response of type '%s' could not be parsed.", $response->content_type); return; } } 1; __END__ =pod =encoding utf8 =begin stopwords 'sparql' application/sparql-query application/sparql-update application/x-www-form-urlencoded rel WebID =end stopwords =head1 NAME RDF::Query::Client - get data from W3C SPARQL Protocol 1.0 servers =head1 SYNOPSIS use RDF::Query::Client; my $query = RDF::Query::Client ->new('SELECT DISTINCT ?s WHERE { ?s ?p ?o . }'); my $iterator = $query->execute('http://example.com/sparql'); while (my $row = $iterator->next) { print $row->{s}->as_string; } =head1 DESCRIPTION =head2 Constructor =over 4 =item C<< new ( $sparql, \%opts ) >> Returns a new RDF::Query::Client object for the specified C<$sparql>. The object's interface is designed to be roughly compatible with RDF::Query objects, though RDF::Query is not required by this module. Options include: =over 4 =item B - an LWP::UserAgent to handle HTTP requests. =back 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). =back =head2 Public Methods =over 4 =item C<< execute ( $endpoint, \%opts ) >> C<$endpoint> is a URI object or string containing the endpoint URI to be queried. Options include: =over 4 =item * B - an LWP::UserAgent to handle HTTP requests. =item * B - 'GET', 'POST', 'PATCH' or undef (automatic). =item * B - defaults to 'query'. =item * B - HTTP Basic authorization. =item * B - HTTP Basic authorization. =item * B - additional headers to include (hashref). =item * B - additional GET/POST fields to include (hashref). =item * B - 'application/sparql-query', 'application/sparql-update' or 'application/x-www-form-urlencoded' (default). =back Returns undef on error; an RDF::Trine::Iterator if called in a scalar context; an array obtained by calling C on the iterator if called in list context. =item C<< discover_execute( $resource_uri, \%opts ) >> Experimental feature. Discovers a SPARQL endpoint relevant to $resource_uri and then calls C<< $query->execute >> 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 SPARQL endpoint automatically, the easiest way is to include an Link header in HTTP responses: Link: ; rel="http://ontologi.es/sparql#endpoint" Change the URL in the angled brackets, but not the URL in the rel string. This feature requires the HTTP::LRDD package to be installed. =item C<< 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 C. =item C<< as_sparql >> Returns the query as a string in the SPARQL syntax. =item C<< useragent >> Returns the LWP::UserAgent object used for retrieving web content. =item C<< http_response >> Returns the last HTTP Response the client experienced. =item C<< error >> Returns the last error the client experienced. =back =head2 Security The C and C 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 WebID authentication) by setting particular environment variables. See L documentation for details. =head1 BUGS Probably. Please report any you find here: L. =head1 SEE ALSO =over 4 =item * L, L =item * L =item * L =item * L =item * L =item * L =back =head1 AUTHOR Toby Inkster, Etobyink@cpan.orgE =head1 COPYRIGHT AND LICENSE Copyright (C) 2009-2013 by Toby Inkster This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. =cut