COPYRIGHT000644001750001750 327013425403011 16447 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: AtteanX-Store-SPARQL Upstream-Contact: Kjetil Kjernsmo (KJETILK) and Kjetil Kjernsmo Source: https://metacpan.org/release/AtteanX-Store-SPARQL Files: Changes META.json META.yml doap.ttl lib/AtteanX/Model/SPARQL.pm lib/AtteanX/Plan/SPARQLBGP.pm Copyright: Copyright 2019 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: COPYRIGHT CREDITS SIGNATURE Copyright: None License: public-domain Files: lib/AtteanX/Query/AccessPlan/SingleQuadBGP.pm lib/Test/Attean/Store/SPARQL/Role/CreateStore.pm Copyright: This software is copyright (c) 2015, 2016 by Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: README lib/AtteanX/Store/SPARQL.pm Copyright: This software is copyright (c) 2015, 2016 by Kjetil Kjernsmo and Gregory. License: GPL-1.0+ or Artistic-1.0 Files: INSTALL LICENSE Copyright: Unknown License: Unknown Files: Makefile.PL Copyright: Copyright 2013 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: t/triplestore.t Copyright: This software is copyright (c) 2015 by Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: dist.ini Copyright: Copyright 2018 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: t/plan.t Copyright: Copyright 2016 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 License: Artistic-1.0 This software is Copyright (c) 2019 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) 2019 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 CREDITS000644001750001750 23413425403011 16151 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012Maintainer: - Kjetil Kjernsmo (KJETILK) - Kjetil Kjernsmo Contributor: - Gregory Todd Williams Changes000644001750001750 177113425403011 16453 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012AtteanX-Store-SPARQL ==================== Created: 2015-06-23 Home page: Bug tracker: Maintainer: Kjetil Kjernsmo 0.012 2019-02-02 Fix bug from upstream changes. - Updated: Add count estimate handling. Gregory Todd Williams++ 0.010 2016-05-15 Quality improvements. - Added: Set version in all perl modules. - Added: Test model for costplanner support. - Removed: Remove the CostPlanner from the store. 0.008 2016-04-11 Add single-BGP access plan. Some fixes - Accept only JSON SPARQL results. - Added: Add single-BGP access plan. - Do the SPARQL serialization in the impl method. - Use the content method on the response object. 0.006 2016-03-07 API change for plan - Rename AtteanX::Store::SPARQL::Plan::BGP to AtteanX::Plan::SPARQLBGP. 0.004 2016-02-09 A few smaller changes 0.002 2016-01-11 Simplify cost modelling 0.001 2015-12-24 Initial release INSTALL000644001750001750 174513425403011 16212 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012 Installing AtteanX-Store-SPARQL should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm AtteanX::Store::SPARQL 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 AtteanX::Store::SPARQL INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan AtteanX::Store::SPARQL 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 AtteanX-Store-SPARQL: % 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 LICENSE000644001750001750 4366613425403011 16216 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012This software is copyright (c) 2019 by Kjetil Kjernsmo. 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) 2019 by Kjetil Kjernsmo. 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) 2019 by Kjetil Kjernsmo. 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 MANIFEST000644001750001750 50313425403011 16261 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE dist.ini doap.ttl lib/AtteanX/Model/SPARQL.pm lib/AtteanX/Plan/SPARQLBGP.pm lib/AtteanX/Query/AccessPlan/SingleQuadBGP.pm lib/AtteanX/Store/SPARQL.pm lib/Test/Attean/Store/SPARQL/Role/CreateStore.pm t/plan.t t/triplestore.t META.json000644001750001750 634413425403011 16602 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012{ "abstract" : "Attean SPARQL store", "author" : [ "Kjetil Kjernsmo ", "Kjetil Kjernsmo (KJETILK) " ], "dynamic_config" : 0, "generated_by" : "Dist::Inkt::Profile::KJETILK version 0.101, CPAN::Meta::Converter version 2.150010", "keywords" : [ "Semantic Web" ], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "AtteanX-Store-SPARQL", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : {}, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "develop" : { "recommends" : { "Dist::Inkt" : "0.001" } }, "runtime" : { "requires" : { "Attean" : "0.010", "Carp" : "0", "Data::Dumper" : "0", "LWP::UserAgent" : "0", "Moo" : "1.006000", "MooX::Log::Any" : "0", "Types::Standard" : "0", "Types::URI" : "0", "perl" : "5.014" }, "suggests" : { "HTTP::Message::PSGI" : "0", "RDF::Endpoint" : "0", "RDF::Trine" : "0", "Test::LWP::UserAgent" : "0.027" } }, "test" : { "requires" : { "HTTP::Message::PSGI" : "0", "RDF::Endpoint" : "0", "RDF::Trine" : "0", "Test::LWP::UserAgent" : "0.027", "Test::Modern" : "0", "Test::Roo" : "0" } } }, "provides" : { "AtteanX::Model::SPARQL" : { "file" : "lib/AtteanX/Model/SPARQL.pm", "version" : "0.012" }, "AtteanX::Plan::SPARQLBGP" : { "file" : "lib/AtteanX/Plan/SPARQLBGP.pm", "version" : "0.012" }, "AtteanX::Query::AccessPlan::SingleQuadBGP" : { "file" : "lib/AtteanX/Query/AccessPlan/SingleQuadBGP.pm", "version" : "0.012" }, "AtteanX::Store::SPARQL" : { "file" : "lib/AtteanX/Store/SPARQL.pm", "version" : "0.012" }, "Test::Attean::Store::SPARQL::Role::CreateStore" : { "file" : "lib/Test/Attean/Store/SPARQL/Role/CreateStore.pm", "version" : "0.012" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/kjetilk/p5-atteanx-store-sparql/issues" }, "homepage" : "https://metacpan.org/release/AtteanX-Store-SPARQL", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/kjetilk/p5-atteanx-store-sparql.git", "web" : "https://github.com/kjetilk/p5-atteanx-store-sparql" }, "x_IRC" : "irc://irc.perl.org/#perlrdf", "x_identifier" : "http://purl.org/NET/cpan-uri/dist/AtteanX-Store-SPARQL/project" }, "version" : "0.012", "x_contributors" : [ "Gregory Todd Williams " ], "x_serialization_backend" : "JSON::PP version 2.27300_01", "x_static_install" : 1 } META.yml000644001750001750 362013425403011 16424 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012--- abstract: 'Attean SPARQL store' author: - 'Kjetil Kjernsmo ' - 'Kjetil Kjernsmo (KJETILK) ' build_requires: HTTP::Message::PSGI: '0' RDF::Endpoint: '0' RDF::Trine: '0' Test::LWP::UserAgent: '0.027' Test::Modern: '0' Test::Roo: '0' configure_requires: ExtUtils::MakeMaker: '6.17' dynamic_config: 0 generated_by: 'Dist::Inkt::Profile::KJETILK version 0.101, CPAN::Meta::Converter version 2.150010' keywords: - 'Semantic Web' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: AtteanX-Store-SPARQL no_index: directory: - eg - examples - inc - t - xt optional_features: {} provides: AtteanX::Model::SPARQL: file: lib/AtteanX/Model/SPARQL.pm version: '0.012' AtteanX::Plan::SPARQLBGP: file: lib/AtteanX/Plan/SPARQLBGP.pm version: '0.012' AtteanX::Query::AccessPlan::SingleQuadBGP: file: lib/AtteanX/Query/AccessPlan/SingleQuadBGP.pm version: '0.012' AtteanX::Store::SPARQL: file: lib/AtteanX/Store/SPARQL.pm version: '0.012' Test::Attean::Store::SPARQL::Role::CreateStore: file: lib/Test/Attean/Store/SPARQL/Role/CreateStore.pm version: '0.012' requires: Attean: '0.010' Carp: '0' Data::Dumper: '0' LWP::UserAgent: '0' Moo: '1.006000' MooX::Log::Any: '0' Types::Standard: '0' Types::URI: '0' perl: '5.014' resources: IRC: irc://irc.perl.org/#perlrdf Identifier: http://purl.org/NET/cpan-uri/dist/AtteanX-Store-SPARQL/project bugtracker: https://github.com/kjetilk/p5-atteanx-store-sparql/issues homepage: https://metacpan.org/release/AtteanX-Store-SPARQL license: http://dev.perl.org/licenses/ repository: git://github.com/kjetilk/p5-atteanx-store-sparql.git version: '0.012' x_contributors: - 'Gregory Todd Williams ' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' x_static_install: 1 Makefile.PL000644001750001750 1771713425403011 17161 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "Attean SPARQL store", "author" => [ "Kjetil Kjernsmo ", "Kjetil Kjernsmo (KJETILK) ", ], "dynamic_config" => 0, "generated_by" => "Dist::Inkt::Profile::KJETILK version 0.101, CPAN::Meta::Converter version 2.150010", "keywords" => ["Semantic Web"], "license" => ["perl_5"], "meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => 2, }, "name" => "AtteanX-Store-SPARQL", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "prereqs" => { configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } }, develop => { recommends => { "Dist::Inkt" => 0.001 } }, runtime => { requires => { "Attean" => "0.010", "Carp" => 0, "Data::Dumper" => 0, "LWP::UserAgent" => 0, "Moo" => "1.006000", "MooX::Log::Any" => 0, "perl" => 5.014, "Types::Standard" => 0, "Types::URI" => 0, }, suggests => { "HTTP::Message::PSGI" => 0, "RDF::Endpoint" => 0, "RDF::Trine" => 0, "Test::LWP::UserAgent" => 0.027, }, }, test => { requires => { "HTTP::Message::PSGI" => 0, "RDF::Endpoint" => 0, "RDF::Trine" => 0, "Test::LWP::UserAgent" => 0.027, "Test::Modern" => 0, "Test::Roo" => 0, }, }, }, "provides" => { "AtteanX::Model::SPARQL" => { file => "lib/AtteanX/Model/SPARQL.pm", version => 0.012 }, "AtteanX::Plan::SPARQLBGP" => { file => "lib/AtteanX/Plan/SPARQLBGP.pm", version => 0.012 }, "AtteanX::Query::AccessPlan::SingleQuadBGP" => { file => "lib/AtteanX/Query/AccessPlan/SingleQuadBGP.pm", version => 0.012, }, "AtteanX::Store::SPARQL" => { file => "lib/AtteanX/Store/SPARQL.pm", version => 0.012 }, "Test::Attean::Store::SPARQL::Role::CreateStore" => { file => "lib/Test/Attean/Store/SPARQL/Role/CreateStore.pm", version => 0.012, }, }, "release_status" => "stable", "resources" => { bugtracker => { web => "https://github.com/kjetilk/p5-atteanx-store-sparql/issues", }, homepage => "https://metacpan.org/release/AtteanX-Store-SPARQL", license => ["http://dev.perl.org/licenses/"], repository => { type => "git", url => "git://github.com/kjetilk/p5-atteanx-store-sparql.git", web => "https://github.com/kjetilk/p5-atteanx-store-sparql", }, x_identifier => "http://purl.org/NET/cpan-uri/dist/AtteanX-Store-SPARQL/project", x_IRC => "irc://irc.perl.org/#perlrdf", }, "version" => 0.012, "x_contributors" => ["Gregory Todd Williams "], "x_static_install" => 1, }; 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); README000644001750001750 416713425403011 16042 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012NAME AtteanX::Store::SPARQL - Attean SPARQL store SYNOPSIS my $store = Attean->get_store('SPARQL')->new(endpoint_url => $url); DESCRIPTION This implements a simple immutable triple store, which simply allows programmers to use Attean facilities to query remote SPARQL endpoints. This distribution also brings a corresponding AtteanX::Model::SPARQL, which allows query plans to be made, and a AtteanX::Plan::SPARQLBGP plan class, which contains a rudimentary cost estimate that attempts to avoid sending Cartesian joins to remote endpoints if possible. Attributes and methods `endpoint_url` The URL of a remote SPARQL endpoint. Will be coerced into a URI object, so it may be set as a string or whatever. Required attribute. `ua` An LWP::UserAgent object to use for remote queries. Will be set to a reasonable default if not supplied. `get_triples` Method to query the remote endpoint, as required by Attean::API::TripleStore. `count_triples` Reimplemented using an aggregate query for greater efficiency. `get_sparql($sparql, [ $ua ])` Will submit the given $sparql query to the above `endpoint_url` attribute. Optionally, you may pass an LWP::UserAgent, if not it will use the user agent set using the `ua` method. Will return an iterator with the results if the request is successful. BUGS Please report any bugs to . ACKNOWLEDGEMENTS This module is heavily influenced by RDF::Trine::Store::SPARQL. AUTHOR Kjetil Kjernsmo . COPYRIGHT AND LICENCE This software is copyright (c) 2015, 2016 by Kjetil Kjernsmo and Gregory Todd Williams. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system 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. SIGNATURE000644001750001750 477413425403011 16452 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012This file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.81. 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: SHA256 SHA1 b19a185d476d4f9547ed80b4d71719007f94a90c COPYRIGHT SHA1 5efce2e3f5f35423ac5c3ea6fa1e75f6c6121a56 CREDITS SHA1 7f140132b3a23c51afbfb55d587719abebdfb0db Changes SHA1 47ba667141cf2fb1220a49047c729b82ae052793 INSTALL SHA1 a119631709ce4d3e6ea3868cdaface850ce432c2 LICENSE SHA1 5f7b6eb31bf64289c7dbfd805aec57af8c1976d0 MANIFEST SHA1 e520a403a1e6946c36a28dcbc69ec162ab1e5a1b META.json SHA1 f4325d217dce4fc8c703f3a4a413cf7558d14400 META.yml SHA1 d3ec8d763b7627f34105a8ace96d9170e0587988 Makefile.PL SHA1 530e716834b1fd0c12aa99adf2b7b611c3782c87 README SHA1 8763ce87875690883cfc79ee4eb3b91cc43634e7 dist.ini SHA1 d91b9279f0f0a194aa434fed98b4955d04478439 doap.ttl SHA1 be6a13980bc8e93af5fe4fa7cbf7a16d59277184 lib/AtteanX/Model/SPARQL.pm SHA1 25b43a0c56950fe7ac14004cdd3d78acb7968699 lib/AtteanX/Plan/SPARQLBGP.pm SHA1 9765bc33f98e6e2b3093b14a0bb25e46b48995c8 lib/AtteanX/Query/AccessPlan/SingleQuadBGP.pm SHA1 7f80681b6d04a9d15dfa0af01e11c86fb6f6ad6d lib/AtteanX/Store/SPARQL.pm SHA1 bd668c55d7e7065947ba5373c77883e14163522f lib/Test/Attean/Store/SPARQL/Role/CreateStore.pm SHA1 0c83368eaa7c8f997c9f02a0bfc8db54da426639 t/plan.t SHA1 7cf7dbdab72ee6fa1eef5d9d9fa847a727f95192 t/triplestore.t -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEDsyLxtCi6bk7pBcmf77o3zqeSqUFAlxWBgkACgkQf77o3zqe SqXCZRAApUcyB8T+g/JEx2aHlhDgHPeaeh/D5Khd4nOMTM4VY90fNtgulByZkg98 I1BFbOwncT9zY6FPWXjr4/osy17jyPdCQcCSMOMYhLikJDsFfEEfWsiyQ5jgz1DD Rkck+oipnjVgo/hz/KgeiUk1loPCxlBuCaSdbV5MEooaLqdstFlUstSThmjziPW3 F/LMEPvhkaC0vJXXbnz9AvUdBHRNsGwb+4xLymQeBkSSCBnW4mIAL2U6lxj6Lw5d /herW+/ym+0xLkcG9KLdYyHjnNXfmRGsI+LlCH5mRE0oj0ZB4pFu8e0mTaQTNHl0 3mQeC9aNq0p23em24HAPmA0jBydTCBIOliZy+pE4KpCLPyOPQwPgUlJIxIr1pa29 TBqHw+yZDaOuM9f9RXgCA4Exty0wfgEk05hKb57opoOKzON4pXizw9bQFMFBUd1o AhOvZEqsPAnS8ULHM4wI03agYJ89cJeGCEA1MBjH87s6fn/RB7UISW09Z56UqfLm VjNfzIPfvmFbHmipJLnZKLUvfDqAuouCw3NE2672dB3b7d7uRZHQlRGMFeHtEfDj TQkzD7PTtoMgpIlQABPfWO6tu30Mm6QJ2ZUubOtXX43KYsdR2wWoHAImvgIX4BPo vB6s+M/L7kU4D8L1qmsKIurht3ihXE562n5FTOU2e2irq8SR/1E= =aRZu -----END PGP SIGNATURE----- dist.ini000644001750001750 14413425403011 16575 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012;;class='Dist::Inkt::Profile::KJETILK' ;;name='AtteanX-Store-SPARQL' ;;also_skip = [qr/README.pod/] doap.ttl000644001750001750 2415113425403011 16645 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012@prefix dc: . @prefix doap: . @prefix doap-changeset: . @prefix doap-deps: . @prefix foaf: . @prefix owl: . @prefix prov: . @prefix rdfs: . @prefix types: . @prefix wot: . @prefix xsd: . rdfs:label "Semantic Web"@en; dc:description "The Semantic Web is an extension of the current World Wide Web to enable wide data access and integration."@en. dc:title "the same terms as the perl 5 programming language system itself"; rdfs:comment "the same terms as the Perl 5 programming language system itself"@en. a foaf:Person; foaf:mbox ; foaf:name "Gregory Todd Williams"; owl:sameAs . a doap:Project; dc:contributor ; dc:identifier "AtteanX::Store::SPARQL"^^doap-deps:CpanId; doap-deps:develop-recommendation [ doap-deps:on "Dist::Inkt 0.001"^^doap-deps:CpanId ]; doap-deps:runtime-requirement [ doap-deps:on "Moo 1.006000"^^doap-deps:CpanId ], [ doap-deps:on "Attean 0.010"^^doap-deps:CpanId ], [ doap-deps:on "Types::Standard"^^doap-deps:CpanId ], [ doap-deps:on "Types::URI"^^doap-deps:CpanId ], [ doap-deps:on "LWP::UserAgent"^^doap-deps:CpanId ], [ doap-deps:on "perl 5.014"^^doap-deps:CpanId ], [ doap-deps:on "Carp"^^doap-deps:CpanId ], [ doap-deps:on "MooX::Log::Any"^^doap-deps:CpanId ], [ doap-deps:on "Data::Dumper"^^doap-deps:CpanId ]; doap-deps:runtime-suggestion [ doap-deps:on "RDF::Trine"^^doap-deps:CpanId ], [ doap-deps:on "HTTP::Message::PSGI"^^doap-deps:CpanId; ], [ doap-deps:on "RDF::Endpoint"^^doap-deps:CpanId ], [ doap-deps:on "Test::LWP::UserAgent 0.027"^^doap-deps:CpanId; ]; doap-deps:test-requirement [ doap-deps:on "Test::Modern"^^doap-deps:CpanId ], [ doap-deps:on "Test::Roo"^^doap-deps:CpanId ], [ doap-deps:on "RDF::Trine"^^doap-deps:CpanId ], [ doap-deps:on "RDF::Endpoint"^^doap-deps:CpanId ], [ doap-deps:on "Test::LWP::UserAgent 0.027"^^doap-deps:CpanId; ], [ doap-deps:on "HTTP::Message::PSGI"^^doap-deps:CpanId; ]; doap:bug-database ; doap:category , ; doap:created "2015-06-23"^^xsd:date; doap:developer ; doap:download-page ; doap:helper ; doap:homepage ; doap:license ; doap:maintainer ; doap:name "AtteanX-Store-SPARQL"; doap:programming-language "Perl"; doap:release , , , , , , ; doap:repository [ a doap:GitRepository; doap:browse ; prov:has_provenance ; ]; doap:security-contact ; doap:shortdesc "Attean SPARQL store"; doap:support-forum . a doap:Version; rdfs:label "Initial release"; dc:identifier "AtteanX-Store-SPARQL-0.001"^^xsd:string; dc:issued "2015-12-24"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.001"^^xsd:string. a doap:Version; rdfs:label "Simplify cost modelling"; dc:identifier "AtteanX-Store-SPARQL-0.002"^^xsd:string; dc:issued "2016-01-11"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.002"^^xsd:string. a doap:Version; rdfs:label "A few smaller changes"; dc:identifier "AtteanX-Store-SPARQL-0.004"^^xsd:string; dc:issued "2016-02-09"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.004"^^xsd:string. a doap:Version; rdfs:label "API change for plan"; dc:identifier "AtteanX-Store-SPARQL-0.006"^^xsd:string; dc:issued "2016-03-07"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Rename AtteanX::Store::SPARQL::Plan::BGP to AtteanX::Plan::SPARQLBGP."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.006"^^xsd:string. a doap:Version; rdfs:label "Add single-BGP access plan. Some fixes"; dc:identifier "AtteanX-Store-SPARQL-0.008"^^xsd:string; dc:issued "2016-04-11"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Do the SPARQL serialization in the impl method."; ], [ a doap-changeset:Addition; rdfs:label "Add single-BGP access plan."; ], [ a doap-changeset:Change; rdfs:label "Accept only JSON SPARQL results."; ], [ a doap-changeset:Change; rdfs:label "Use the content method on the response object."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.008"^^xsd:string. a doap:Version; rdfs:label "Quality improvements."; dc:identifier "AtteanX-Store-SPARQL-0.010"^^xsd:string; dc:issued "2016-05-15"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Set version in all perl modules."; ], [ a doap-changeset:Addition; rdfs:label "Test model for costplanner support."; ], [ a doap-changeset:Removal; rdfs:label "Remove the CostPlanner from the store."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.010"^^xsd:string. a doap:Version; rdfs:label "Fix bug from upstream changes."; dc:identifier "AtteanX-Store-SPARQL-0.012"^^xsd:string; dc:issued "2019-02-02"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Add count estimate handling."; doap-changeset:blame ; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.012"^^xsd:string. a foaf:Person; foaf:mbox ; foaf:name "Kjetil Kjernsmo"; foaf:nick "KjetilK"; owl:sameAs ; rdfs:seeAlso ; wot:hasKey _:B1. a foaf:Person; foaf:homepage ; foaf:mbox ; foaf:name "Kjetil Kjernsmo"; foaf:nick "KjetilK"; owl:sameAs , ; rdfs:seeAlso ; wot:hasKey _:B1. a types:ChatChannel; dc:title "The Perl and RDF IRC channel"@en. _:B1 a wot:PubKey; wot:fingerprint "0ECC8BC6D0A2E9B93BA417267FBEE8DF3A9E4AA5". plan.t000644001750001750 544613425403011 16545 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012/tuse v5.14; use Test::Modern; use Attean; use Attean::RDF; use AtteanX::Model::SPARQL; use Data::Dumper; #use Carp::Always; my $p = Attean::IDPQueryPlanner->new(); isa_ok($p, 'Attean::IDPQueryPlanner'); my $store = Attean->get_store('SPARQL')->new('endpoint_url' => iri('http://test.invalid/')); isa_ok($store, 'AtteanX::Store::SPARQL'); does_ok($store, 'Attean::API::TripleStore'); my $model = AtteanX::Model::SPARQL->new( store => $store ); isa_ok($model, 'AtteanX::Model::SPARQL'); does_ok($model, 'Attean::API::CostPlanner'); can_ok($model, 'get_sparql'); my $graph = iri('http://example.org'); my $t = triplepattern(variable('s'), iri('p'), literal('1')); my $u = triplepattern(variable('s'), iri('p'), variable('o')); my $v = triplepattern(variable('s'), iri('q'), blank('xyz')); my $w = triplepattern(variable('a'), iri('b'), iri('c')); subtest '1-triple BGP two variables' => sub { my $bgp = Attean::Algebra::BGP->new(triples => [$u]); my $plan = $p->plan_for_algebra($bgp, $model, [$graph]); does_ok($plan, 'Attean::API::Plan', '1-triple BGP'); isa_ok($plan, 'Attean::Plan::Quad'); is($plan->plan_as_string, 'Quad { ?s,

, ?o, }', 'plan_as_string gives the correct string'); }; subtest '3-triple BGP two variables' => sub { my $bgp = Attean::Algebra::BGP->new(triples => [$u, $t, $v]); my $plan = $p->plan_for_algebra($bgp, $model, [$graph]); does_ok($plan, 'Attean::API::Plan', '3-triple BGP'); isa_ok($plan, 'AtteanX::Plan::SPARQLBGP'); like($plan->plan_as_string, qr/^SPARQLBGP/, 'plan_as_string begins with the correct string'); cmp_deeply([sort @{@{$plan->children}[0]->in_scope_variables}], ['o','s'], 'in_scope_variable is correct for first quad'); cmp_deeply(@{$plan->children}[1]->in_scope_variables, ['s'], 'in_scope_variable is correct for second quad'); }; subtest 'Make sure Quad plans are accepted by the BGP' => sub { my $p1 = Attean::Plan::Quad->new(subject => variable('s'), predicate => iri('p'), object => variable('o'), graph => $graph, distinct => 0); my $p2 = Attean::Plan::Quad->new(subject => variable('a'), predicate => iri('b'), object => iri('c'), graph => $graph, distinct => 0); my $p3 = Attean::Plan::Quad->new(subject => variable('s'), predicate => iri('p2'), object => literal('o'), graph => $graph, distinct => 0); my $bgpplan = AtteanX::Plan::SPARQLBGP->new(children => [$p1,$p2], distinct => 0 ); isa_ok($bgpplan, 'AtteanX::Plan::SPARQLBGP'); does_ok($bgpplan, 'Attean::API::Plan'); is(scalar @{$bgpplan->children}, 2, 'Has two kids'); foreach my $plan (@{$bgpplan->children}) { isa_ok($plan, 'Attean::Plan::Quad', 'Plans are quads'); } }; done_testing; triplestore.t000644001750001750 103513425403011 20155 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012/t=pod =encoding utf-8 =head1 PURPOSE Run standard Test::Attean::TripleStore tests =head1 AUTHOR Kjetil Kjernsmo Ekjetilk@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2015 by Kjetil Kjernsmo. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut use strict; use warnings; use Test::More; use Test::Roo; with 'Test::Attean::TripleStore', 'Test::Attean::Store::SPARQL::Role::CreateStore'; run_me; done_testing; SPARQL.pm000644001750001750 343413425403011 21670 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012/lib/AtteanX/Modelpackage AtteanX::Model::SPARQL; use v5.14; use warnings; our $AUTHORITY = 'cpan:KJETILK'; our $VERSION = '0.012'; use Moo; use Types::Standard qw(InstanceOf); use namespace::clean; has 'store' => ( is => 'ro', isa => InstanceOf['AtteanX::Store::SPARQL'], required => 1, handles => { size => 'size' , get_quads => 'get_triples', count_quads => 'count_triples', get_sparql => 'get_sparql', plans_for_algebra => 'plans_for_algebra', count_quads_estimate => 'count_quads_estimate' } ); with 'Attean::API::Model', 'Attean::API::CostPlanner'; sub cost_for_plan { my $self = shift; my $plan = shift; my $planner = shift; # TODO: check if the store does something if ($plan->isa('AtteanX::Plan::SPARQLBGP')) { # BGPs should have a cost proportional to the number of triple patterns, # but be much more costly if they contain a cartesian product. if ($plan->children_are_variable_connected) { return 10 * scalar(@{ $plan->children }); } else { return 100 * scalar(@{ $plan->children }); } } return; } sub get_graphs { return Attean::ListIterator->new(); } 1; __END__ =pod =encoding utf-8 =head1 NAME AtteanX::Model::SPARQL - Attean SPARQL Model =head1 SYNOPSIS my $store = Attean->get_store('SPARQL')->new(endpoint_url => $url); my $model = AtteanX::Model::SPARQL->new( store => $store ); =head1 DESCRIPTION This model is in practice a thin wrapper around the underlying SPARQL store, that adds facilities only to allow quering and planning with quad semantics. It consumes L and L and adds no new methods or attributes. =head1 OTHER DETAILS For author, copyright and other details, see L. =cut SPARQLBGP.pm000644001750001750 346113425403011 22053 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012/lib/AtteanX/Plan=head1 NAME AtteanX::Plan::SPARQLBGP - Plan for efficient evaluation of SPARQL BGPs on remote endpoints =head1 SYNOPSIS This is typically only constructed by planning hacks deep in the code, but might look like: use v5.14; use AtteanX::Plan::SPARQLBGP; my $new_bgp_plan = AtteanX::Plan::SPARQLBGP->new(children => [$some_quads], distinct => 0, ordered => []); =head1 DESCRIPTION This plan class implements compiling basic graph patterns that can be joined remotely on a SPARQL endpoint. =head2 Attributes and methods Consumes L, L and L, and introduces nothing new. The most notable attribute is: =over =item C<< children >> which takes an arrayref of L objects to be included in the Basic Graph pattern that will be evaluated against the model. =back =head1 OTHER DETAILS For author, copyright and other details, see L. =cut package AtteanX::Plan::SPARQLBGP; use v5.14; use warnings; our $AUTHORITY = 'cpan:KJETILK'; our $VERSION = '0.012'; use Moo; use Scalar::Util qw(blessed); with 'Attean::API::QueryTree', 'Attean::API::Plan', 'Attean::API::UnionScopeVariablesPlan', 'MooX::Log::Any'; sub plan_as_string { my $self = shift; return 'SPARQLBGP'; } sub impl { my $self = shift; my $model = shift; my $sparql = 'SELECT * WHERE {'; foreach my $child (@{$self->children}) { my @terms = $child->values; my $pattern = Attean::TriplePattern->new(@terms[0..2]); $sparql .= "\n " . $pattern->as_sparql . ' . '; } $sparql .= "\n}\n"; $self->log->debug("Using query:\n$sparql"); return sub { return $model->get_sparql($sparql) } } 1; SPARQL.pm000644001750001750 1160113425403011 21737 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012/lib/AtteanX/Storepackage AtteanX::Store::SPARQL; use v5.14; use strict; use warnings; our $AUTHORITY = 'cpan:KJETILK'; our $VERSION = '0.012'; use Moo; use Type::Tiny::Role; use Types::URI -all; use Types::Standard qw(InstanceOf); use Attean; use Attean::RDF; use AtteanX::Plan::SPARQLBGP; use LWP::UserAgent; use Data::Dumper; use Carp; with 'Attean::API::TripleStore'; with 'MooX::Log::Any'; has 'endpoint_url' => (is => 'ro', isa => Uri, coerce => 1); has 'ua' => (is => 'rw', isa => InstanceOf['LWP::UserAgent'], builder => '_build_ua'); sub _build_ua { my $self = shift; my $ua = LWP::UserAgent->new; $ua->default_headers->push_header( 'Accept' => 'application/sparql-results+json' ); #Attean->acceptable_parsers(handles => q[Attean::API::Result])); return $ua; } sub get_triples { my $self = shift; my $pattern = Attean::TriplePattern->new(@_); my $ua = $self->ua->clone; $ua->default_headers->header( 'Accept' => Attean->acceptable_parsers); return $self->get_sparql("CONSTRUCT WHERE {\n\t".$pattern->tuples_string."\n}"); } sub count_triples { my $self = shift; my $pattern = Attean::TriplePattern->new(@_); my $iter = $self->get_sparql("SELECT (count(*) AS ?count) WHERE {\n\t".$pattern->tuples_string."\n}"); return $iter->next->value('count')->value; } sub get_sparql { my $self = shift; my $sparql = shift; my $ua = shift || $self->ua; my $url = $self->endpoint_url->clone; my %query = $url->query_form; $query{'query'} = $sparql; $url->query_form(%query); $self->log->debug('Sending GET request for URL: ' . $url); my $response = $ua->get( $url ); if ($response->is_success) { my $parsertype = Attean->get_parser( media_type => $response->content_type); croak 'Could not parse response from '. $self->endpoint_url->as_string . ' which returned ' . $response->content_type unless defined($parsertype); my $p = $parsertype->new; return $p->parse_iter_from_bytes($response->content); } else { $self->log->trace('Got an error, dumping the response: ' . Dumper($response)); croak 'Error making remote SPARQL call to endpoint ' . $self->endpoint_url->as_string . ' (' .$response->status_line. ')'; } } sub plans_for_algebra { my $self = shift; my $algebra = shift; my $model = shift; my $active_graphs = shift; my $default_graphs = shift; if ($algebra->isa('Attean::Algebra::BGP') && scalar $algebra->elements > 1) { my @quads; foreach my $triple (@{$algebra->triples}) { push(@quads, Attean::Plan::Quad->new(subject => $triple->subject, predicate => $triple->predicate, object => $triple->object, graph => $active_graphs, distinct => 0)); } return AtteanX::Plan::SPARQLBGP->new(children => \@quads, distinct => 0); # TODO: Fix } return; } 1; __END__ =pod =encoding utf-8 =head1 NAME AtteanX::Store::SPARQL - Attean SPARQL store =head1 SYNOPSIS my $store = Attean->get_store('SPARQL')->new(endpoint_url => $url); =head1 DESCRIPTION This implements a simple immutable triple store, which simply allows programmers to use L facilities to query remote SPARQL endpoints. This distribution also brings a corresponding L, which allows query plans to be made, and a L plan class, which contains a rudimentary cost estimate that attempts to avoid sending Cartesian joins to remote endpoints if possible. =head2 Attributes and methods =over =item C<< endpoint_url >> The URL of a remote SPARQL endpoint. Will be coerced into a L object, so it may be set as a string or whatever. Required attribute. =item C<< ua >> An L object to use for remote queries. Will be set to a reasonable default if not supplied. =item C<< get_triples >> Method to query the remote endpoint, as required by L. =item C<< count_triples >> Reimplemented using an aggregate query for greater efficiency. =item C<< get_sparql($sparql, [ $ua ]) >> Will submit the given C<$sparql> query to the above C attribute. Optionally, you may pass an L, if not it will use the user agent set using the C method. Will return an iterator with the results if the request is successful. =back =head1 BUGS Please report any bugs to L. =head1 ACKNOWLEDGEMENTS This module is heavily influenced by L. =head1 AUTHOR Kjetil Kjernsmo Ekjetilk@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2015, 2016 by Kjetil Kjernsmo and Gregory Todd Williams. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system 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. SingleQuadBGP.pm000644001750001750 257313425403011 25337 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012/lib/AtteanX/Query/AccessPlanpackage AtteanX::Query::AccessPlan::SingleQuadBGP; use strict; use warnings; our $AUTHORITY = 'cpan:KJETILK'; our $VERSION = '0.012'; use Moo::Role; use AtteanX::Plan::SPARQLBGP; around 'access_plans' => sub { my $orig = shift; my $self = shift; my $model = shift; my $active_graphs = shift; my $pattern = shift; my @plans = $orig->($self, $model, $active_graphs, $pattern, @_); if ($pattern->does('Attean::API::TriplePattern')) { my $sp = AtteanX::Plan::SPARQLBGP->new(children => [shift(@plans)], distinct => 0, ordered => []); push(@plans, $sp); } return @plans; }; 1; __END__ =pod =encoding utf-8 =head1 NAME AtteanX::Query::AccessPlan::SingleQuadBGP - An access plan for single-quad basic graph patterns =head1 SYNOPSIS A query planner can compose this role using with 'AtteanX::Query::AccessPlan::SingleQuadBGP'; =head1 DESCRIPTION =head1 SEE ALSO =head1 AUTHOR Kjetil Kjernsmo Ekjetilk@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2015, 2016 by Kjetil Kjernsmo. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system 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. CreateStore.pm000644001750001750 651013425403011 25632 0ustar00kjetilkjetil000000000000AtteanX-Store-SPARQL-0.012/lib/Test/Attean/Store/SPARQL/Rolepackage Test::Attean::Store::SPARQL::Role::CreateStore; use strict; use warnings; our $AUTHORITY = 'cpan:KJETILK'; our $VERSION = '0.012'; use RDF::Trine::Model; use RDF::Trine qw(statement iri blank literal); use RDF::Endpoint; use Test::LWP::UserAgent; use HTTP::Message::PSGI; use Moo::Role; sub create_store { my $self = shift; my %args = @_; my $triples = $args{triples} // []; my $model = RDF::Trine::Model->temporary_model; # For creating endpoint foreach my $atteantriple (@{$triples}) { my $s = iri($atteantriple->subject->value); if ($atteantriple->subject->is_blank) { $s = blank($atteantriple->subject->value); } my $p = iri($atteantriple->predicate->value); my $o = iri($atteantriple->object->value); if ($atteantriple->object->is_literal) { # difference with RDF 1.0 vs RDF 1.1 datatype semantics if ($atteantriple->object->datatype->value eq 'http://www.w3.org/2001/XMLSchema#string') { $o = literal($atteantriple->object->value, $atteantriple->object->language); } else { $o = literal($atteantriple->object->value, $atteantriple->object->language, $atteantriple->object->datatype->value); } } elsif ($atteantriple->object->is_blank) { $o = blank($atteantriple->object->value); } $model->add_statement(statement($s, $p, $o)); } my $end = RDF::Endpoint->new($model); my $app = sub { my $env = shift; my $req = Plack::Request->new($env); my $resp = $end->run( $req ); return $resp->finalize; }; my $useragent = Test::LWP::UserAgent->new; $useragent->register_psgi('localhost', $app); # Now, we should just have had a URL of the endpoint my $url = 'http://localhost:5000/sparql'; my $store = Attean->get_store('SPARQL')->new(endpoint_url => $url, ua => $useragent ); return $store; } 1; =pod =head1 NAME Test::Attean::Store::SPARQL::Role::CreateStore - Create a SPARQL store for tests =head1 SYNOPSIS Either: use Test::More; use Test::Roo; with 'Test::Attean::TripleStore', 'Test::Attean::Store::SPARQL::Role::CreateStore'; run_me; done_testing; or: package TestCreateStore { use Moo; with 'Test::Attean::Store::SPARQL::Role::CreateStore'; }; my $triples = [ triple(iri('http://example.org/bar'), iri('http://example.org/c'), iri('http://example.org/foo')), # [...] ]; my $test = TestCreateStore->new; my $store = $test->create_store(triples => $triples); =head1 DESCRIPTION There are two ways of using this. The original idea is to use it to test a triple/quad that uses L, like in the first example in the synopsis. It is also possible to utilize this role like in the second example to create a store for testing other parts of the code too. In that example, first wrap a class around the role, then create an arrayref of triples, which should be used to populate the store. Then, instantiate an object of the class, and call it's C method with the triples. Now, you have a proper store that can be used in tests. =head1 AUTHOR Kjetil Kjernsmo Ekjetilk@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2015, 2016 by Kjetil Kjernsmo. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.