COPYRIGHT000644001750001750 335212475623772 15401 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: RDF-LinkedData Upstream-Contact: Kjetil Kjernsmo Source: https://metacpan.org/release/RDF-LinkedData Files: INSTALL LICENSE README rdf_linkeddata.json rdf_linkeddata_acl.json rdf_linkeddata_dev.json rdf_linkeddata_end.json rdf_linkeddata_void.json script/linked_data.psgi t/data/add.ttl t/data/basic.ttl t/data/fragments.ttl Copyright: Unknown License: Unknown Files: dist.ini t/00-load.t t/10-basic.t t/11-constructor.t t/15-process.t t/16-void.t t/17-hypermedia-ro.t t/19_config_file.t t/28-psgi-void.t Copyright: Copyright 2014 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: Changes META.json META.yml doap.ttl t/18-fragments.t t/20-psgi-basic.t t/25-psgi-endpoint.t Copyright: Copyright 2015 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: COPYRIGHT CREDITS SIGNATURE Copyright: None License: public-domain Files: lib/RDF/LinkedData.pm Copyright: Copyright 2010 Gregory Todd Williams. Copyright 2010 ABC Startsiden AS. Copyright 2010, 2011, 2012, 2013, 2014, 2015 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: Makefile.PL Copyright: Copyright 2013 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: lib/Plack/App/RDF/LinkedData.pm Copyright: Copyright 2010, 2011, 2012, 2013, 2014, 2015 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 License: Artistic-1.0 This software is Copyright (c) 2015 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) 2015 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 CREDITS000644001750001750 26012475623771 15100 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74Maintainer: - Kjetil Kjernsmo Contributor: - Gregory Todd Williams - Patrick Hochstenbach (HOCHSTEN) Changes000644001750001750 2355412475623771 15426 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74RDF-LinkedData ============== Created: 2009-04-23 Home page: Bug tracker: Wiki: Mailing list: Maintainer: Kjetil Kjernsmo 0.74 2015-03-04 Fix Triple Pattern Fragments bugfix. [ Bug Fixes ] - Fix the template to be Hydra compliant. Patrick Hochstenbach++ [ Other ] - Move Perl version setting to makefile. 0.72 2015-02-14 Triple Pattern Fragments improvement. - Added: Adding support to download the complete datasets as fragments. Patrick Hochstenbach++ - Added: Set explicit Perl version. 0.70 2014-10-17 Triple Pattern Fragments support and modernization. - Added: Add the use of Expires module. - Added: Improve documentation. - Added: Support the .well-known/void magic URL. - Added: Triple Pattern Fragments support. - Hand-maintain README. - Migrate object system from Moose to Moo. - Use Dist::Inkt to package. - Use Log::Contextual to manage the logging. 0.68 2014-07-22 Documentation updates and small fixes. - Document the use of the PERLRDF_STORE environment variable. - Drop the weak ETag checking. - Updated: Many smaller documentation updates. - Use Try::Tiny instead of eval. 0.66 2014-07-11 Fix bug in ETag handling. [ Bug Fixes ] - ETags could have the URI prefixed. - RFC2616 says ETags have to be quoted. [ Other ] - Make ETags use base64 encoding rather than a hex. 0.64 2014-05-26 Fix bug in vocabulary URIs. [ Bug Fixes ] - Fix a bug that caused some vocabularies to show up as URI::Namespace-strings. [ Other ] - Added: Add git2prov links to the meta information, so there's a linked data chain from Github. 0.62 2013-10-27 Add Server header. - Added: Add a Server header. 0.60 2013-07-23 Install script. [ Bug Fixes ] - The PSGI script wasn't installed. 0.58 2013-07-23 Stability and modernization release. [ Bug Fixes ] - Add the use of content type to Etag to work around some bugs. - Allow POST requests to the endpoint. - Fix newline bug causing problems. - Simplify setting headers by removing call to HTTP::Headers. [ Other ] - Added: Enable optional use of environment for config. - Change packaging to use Module::Package::RDF. - Improved tests. - Removed: Remove write_sqlite script. - Updated: Use URI::NamespaceMap for namespaces. 0.56 2012-07-29 Bugfix release. [ Bug Fixes ] - Fix major UTF8 breakage by encoding all strings. - Fix performance problems by stat-ing the external VoID-file to see if needs reloading. - Fix performance problems caused by regeneration of VoID descriptions for every request. - Improve the way different HTML serializations are returned. [ Other ] - Added: More tests. - Skip some tests when Redland is installed, causes test-specific bugs. - Some cosmetic fixes. 0.54 2012-06-30 Improve VoID generator use. - Add a pagetitle config parameter for RDFa title. - Added: Make it possible to use the Generators property attributes. - Added: Use the Generators new feature to add a model with arbitrary data to load a file. - Some minor fixes. 0.52 2012-06-30 Bugfix release. [ Bug Fixes ] - A bad plan caused by superfluous BEGIN block caused test failures. 0.50 2012-06-29 Use VoID Generator. - Added: Add descriptions to POD and README. - Added: RDF::LinkedData now can use RDF::Generator::Void, but not all its features. - Removed: Remove SQLite generator script. - Some minor fixes. - The content method is now private. - Use current_etag instead of etag 0.44 2012-06-12 Bugfix release. [ Bug Fixes ] - Actually, the TODO test about content type failed for everyone else. - The endpoint path was not correctly sent to the hypermedia. [ Other ] - Added: More tests (obviously). - Some minor fixes. - Use empty string as default base_uri 0.42 2012-06-11 Enable very basic VoID for hypermedia. - Added: Add hypermedia method which will be on by default to enable hypermedia. - Added: Add namespaces_as_vocabularies method which will be on by default to use declared namespaces as vocabularies. - Added: Add void:endpoint and void:vocabulary to all output if enabled. - Some minor test and code fixes. - TODO test about content type now pass. - Use Test::RDF 0.26. - Use the github issue tracker. 0.40 2012-04-04 Refactoring and code improvements. - Added: Add Etag support - Added: Add URI::Escape configure_requires. - Added: Major refactor to create a Plack::App::RDF::LinkedData. - Added: More tests on HTML/RDFa content. - Added: Use Module::Install::RDF to manage the metadata. - Added: Use several Middleware modules in the psgi (For HEAD requests, CORS and Etag). - Major refactor to improve the RDF::LinkedData class. - Many minor test and code fixes. - Removed: Remove the Moose::Role, not clear that we need it. - Restructure the documentation. - Use MooseX::UndefTolerant to allow the endpoint_config to be undef. - Use RDF::RDFa::Generator. This alters the HTML output significantly. 0.30 2011-06-09 Use RDF::Endpoint for the same data. [ Bug Fixes ] - Add the subject URI to the HTML output, since this would often break. - Correct test dep to Test::JSON rather than just JSON. [ Other ] - Added: Added request method to pass the whole request rather than just headers. - Added: Optionally use RDF::Endpoint to set up a SPARQL endpoint for the data. - Allow namespaces to be skipped from the config. - Many minor documentation fixes. - Many minor test and code fixes. - Remove Test::NoWarnings; too many false positives. - Removed: headers_in method removed. 0.20 2011-02-08 Improved conneg; use Test::RDF; Many small fixes. [ Bug Fixes ] - Gives HTML page for default Firefox Accept header. [ Other ] - Added: Add tests for more browser Accept headers. - Added: Improve documentation of configuration (thanks to Thomas Kappler for input). - Consistently name the base URI base_uri. - Content negotation much improved. - Many minor documentation fixes. - Many minor test and code fixes. - Now use the RDF::Trine::Store->new method, since it now supports checking the type itself. - Updated: Now requires RDF::Trine 0.133. - Use the new Test::RDF module for testing. 0.18 2010-12-09 Minor JSON syntax documentation bug fix release. [ Bug Fixes ] - Found out the hard way that JSON doesn't allow single quotes. 0.16 2010-12-09 Instantiate on startup; Many small fixes. [ Bug Fixes ] - Move ld instantiation to outside of the coderef for big performance gain. [ Other ] - Added: Add basic support for Access-Control-Allow-Origin. - Added: Add tests for more Accept headers (TODO stuff). - Added: Support setting namespace in config. - Added: Use the base if the source has not set its own. - Many minor documentation fixes. - Many minor test and code fixes. - No main-namespaced variable needed for tests. - Remove logging unless in verbose mode. - Use a memory model for testing that loads the file directly 0.14 2010-08-26 Use URI object. - Minor documentation fixes. - Updated: Fix the warning described in http://search.cpan.org/~shlomif/Error-0.17016/lib/Error.pm#COMPATIBILITY - Updated: Using URI objects throughout makes more intensive use of absolute URIs. 0.12 2010-08-24 Support base URI. - Added: Support base URI in serializations for RDF::Trine 0.127_02. - Added: Use Module::Install::AuthorTests. 0.10 2010-08-19 Better tested release. - Added: Add TODO test to check whether Firefox' default Accept header returns data. 0.09_1 2010-08-18 Refactor helper modules; . [ Bug Fixes ] - Remove -T switch from load.t, since it borks on some systems. [ Other ] - Added: Add namespaces method to set a hashref with RDF namespaces. - Added: create a helper_properties method to pass the properties. - Move POD-tests to xt. - Updated: Split off RDF::LinkedData::Predicates into distribution of its own. 0.08 2010-08-02 Update to use config hashrefs and various fixes for recent RDF::Trine. - Now use a hashref config for new_with_config instead of config string. - Updated: Explicitly ask for text/html in tests since RDF::Trine 0.124 needs it. - Updated: No Accept header will return turtle data. - Updated: Require RDF::Trine 0.125. 0.06 2010-06-13 Minor POD syntax documentation bug fix release. [ Bug Fixes ] - Fix minor POD bugs. [ Other ] - Added: Add number of PSGI tests. 0.05 2010-06-13 Major refactor, use Moose and Plack. - Added: A response method contains most of the logic. - Added: Create RDF::LinkedData::ProviderRole, a Moose::Role with a default implementation. - Added: Create a Plack PSGI script to run the server. This also serves as a basic usage example. - Added: Create a RDF::LinkedData::Predicates with a title, description and page methods. - Added: More documentation. - Added: More tests, also unit testing. - Added: Use Config::JFDI for configuration. - Added: Use Plack::Response and HTTP::Headers in the role itself. - Added: use Moose - Many smaller changes. - Removed: Remove Mojolicious::Lite script. 0.03 2010-05-06 Add page method to use foaf:page for redirects. [ Bug Fixes ] - Really does require RDF::Trine 0.122. [ Other ] - Added: Add a page method that uses foaf:homepage or foaf:page to override the default page for redirect. - Minor cleanups. - Removed: Remove boilerplate tests. 0.02 2010-05-05 Use RDF::Trine's conneg and bounded description code. - Added: Add and improve a type method that returns page or data. - Added: Add some log messages. - Added: Use RDF::Trine's bounded description code. - Added: Use RDF::Trine's content negotiation code. - Added: Use a HTTP::Headers object for conneg. - Removed: Remove the negotiate method. - Require RDF::Trine 0.121. 0.01 2010-04-29 Initial release. Kjetil Kjernsmo refactored Gregs code to separate the web server logic from the rest. 0.001_01 2010-04-28 Code on Github by Gregory Todd Williams. INSTALL000644001750001750 170412475623770 15134 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74 Installing RDF-LinkedData should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm RDF::LinkedData 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::LinkedData INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan RDF::LinkedData 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-LinkedData: % 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 4366412475623770 15143 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74This 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. 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) 2015 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, Suite 500, Boston, MA 02110-1335 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) 2015 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 104512475623772 15234 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE dist.ini doap.ttl lib/Plack/App/RDF/LinkedData.pm lib/RDF/LinkedData.pm rdf_linkeddata.json rdf_linkeddata_acl.json rdf_linkeddata_dev.json rdf_linkeddata_end.json rdf_linkeddata_void.json script/linked_data.psgi t/00-load.t t/10-basic.t t/11-constructor.t t/15-process.t t/16-void.t t/17-hypermedia-ro.t t/18-fragments.t t/19_config_file.t t/20-psgi-basic.t t/25-psgi-endpoint.t t/28-psgi-void.t t/data/add.ttl t/data/basic.ttl t/data/fragments.ttl META.json000644001750001750 650012475623772 15525 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74{ "abstract" : "Base class and scripts for servers that serve RDF as Linked Data.", "author" : [ "Kjetil Kjernsmo " ], "dynamic_config" : 0, "generated_by" : "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.133380", "keywords" : [ "Semantic Web" ], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "RDF-LinkedData", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : {}, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "runtime" : { "recommends" : { "Config::JFDI" : "0", "JSON" : "0", "Plack::Middleware::CrossOrigin" : "0", "Plack::Middleware::Expires" : "0", "RDF::Endpoint" : "0.05", "RDF::Generator::Void" : "0.04" }, "requires" : { "Digest::MD5" : "0", "Encode" : "0", "HTML::HTML5::Writer" : "0", "HTTP::Headers" : "0", "List::Util" : "1.33", "Log::Contextual" : "0", "Log::Log4perl" : "0", "Module::Load::Conditional" : "0", "Moo" : "0", "Plack" : "0.9939", "RDF::Helper::Properties" : "0.10", "RDF::RDFa::Generator" : "0.102", "RDF::Trine" : "0.133", "Scalar::Util" : "0", "Try::Tiny" : "0", "Types::Standard" : "0", "URI" : "1.52", "URI::NamespaceMap" : "0", "namespace::autoclean" : "0.12", "perl" : "5.006" } }, "test" : { "requires" : { "Config::JFDI" : "0", "FindBin" : "0", "RDF::RDFa::Parser" : "0", "Test::Exception" : "0", "Test::JSON" : "0", "Test::More" : "0.88", "Test::RDF" : "1.16", "Test::WWW::Mechanize::PSGI" : "0" } } }, "provides" : { "Plack::App::RDF::LinkedData" : { "file" : "lib/Plack/App/RDF/LinkedData.pm" }, "RDF::LinkedData" : { "file" : "lib/RDF/LinkedData.pm", "version" : "0.74" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/kjetilk/RDF-LinkedData/issues" }, "homepage" : "https://metacpan.org/release/RDF-LinkedData", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "web" : "https://github.com/kjetilk/RDF-LinkedData/" }, "x_IRC" : "irc://irc.perl.org/#perlrdf", "x_identifier" : "http://purl.org/NET/cpan-uri/dist/RDF-LinkedData/project", "x_mailinglist" : "http://lists.perlrdf.org/listinfo/dev", "x_wiki" : "http://wiki.perlrdf.org/" }, "version" : "0.74", "x_contributors" : [ "Gregory Todd Williams ", "Patrick Hochstenbach (HOCHSTEN) " ], "x_provides_scripts" : { "linked_data.psgi" : { "file" : "script/linked_data.psgi" } } } META.yml000644001750001750 405012475623772 15353 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74--- abstract: 'Base class and scripts for servers that serve RDF as Linked Data.' author: - 'Kjetil Kjernsmo ' build_requires: Config::JFDI: 0 FindBin: 0 RDF::RDFa::Parser: 0 Test::Exception: 0 Test::JSON: 0 Test::More: 0.88 Test::RDF: 1.16 Test::WWW::Mechanize::PSGI: 0 configure_requires: ExtUtils::MakeMaker: 6.17 dynamic_config: 0 generated_by: 'Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.133380' keywords: - 'Semantic Web' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: RDF-LinkedData no_index: directory: - eg - examples - inc - t - xt optional_features: {} provides: Plack::App::RDF::LinkedData: file: lib/Plack/App/RDF/LinkedData.pm RDF::LinkedData: file: lib/RDF/LinkedData.pm version: 0.74 recommends: Config::JFDI: 0 JSON: 0 Plack::Middleware::CrossOrigin: 0 Plack::Middleware::Expires: 0 RDF::Endpoint: 0.05 RDF::Generator::Void: 0.04 requires: Digest::MD5: 0 Encode: 0 HTML::HTML5::Writer: 0 HTTP::Headers: 0 List::Util: 1.33 Log::Contextual: 0 Log::Log4perl: 0 Module::Load::Conditional: 0 Moo: 0 Plack: 0.9939 RDF::Helper::Properties: 0.10 RDF::RDFa::Generator: 0.102 RDF::Trine: 0.133 Scalar::Util: 0 Try::Tiny: 0 Types::Standard: 0 URI: 1.52 URI::NamespaceMap: 0 namespace::autoclean: 0.12 perl: 5.006 resources: IRC: irc://irc.perl.org/#perlrdf Identifier: http://purl.org/NET/cpan-uri/dist/RDF-LinkedData/project Mailinglist: http://lists.perlrdf.org/listinfo/dev Wiki: http://wiki.perlrdf.org/ bugtracker: https://github.com/kjetilk/RDF-LinkedData/issues homepage: https://metacpan.org/release/RDF-LinkedData license: http://dev.perl.org/licenses/ repository: https://github.com/kjetilk/RDF-LinkedData/ version: 0.74 x_contributors: - 'Gregory Todd Williams ' - 'Patrick Hochstenbach (HOCHSTEN) ' x_provides_scripts: linked_data.psgi: file: script/linked_data.psgi Makefile.PL000644001750001750 1770012475623772 16102 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "Base class and scripts for servers that serve RDF as Linked Data.", "author" => ["Kjetil Kjernsmo "], "dynamic_config" => 0, "generated_by" => "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.133380", "keywords" => ["Semantic Web"], "license" => ["perl_5"], "meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => 2, }, "name" => "RDF-LinkedData", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "prereqs" => { configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } }, runtime => { recommends => { "Config::JFDI" => 0, "JSON" => 0, "Plack::Middleware::CrossOrigin" => 0, "Plack::Middleware::Expires" => 0, "RDF::Endpoint" => 0.05, "RDF::Generator::Void" => 0.04, }, requires => { "Digest::MD5" => 0, "Encode" => 0, "HTML::HTML5::Writer" => 0, "HTTP::Headers" => 0, "List::Util" => 1.33, "Log::Contextual" => 0, "Log::Log4perl" => 0, "Module::Load::Conditional" => 0, "Moo" => 0, "namespace::autoclean" => 0.12, "perl" => 5.006, "Plack" => 0.9939, "RDF::Helper::Properties" => "0.10", "RDF::RDFa::Generator" => 0.102, "RDF::Trine" => 0.133, "Scalar::Util" => 0, "Try::Tiny" => 0, "Types::Standard" => 0, "URI" => 1.52, "URI::NamespaceMap" => 0, }, }, test => { requires => { "Config::JFDI" => 0, "FindBin" => 0, "RDF::RDFa::Parser" => 0, "Test::Exception" => 0, "Test::JSON" => 0, "Test::More" => 0.88, "Test::RDF" => 1.16, "Test::WWW::Mechanize::PSGI" => 0, }, }, }, "provides" => { "Plack::App::RDF::LinkedData" => { file => "lib/Plack/App/RDF/LinkedData.pm" }, "RDF::LinkedData" => { file => "lib/RDF/LinkedData.pm", version => 0.74 }, }, "release_status" => "stable", "resources" => { bugtracker => { web => "https://github.com/kjetilk/RDF-LinkedData/issues" }, homepage => "https://metacpan.org/release/RDF-LinkedData", license => ["http://dev.perl.org/licenses/"], repository => { type => "git", web => "https://github.com/kjetilk/RDF-LinkedData/" }, x_identifier => "http://purl.org/NET/cpan-uri/dist/RDF-LinkedData/project", x_IRC => "irc://irc.perl.org/#perlrdf", x_mailinglist => "http://lists.perlrdf.org/listinfo/dev", x_wiki => "http://wiki.perlrdf.org/", }, "version" => 0.74, "x_contributors" => [ "Gregory Todd Williams ", "Patrick Hochstenbach (HOCHSTEN) ", ], "x_provides_scripts" => { "linked_data.psgi" => { file => "script/linked_data.psgi" } }, }; 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 1457012475623770 15010 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74RDF::LinkedData - A Linked Data server implementation DESCRIPTION This module is used to create a Linked Data server that can serve RDF data out of an RDF::Trine::Model. It will look up URIs in the model and do the right thing (known as the 303 dance) and mint URLs for that, as well as content negotiation. Thus, you can concentrate on URIs for your things, you need not be concerned about minting URLs for the pages to serve it. In addition, optional modules can provide other important functionalities: Cross-origin resource sharing, VoID description, cache headers, SPARQL Endpoint, Triple Pattern Fragments, etc. As such, it encompasses a fair share of Semantic Web best practices, but possibly not in a very flexible Big Data manner. INSTALLATION On Debian and derivatives, such as Ubuntu, this module can be installed with all its dependencies using apt-get install librdf-linkeddata-perl as root or using sudo. To install the most recent module, it is likely that you already have the cpan tool installed. Then just run it on the command line. If you don't have it, see http://www.cpan.org/modules/INSTALL.html Then, in the cpan tool, type install RDF::LinkedData The relevant scripts and modules will be install to different paths depending on your system. To use it, you need to find the script linked_data.psgi, e.g. using locate. CONFIGURATION *Quick setup for a demo* One-liner It is possible to make it run with a single command line, e.g.: PERLRDF_STORE="Memory;path/to/some/data.ttl" plackup -host localhost script/linked_data.psgi This will start a server with the default config on localhost on port 5000, so the URIs you're going serve from the file data.ttl will have to have a base URI http://localhost:5000/. Using perlrdf command line tool A slightly longer example requires App::perlrdf, but sets up a persistent SQLite-based triple store, parses a file and gets the server with the default config running: export PERLRDF_STORE="DBI;mymodel;DBI:SQLite:database=rdf.db" perlrdf make_store perlrdf store_load path/to/some/data.ttl plackup -host localhost script/linked_data.psgi *Configuration* To configure the system for production use, create a configuration file rdf_linkeddata.json that looks something like: { "base_uri" : "http://localhost:5000/", "store" : { "storetype" : "Memory", "sources" : [ { "file" : "/path/to/your/data.ttl", "syntax" : "turtle" } ] }, "endpoint": { "html": { "resource_links": true } }, "cors": { "origins": "*" }, "void": { "pagetitle": "VoID Description for my dataset" }, "expires" : "A86400" , "fragments" : { "fragments_path" : "/fragments" , "allow_dump_dataset" : 0 } } In your shell set export RDF_LINKEDDATA_CONFIG=/to/where/you/put/rdf_linkeddata.json If the linked_data.psgi script was installed in /usr/local/bin, go: plackup /usr/local/bin/linked_data.psgi --host localhost --port 5000 The endpoint-part of the config sets up a SPARQL Endpoint. This requires the RDF::Endpoint module, which is recommended by this module. To use it, it needs to have some config, but will use defaults. It is also possible to set an expires time. This needs Plack::Middleware::Expires and uses Apache mod_expires syntax, in the example above, it will set an expires header for all resources to expire after 1 day of access. It is strongly recommended that this is used, as it can potentially speed up access to resources that aren't accessed frequently considerably, and take load off your server. The cors-part of the config enables Cross-Origin Resource Sharing, which is a W3C Recommendation for relaxing security constraints to allow data to be shared across domains. In most cases, this is what you want when you are serving open data, but in some cases, notably intranets, this should be turned off by removing this part. The void-part generates some statistics and a description of the dataset, using RDF::Generator::Void. It is strongly recommended to install and run that, but it can take some time to generate, so you may have to set the detail level. Finally, fragments add support for Triple Pattern Fragments, a work-in-progress, initiated by http://linkeddatafragments.org/ It is a more lightweight but less powerful way to query RDF data than SPARQL. If you have this, it is recommended to have CORS enabled and required to have at least a minimal VoID setup. *Production server setup* In addition to the configuration above, a production system should set up a real Web server to run the Plack script. There are many ways to do this (as Plack provides an elegant separation of concerns between developers and system administrators). To set this up under Apache, put this in the host configuration: SetHandler perl-script PerlResponseHandler Plack::Handler::Apache2 SetEnv RDF_LINKEDDATA_CONFIG /to/where/you/put/rdf_linkeddata.json PerlSetVar psgi_app /usr/local/bin/linked_data.psgi use Plack::Handler::Apache2; $ENV{RDF_LINKEDDATA_CONFIG}='/to/where/you/put/rdf_linkeddata.json'; Plack::Handler::Apache2->preload("/usr/local/bin/linked_data.psgi"); SetHandler default-handler AUTHOR Kjetil Kjernsmo, "" BUGS Please report any bugs using github SUPPORT You can find documentation for this module with the perldoc command. perldoc RDF::LinkedData The perlrdf mailing list is the right place to seek help and discuss this module: ACKNOWLEDGEMENTS This module was started by Gregory Todd Williams "" for RDF::LinkedData::Apache, but has been almost totally rewritten. COPYRIGHT & LICENSE Copyright 2010 Gregory Todd Williams Copyright 2010 ABC Startsiden AS Copyright 2010, 2011, 2012, 2013, 2014 Kjetil Kjernsmo This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SIGNATURE000644001750001750 657212475624006 15370 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74This 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: SHA256 SHA1 8b277bd431703483abf5f1f86769ce2bf6c8fdb5 COPYRIGHT SHA1 e774b1d62cf1737294f7afd0778e8adc86d954fb CREDITS SHA1 d30b8f225ae041ab275f18b41b778e34d27c8022 Changes SHA1 a545b0fdb29256f6b04bd794e34de8e0aa421a99 INSTALL SHA1 1e48bd80fcf337dfe5aedd07d3012ffa792a162a LICENSE SHA1 8c9f2a29c5e3d541811c16c39c287fe9d8ea03bf MANIFEST SHA1 76acf9cd74969c9681321920779f855f26e0caa6 META.json SHA1 3be84614b221e868b9b740a2d6400060c607c086 META.yml SHA1 f1efd7ec940f1734f7170801692d2066d99266f3 Makefile.PL SHA1 568c261249cdf9eb591412a213dd8e8c89ee9648 README SHA1 157d43e84e6d5cfd366437aee68e9ef433d697b7 dist.ini SHA1 d00af0d194ff6fdcffbe120c1a8c3dd8a69432f8 doap.ttl SHA1 7106484d879b7659df1dfeec0d4d9c235b0368ab lib/Plack/App/RDF/LinkedData.pm SHA1 d7327191d59775c8076f823cc33674bf3a4fff9b lib/RDF/LinkedData.pm SHA1 ac489dc0edb5fbf019ec8795eb6fc9fdd6af8a9b rdf_linkeddata.json SHA1 11cb972dfd9bfcab87895e485dc2a92487d900fa rdf_linkeddata_acl.json SHA1 5b8f0b2e42bf2a1350789102ada489e3baf66c61 rdf_linkeddata_dev.json SHA1 7615d2557aa4bfec8779dcfb077144fd19419123 rdf_linkeddata_end.json SHA1 908dc82f2e5e06eb7b729d0bb6d50177bcecf31b rdf_linkeddata_void.json SHA1 401b3ede97098e71a188dbdecae07f6c0a23956e script/linked_data.psgi SHA1 af175eb27d75d4dc2890b917d845a2e2b04b5d49 t/00-load.t SHA1 30f3237b0c05d40a7e5ff60ceec0f9eaa4b4e435 t/10-basic.t SHA1 f1542abc490ba630eb93d7fbb0c689a6d96788e8 t/11-constructor.t SHA1 cad7ecd9da1827b51e2ca73e4e1b8ab1fe40e1d5 t/15-process.t SHA1 ecee325c14bbcae1615feadde5b679711fb1528a t/16-void.t SHA1 0b9926e533ee024f0f9dd23d12f57b7460370e4f t/17-hypermedia-ro.t SHA1 5dc579f7e11407c916cc52d177426d308e3092f5 t/18-fragments.t SHA1 c0b3595724941c5698fa493d96c1aae49ba0fad1 t/19_config_file.t SHA1 0ff5f39448674ac1194fc4b3d8ea72122ae2c48d t/20-psgi-basic.t SHA1 09f9884f7d7e37d90a3c3a043f5cce72a88dc82f t/25-psgi-endpoint.t SHA1 ba0c76e98294b76aebfd5326afa3aacd7c8df663 t/28-psgi-void.t SHA1 1d86dd1d9b115cd33c2c38402d1c99d069aa1918 t/data/add.ttl SHA1 a0946a1631578df073be5dbef1e81694bcd83fd2 t/data/basic.ttl SHA1 262ba8c31b0d06304f5cdd1dbfcf1e6ad8e189d5 t/data/fragments.ttl -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUBVPcn+n++6N86nkqlAQiWTQ//T0KOkAomrMJ2w2iWlwICTVUxfw2db7ab qOFCimDk7C12Z8GG/FIf0xnwgRVPAxFZpcXKmPkEHvj52MarlJFTBeHOZAFu88fP x06GFflazssfawsUaOdo1//Ntn/AiE38zV3lN2V5a4l1VYAQJ+q3PZPfUzltnTqL BPM2c2u9ICLGLgGZtc6e+eidZ/f75lTPvIbGKj2vNWVKbDBBn9PUSDdD/U0bKe7a hfaN4gM6BXCKhP5+HLLZkutA9uCOKMpNjsLFx1iv/v6ihioaDKl7cwLmDJ9tnbrd 5F8oYiwhDXwB1lirtVcK9lbze28fVbVYdGrBax3+L729RJfcqdP7/jv5beDQZLyn DhDGCdg7Gx8qap6lWu6DmUYdAg+hH4hDVpWZ3paF4EhEzQW1WsdV78PXH0lW3B8o G2tTIWnLS7qWKx0PikiBnKfkfIhmmxF3K0WqsXqLJBG1AG53PEmeiRyAv1Lg3+6z ZygUgdC9Zd17BTbHCKuwFaUkCSgH3XKIh+HR7+AE+9b5ewD8gaVLnlDntgJpWCN2 pGjHLYhQNaBk4nb3TrWFXRBSpJ/h43xKL5gGUr6fZwB3d208OepbA2FxDUPE3TrJ 6aW/PgLmc1fGkcwCGE5jq9r06ZryHgRm00ln+dkSJv4Aph4VTKAWO4eaX5XMetep uCnVDPb1lRM= =iy/J -----END PGP SIGNATURE----- dist.ini000644001750001750 7712475623770 15511 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74;;class='Dist::Inkt::Profile::TOBYINK' ;;name='RDF-LinkedData' doap.ttl000644001750001750 7615712475623772 15613 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74@prefix cpan-uri: . @prefix dc: . @prefix doap: . @prefix doap-changeset: . @prefix doap-deps: . @prefix foaf: . @prefix owl: . @prefix prov: . @prefix rdfs: . @prefix xsd: . dc:creator ; dc:subject ; dc:title "DOAP for RDF-LinkedData"@en. rdfs:label "Semantic Web"@en. a foaf:Person; foaf:mbox ; foaf:name "Gregory Todd Williams"; owl:sameAs . a doap:Version; rdfs:label "Code on Github by Gregory Todd Williams."@en; dc:issued "2010-04-28"^^xsd:date; doap:revision "0.001_01"^^xsd:string. a doap:Project; cpan-uri:x_IRC ; doap-deps:runtime-recommendation [ doap-deps:on "Config::JFDI"^^doap-deps:CpanId ], [ doap-deps:on "JSON"^^doap-deps:CpanId ], [ doap-deps:on "RDF::Endpoint 0.05"^^doap-deps:CpanId ], [ doap-deps:on "Plack::Middleware::CrossOrigin"^^doap-deps:CpanId; ], [ doap-deps:on "Plack::Middleware::Expires"^^doap-deps:CpanId; ], [ doap-deps:on "RDF::Generator::Void 0.04"^^doap-deps:CpanId; ]; doap-deps:runtime-requirement [ doap-deps:on "Log::Log4perl"^^doap-deps:CpanId ], [ doap-deps:on "RDF::Trine 0.133"^^doap-deps:CpanId ], [ doap-deps:on "Scalar::Util"^^doap-deps:CpanId ], [ doap-deps:on "Plack 0.9939"^^doap-deps:CpanId ], [ doap-deps:on "namespace::autoclean 0.12"^^doap-deps:CpanId; ], [ doap-deps:on "HTTP::Headers"^^doap-deps:CpanId ], [ doap-deps:on "RDF::Helper::Properties 0.10"^^doap-deps:CpanId; ], [ doap-deps:on "URI 1.52"^^doap-deps:CpanId ], [ doap-deps:on "URI::NamespaceMap"^^doap-deps:CpanId ], [ doap-deps:on "Module::Load::Conditional"^^doap-deps:CpanId; ], [ doap-deps:on "Encode"^^doap-deps:CpanId ], [ doap-deps:on "RDF::RDFa::Generator 0.102"^^doap-deps:CpanId; ], [ doap-deps:on "HTML::HTML5::Writer"^^doap-deps:CpanId; ], [ doap-deps:on "Digest::MD5"^^doap-deps:CpanId ], [ doap-deps:on "Try::Tiny"^^doap-deps:CpanId ], [ doap-deps:on "perl 5.006"^^doap-deps:CpanId ], [ doap-deps:on "Moo"^^doap-deps:CpanId ], [ doap-deps:on "List::Util 1.33"^^doap-deps:CpanId ], [ doap-deps:on "Types::Standard"^^doap-deps:CpanId ], [ doap-deps:on "Log::Contextual"^^doap-deps:CpanId ]; doap-deps:test-requirement [ doap-deps:on "Test::More 0.88"^^doap-deps:CpanId ], [ doap-deps:on "Test::RDF 1.16"^^doap-deps:CpanId ], [ doap-deps:on "FindBin"^^doap-deps:CpanId ], [ doap-deps:on "Test::WWW::Mechanize::PSGI"^^doap-deps:CpanId; ], [ doap-deps:on "Test::Exception"^^doap-deps:CpanId ], [ doap-deps:on "Config::JFDI"^^doap-deps:CpanId ], [ doap-deps:on "Test::JSON"^^doap-deps:CpanId ], [ doap-deps:on "RDF::RDFa::Parser"^^doap-deps:CpanId ]; doap:bug-database ; doap:category ; doap:created "2009-04-23"^^xsd:date; doap:developer ; doap:download-page ; doap:homepage ; doap:license ; doap:mailing-list ; doap:maintainer ; doap:name "RDF-LinkedData"; doap:programming-language "Perl"; doap:release , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ; doap:repository [ a doap:GitRepository; doap:browse ; prov:has_provenance ; ]; doap:shortdesc "Base class and scripts for servers that serve RDF as Linked Data."@en; doap:wiki ; owl:sameAs ; rdfs:seeAlso . a doap:Version; rdfs:label "Stability and modernization release."@en; dc:issued "2013-07-23"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Simplify setting headers by removing call to HTTP::Headers."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Fix newline bug causing problems."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Allow POST requests to the endpoint."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Add the use of content type to Etag to work around some bugs."@en; ], [ a doap-changeset:Update; rdfs:label "Use URI::NamespaceMap for namespaces."@en; ], [ a doap-changeset:Change; rdfs:label "Change packaging to use Module::Package::RDF."@en; ], [ a doap-changeset:Change; rdfs:label "Improved tests."@en; ], [ a doap-changeset:Addition; rdfs:label "Enable optional use of environment for config."@en; ], [ a doap-changeset:Removal; rdfs:label "Remove write_sqlite script."@en; ]; ]; doap:revision "0.58"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Install script."@en; dc:issued "2013-07-23"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "The PSGI script wasn't installed."@en; ]; ]; doap:revision "0.60"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Add Server header."@en; dc:issued "2013-10-27"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Add a Server header."@en; ]; ]; doap:revision "0.62"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Fix bug in vocabulary URIs."@en; dc:issued "2014-05-26"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix a bug that caused some vocabularies to show up as URI::Namespace-strings."@en; ], [ a doap-changeset:Addition; rdfs:label "Add git2prov links to the meta information, so there's a linked data chain from Github."@en; ]; ]; doap:revision "0.64"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Fix bug in ETag handling."@en; dc:issued "2014-07-11"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "ETags could have the URI prefixed."@en; ], [ a doap-changeset:Bugfix; rdfs:label "RFC2616 says ETags have to be quoted."@en; ], [ a doap-changeset:Change; rdfs:label "Make ETags use base64 encoding rather than a hex."@en; ]; ]; doap:revision "0.66"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Documentation updates and small fixes."@en; dc:issued "2014-07-22"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Use Try::Tiny instead of eval."@en; ], [ a doap-changeset:Change; rdfs:label "Drop the weak ETag checking."@en; ], [ a doap-changeset:Update; rdfs:label "Many smaller documentation updates."@en; ], [ a doap-changeset:Change; rdfs:label "Document the use of the PERLRDF_STORE environment variable."@en; ]; ]; doap:revision "0.68"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Triple Pattern Fragments support and modernization."@en; dc:issued "2014-10-17"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Add the use of Expires module."@en; ], [ a doap-changeset:Addition; rdfs:label "Support the .well-known/void magic URL."@en; ], [ a doap-changeset:Change; rdfs:label "Hand-maintain README."@en; ], [ a doap-changeset:Change; rdfs:label "Migrate object system from Moose to Moo."@en; ], [ a doap-changeset:Change; rdfs:label "Use Log::Contextual to manage the logging."@en; ], [ a doap-changeset:Change; rdfs:label "Use Dist::Inkt to package."@en; ], [ a doap-changeset:Addition; rdfs:label "Triple Pattern Fragments support."@en; ], [ a doap-changeset:Addition; rdfs:label "Improve documentation."@en; ]; ]; doap:revision "0.70"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Triple Pattern Fragments improvement."@en; dc:issued "2015-02-14"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Adding support to download the complete datasets as fragments."@en; doap-changeset:blame ; ], [ a doap-changeset:Addition; rdfs:label "Set explicit Perl version."@en; ]; ]; doap:revision "0.72"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Fix Triple Pattern Fragments bugfix."@en; dc:issued "2015-03-04"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix the template to be Hydra compliant."@en; doap-changeset:blame ; ], [ a doap-changeset:Change; rdfs:label "Move Perl version setting to makefile."@en; ]; ]; doap:revision "0.74"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Initial release. Kjetil Kjernsmo refactored Gregs code to separate the web server logic from the rest."@en; dc:issued "2010-04-29"^^xsd:date; doap:revision "0.01"^^xsd:string. a doap:Version; rdfs:label "Use RDF::Trine's conneg and bounded description code."@en; dc:issued "2010-05-05"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ rdfs:label "Require RDF::Trine 0.121."@en ], [ a doap-changeset:Addition; rdfs:label "Use RDF::Trine's content negotiation code."@en; ], [ a doap-changeset:Addition; rdfs:label "Use RDF::Trine's bounded description code."@en; ], [ a doap-changeset:Addition; rdfs:label "Use a HTTP::Headers object for conneg."@en; ], [ a doap-changeset:Addition; rdfs:label "Add some log messages."@en; ], [ a doap-changeset:Addition; rdfs:label "Add and improve a type method that returns page or data."@en; ], [ a doap-changeset:Removal; rdfs:label "Remove the negotiate method."@en; ]; ]; doap:revision "0.02"^^xsd:string. a doap:Version; rdfs:label "Add page method to use foaf:page for redirects."@en; dc:issued "2010-05-06"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Really does require RDF::Trine 0.122."@en; ], [ rdfs:label "Minor cleanups."@en ], [ a doap-changeset:Addition; rdfs:label "Add a page method that uses foaf:homepage or foaf:page to override the default page for redirect."@en; ], [ a doap-changeset:Removal; rdfs:label "Remove boilerplate tests."@en; ]; ]; doap:revision "0.03"^^xsd:string. a doap:Version; rdfs:label "Major refactor, use Moose and Plack."@en; dc:issued "2010-06-13"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ rdfs:label "Many smaller changes."@en ], [ a doap-changeset:Addition; rdfs:label "use Moose"@en; ], [ a doap-changeset:Addition; rdfs:label "A response method contains most of the logic."@en; ], [ a doap-changeset:Addition; rdfs:label "More tests, also unit testing."@en; ], [ a doap-changeset:Addition; rdfs:label "Create RDF::LinkedData::ProviderRole, a Moose::Role with a default implementation."@en; ], [ a doap-changeset:Addition; rdfs:label "Create a RDF::LinkedData::Predicates with a title, description and page methods."@en; ], [ a doap-changeset:Addition; rdfs:label "Use Config::JFDI for configuration."@en; ], [ a doap-changeset:Addition; rdfs:label "More documentation."@en; ], [ a doap-changeset:Addition; rdfs:label "Use Plack::Response and HTTP::Headers in the role itself."@en; ], [ a doap-changeset:Addition; rdfs:label "Create a Plack PSGI script to run the server. This also serves as a basic usage example."@en; ], [ a doap-changeset:Removal; rdfs:label "Remove Mojolicious::Lite script."@en; ]; ]; doap:revision "0.05"^^xsd:string. a doap:Version; rdfs:label "Minor POD syntax documentation bug fix release."@en; dc:issued "2010-06-13"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix minor POD bugs."@en; ], [ a doap-changeset:Addition; rdfs:label "Add number of PSGI tests."@en; ]; ]; doap:revision "0.06"^^xsd:string. a doap:Version; rdfs:label "Update to use config hashrefs and various fixes for recent RDF::Trine."@en; dc:issued "2010-08-02"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Require RDF::Trine 0.125."@en; ], [ a doap-changeset:Update; rdfs:label "Explicitly ask for text/html in tests since RDF::Trine 0.124 needs it."@en; ], [ a doap-changeset:Update; rdfs:label "No Accept header will return turtle data."@en; ], [ a doap-changeset:Change; rdfs:label "Now use a hashref config for new_with_config instead of config string."@en; ]; ]; doap:revision "0.08"^^xsd:string. a doap:Version; rdfs:label "Refactor helper modules; ."@en; dc:issued "2010-08-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Split off RDF::LinkedData::Predicates into distribution of its own."@en; ], [ a doap-changeset:Addition; rdfs:label "Add namespaces method to set a hashref with RDF namespaces."@en; ], [ a doap-changeset:Change; rdfs:label "Move POD-tests to xt."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Remove -T switch from load.t, since it borks on some systems."@en; ], [ a doap-changeset:Addition; rdfs:label "create a helper_properties method to pass the properties."@en; ]; ]; doap:revision "0.09_1"^^xsd:string. a doap:Version; rdfs:label "Better tested release."@en; dc:issued "2010-08-19"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Add TODO test to check whether Firefox' default Accept header returns data."@en; ]; ]; doap:revision "0.10"^^xsd:string. a doap:Version; rdfs:label "Support base URI."@en; dc:issued "2010-08-24"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Support base URI in serializations for RDF::Trine 0.127_02."@en; ], [ a doap-changeset:Addition; rdfs:label "Use Module::Install::AuthorTests."@en; ]; ]; doap:revision "0.12"^^xsd:string. a doap:Version; rdfs:label "Use URI object."@en; dc:issued "2010-08-26"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Minor documentation fixes."@en; ], [ a doap-changeset:Update; rdfs:label "Using URI objects throughout makes more intensive use of absolute URIs."@en; ], [ a doap-changeset:Update; rdfs:label "Fix the warning described in http://search.cpan.org/~shlomif/Error-0.17016/lib/Error.pm#COMPATIBILITY"@en; ]; ]; doap:revision "0.14"^^xsd:string. a doap:Version; rdfs:label "Instantiate on startup; Many small fixes."@en; dc:issued "2010-12-09"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Many minor documentation fixes."@en; ], [ a doap-changeset:Change; rdfs:label "Many minor test and code fixes."@en; ], [ a doap-changeset:Change; rdfs:label "No main-namespaced variable needed for tests."@en; ], [ a doap-changeset:Change; rdfs:label "Remove logging unless in verbose mode."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Move ld instantiation to outside of the coderef for big performance gain."@en; ], [ a doap-changeset:Addition; rdfs:label "Add basic support for Access-Control-Allow-Origin."@en; ], [ a doap-changeset:Addition; rdfs:label "Support setting namespace in config."@en; ], [ a doap-changeset:Addition; rdfs:label "Add tests for more Accept headers (TODO stuff)."@en; ], [ a doap-changeset:Addition; rdfs:label "Use the base if the source has not set its own."@en; ], [ a doap-changeset:Change; rdfs:label "Use a memory model for testing that loads the file directly"@en; ]; ]; doap:revision "0.16"^^xsd:string. a doap:Version; rdfs:label "Minor JSON syntax documentation bug fix release."@en; dc:issued "2010-12-09"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Found out the hard way that JSON doesn't allow single quotes."@en; ]; ]; doap:revision "0.18"^^xsd:string. a doap:Version; rdfs:label "Improved conneg; use Test::RDF; Many small fixes."@en; dc:issued "2011-02-08"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Many minor documentation fixes."@en; ], [ a doap-changeset:Change; rdfs:label "Many minor test and code fixes."@en; ], [ a doap-changeset:Change; rdfs:label "Use the new Test::RDF module for testing."@en; ], [ a doap-changeset:Update; rdfs:label "Now requires RDF::Trine 0.133."@en; ], [ a doap-changeset:Change; rdfs:label "Consistently name the base URI base_uri."@en; ], [ a doap-changeset:Change; rdfs:label "Content negotation much improved."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Gives HTML page for default Firefox Accept header."@en; ], [ a doap-changeset:Addition; rdfs:label "Add tests for more browser Accept headers."@en; ], [ a doap-changeset:Addition; rdfs:label "Improve documentation of configuration (thanks to Thomas Kappler for input)."@en; ], [ a doap-changeset:Change; rdfs:label "Now use the RDF::Trine::Store->new method, since it now supports checking the type itself."@en; ]; ]; doap:revision "0.20"^^xsd:string. a doap:Version; rdfs:label "Use RDF::Endpoint for the same data."@en; dc:issued "2011-06-09"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Allow namespaces to be skipped from the config."@en; ], [ a doap-changeset:Addition; rdfs:label "Optionally use RDF::Endpoint to set up a SPARQL endpoint for the data."@en; ], [ a doap-changeset:Change; rdfs:label "Many minor documentation fixes."@en; ], [ a doap-changeset:Change; rdfs:label "Many minor test and code fixes."@en; ], [ a doap-changeset:Removal; rdfs:label "headers_in method removed."@en; ], [ a doap-changeset:Addition; rdfs:label "Added request method to pass the whole request rather than just headers."@en; ], [ a doap-changeset:Change; rdfs:label "Remove Test::NoWarnings; too many false positives."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Correct test dep to Test::JSON rather than just JSON."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Add the subject URI to the HTML output, since this would often break."@en; ]; ]; doap:revision "0.30"^^xsd:string. a doap:Version; rdfs:label "Refactoring and code improvements."@en; dc:issued "2012-04-04"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Add URI::Escape configure_requires."@en; ], [ a doap-changeset:Addition; rdfs:label "More tests on HTML/RDFa content."@en; ], [ a doap-changeset:Addition; rdfs:label "Use Module::Install::RDF to manage the metadata."@en; ], [ a doap-changeset:Change; rdfs:label "Restructure the documentation."@en; ], [ a doap-changeset:Change; rdfs:label "Many minor test and code fixes."@en; ], [ a doap-changeset:Removal; rdfs:label "Remove the Moose::Role, not clear that we need it."@en; ], [ a doap-changeset:Change; rdfs:label "Use RDF::RDFa::Generator. This alters the HTML output significantly."@en; ], [ a doap-changeset:Change; rdfs:label "Major refactor to improve the RDF::LinkedData class."@en; ], [ a doap-changeset:Addition; rdfs:label "Major refactor to create a Plack::App::RDF::LinkedData."@en; ], [ a doap-changeset:Addition; rdfs:label "Add Etag support"@en; ], [ a doap-changeset:Addition; rdfs:label "Use several Middleware modules in the psgi (For HEAD requests, CORS and Etag)."@en; ], [ a doap-changeset:Change; rdfs:label "Use MooseX::UndefTolerant to allow the endpoint_config to be undef."@en; ]; ]; doap:revision "0.40"^^xsd:string. a doap:Version; rdfs:label "Enable very basic VoID for hypermedia."@en; dc:issued "2012-06-11"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Add hypermedia method which will be on by default to enable hypermedia."@en; ], [ a doap-changeset:Addition; rdfs:label "Add namespaces_as_vocabularies method which will be on by default to use declared namespaces as vocabularies."@en; ], [ a doap-changeset:Addition; rdfs:label "Add void:endpoint and void:vocabulary to all output if enabled."@en; ], [ a doap-changeset:Change; rdfs:label "TODO test about content type now pass."@en; ], [ a doap-changeset:Change; rdfs:label "Some minor test and code fixes."@en; ], [ a doap-changeset:Change; rdfs:label "Use Test::RDF 0.26."@en; ], [ a doap-changeset:Change; rdfs:label "Use the github issue tracker."@en; ]; ]; doap:revision "0.42"^^xsd:string. a doap:Version; rdfs:label "Bugfix release."@en; dc:issued "2012-06-12"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Some minor fixes."@en; ], [ a doap-changeset:Bugfix; rdfs:label "The endpoint path was not correctly sent to the hypermedia."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Actually, the TODO test about content type failed for everyone else."@en; ], [ a doap-changeset:Addition; rdfs:label "More tests (obviously)."@en; ], [ a doap-changeset:Change; rdfs:label "Use empty string as default base_uri"@en; ]; ]; doap:revision "0.44"^^xsd:string. a doap:Version; rdfs:label "Use VoID Generator."@en; dc:issued "2012-06-29"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Some minor fixes."@en; ], [ a doap-changeset:Change; rdfs:label "The content method is now private."@en; ], [ a doap-changeset:Addition; rdfs:label "RDF::LinkedData now can use RDF::Generator::Void, but not all its features."@en; ], [ a doap-changeset:Addition; rdfs:label "Add descriptions to POD and README."@en; ], [ a doap-changeset:Removal; rdfs:label "Remove SQLite generator script."@en; ], [ a doap-changeset:Change; rdfs:label "Use current_etag instead of etag"@en; ]; ]; doap:revision "0.50"^^xsd:string. a doap:Version; rdfs:label "Bugfix release."@en; dc:issued "2012-06-30"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "A bad plan caused by superfluous BEGIN block caused test failures."@en; ]; ]; doap:revision "0.52"^^xsd:string. a doap:Version; rdfs:label "Improve VoID generator use."@en; dc:issued "2012-06-30"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Some minor fixes."@en; ], [ a doap-changeset:Change; rdfs:label "Add a pagetitle config parameter for RDFa title."@en; ], [ a doap-changeset:Addition; rdfs:label "Use the Generators new feature to add a model with arbitrary data to load a file."@en; ], [ a doap-changeset:Addition; rdfs:label "Make it possible to use the Generators property attributes."@en; ]; ]; doap:revision "0.54"^^xsd:string. a doap:Version; rdfs:label "Bugfix release."@en; dc:issued "2012-07-29"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix major UTF8 breakage by encoding all strings."@en; ], [ a doap-changeset:Change; rdfs:label "Some cosmetic fixes."@en; ], [ a doap-changeset:Addition; rdfs:label "More tests."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Fix performance problems caused by regeneration of VoID descriptions for every request."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Fix performance problems by stat-ing the external VoID-file to see if needs reloading."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Improve the way different HTML serializations are returned."@en; ], [ a doap-changeset:Change; rdfs:label "Skip some tests when Redland is installed, causes test-specific bugs."@en; ]; ]; doap:revision "0.56"^^xsd:string. a foaf:Person; foaf:homepage ; foaf:mbox ; foaf:name "Patrick Hochstenbach"; owl:sameAs . a foaf:Person; foaf:mbox ; foaf:name "Kjetil Kjernsmo"; owl:sameAs , . rdf_linkeddata.json000644001750001750 54712475623770 17715 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74{ "base_uri" : "http://localhost/", "store" : { "storetype" : "Memory", "sources" : [ { "file" : "t/data/basic.ttl", "syntax" : "turtle" } ] }, "namespaces" : { "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", "dct" : "http://purl.org/dc/terms/" }, "cors" : { "origins" : "*" } }rdf_linkeddata_acl.json000644001750001750 70312475623770 20526 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74{ "base_uri" : "http://localhost", "store" : { "storetype" : "Memory", "sources" : [ { "file" : "t/data/basic.ttl", "syntax" : "turtle" } ] }, "namespaces" : { "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", "dct" : "http://purl.org/dc/terms/" }, "acl" : { "store" : { "storetype" : "Memory", "sources" : [ { "file" : "t/data/acl.ttl", "syntax" : "turtle" } ] } } }rdf_linkeddata_dev.json000644001750001750 104112475623770 20561 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74{ "base_uri" : "http://localhost:8000/", "store" : { "storetype" : "Memory", "sources" : [ { "file" : "/tmp/kommune-navn.ttl", "syntax" : "turtle" } ] }, "namespaces" : { "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", "dct" : "http://purl.org/dc/terms/" }, "cors" : { "origins" : "*" }, "endpoint" : { "foo" : "1" }, "void": { "pagetitle": "VoID Description for my dataset", "add_void": { "file": "t/data/add.ttl", "syntax": "turtle" } } }rdf_linkeddata_end.json000644001750001750 55712475623770 20544 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74{ "base_uri" : "http://localhost/", "store" : { "storetype" : "Memory", "sources" : [ { "file" : "t/data/basic.ttl", "syntax" : "turtle" } ] }, "endpoint": { "html": { "resource_links": true } }, "namespaces" : { "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", "dct" : "http://purl.org/dc/terms/" } }rdf_linkeddata_void.json000644001750001750 125512475623770 20753 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74{ "base_uri" : "http://localhost", "store" : { "storetype" : "Memory", "sources" : [ { "file" : "t/data/basic.ttl", "syntax" : "turtle" } ] }, "endpoint": { "html": { "resource_links": true } }, "fragments" : { "fragments_path" : "/fragments" , "allow_dump_dataset" : 0 }, "namespaces" : { "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", "dct" : "http://purl.org/dc/terms/" }, "void": { "pagetitle": "VoID Description for my dataset", "titles": [ [ "This is a title", "en" ], [ "Dette er en tittel", "no" ]], "add_void": { "file": "t/data/add.ttl", "syntax": "turtle" } } }linked_data.psgi000644001750001750 311012475623770 20523 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/script#!/usr/bin/perl use strict; use warnings; use Plack::App::RDF::LinkedData; use RDF::LinkedData; use Plack::Request; use Plack::Builder; use Config::JFDI; use Carp qw(confess); use Module::Load::Conditional qw[can_load]; =head1 NAME linked_data.psgi - A simple Plack server for RDF as linked data =head1 INSTRUCTIONS See L for instructions on how to use this. =cut my $config; BEGIN { unless ($config = Config::JFDI->open( name => "RDF::LinkedData" )) { if ($ENV{'PERLRDF_STORE'}) { $config->{store} = $ENV{'PERLRDF_STORE'}; $config->{base_uri} = 'http://localhost:5000'; } else { confess "Couldn't find config"; } } } my $linkeddata = Plack::App::RDF::LinkedData->new(); $linkeddata->configure($config); my $rdf_linkeddata = $linkeddata->to_app; builder { enable "Head"; enable "ContentLength"; enable "ConditionalGET"; if (defined($config->{expires}) && (can_load( modules => { 'Plack::Middleware::Expires' => 0 }))) { enable 'Expires', content_type => qr//, expires => $config->{expires} }; if (can_load( modules => { 'Plack::Middleware::CrossOrigin' => 0 })) { enable 'CrossOrigin' => %{$config->{cors}}}; $rdf_linkeddata; }; __END__ =head1 AUTHOR Kjetil Kjernsmo C<< >> =head1 COPYRIGHT Copyright (c) 2010 ABC Startsiden AS and Gregory Todd Williams and 2010, 2011, 2012, 2013, 2014, 2015 Kjetil Kjernsmo. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 00-load.t000644001750001750 23012475623770 15640 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t#!perl use Test::More tests => 1; BEGIN { use_ok( 'RDF::LinkedData' ); } diag( "Testing RDF::LinkedData $RDF::LinkedData::VERSION, Perl $], $^X" ); 10-basic.t000644001750001750 630412475623770 16033 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t#!/usr/bin/perl use FindBin qw($Bin); use Plack::Request; use strict; use Test::More;# tests => 23; use Test::RDF; use Test::Exception; my $file = $Bin . '/data/basic.ttl'; use Log::Log4perl qw(:easy); Log::Log4perl->easy_init( { level => $FATAL } ) unless $ENV{TEST_VERBOSE}; BEGIN { use_ok('RDF::LinkedData'); use_ok('URI::NamespaceMap'); use_ok('RDF::Helper::Properties'); use_ok('RDF::Trine::Parser'); use_ok('RDF::Trine::Model'); } my $parser = RDF::Trine::Parser->new( 'turtle' ); my $model = RDF::Trine::Model->temporary_model; my $base_uri = 'http://localhost'; $parser->parse_file_into_model( $base_uri, $file, $model ); ok($model, "We have a model"); my $ld = RDF::LinkedData->new(model => $model, base_uri=>$base_uri, hypermedia => 0); isa_ok($ld, 'RDF::LinkedData'); is($ld->count, 3, "There are 3 triples in model"); is_deeply($ld->model, $model, "The model is still the model"); is($ld->base_uri, $base_uri, "The base is still the base"); my $node = $ld->my_node(URI->new($base_uri . '/foo')); isa_ok($node, 'RDF::Trine::Node::Resource'); is($node->uri_value, 'http://localhost/foo', "URI is still there"); my $preds = RDF::Helper::Properties->new(model => $model); is($preds->title($node), 'This is a test', "Correct title"); { my $req = Plack::Request->new({ HTTP_ACCEPT => 'application/rdf+xml' }); my $ldh = $ld; $ldh->namespaces(URI::NamespaceMap->new({ skos => 'http://www.w3.org/2004/02/skos/core#', dct => 'http://purl.org/dc/terms/' } )); $ldh->request($req); my $content = $ldh->_content($node, 'data'); like($content->{body}, qr|xmlns:skos="http://www.w3.org/2004/02/skos/core#"|, 'SKOS NS URI'); is($content->{content_type}, 'application/rdf+xml', "RDF/XML content type"); } { my $req = Plack::Request->new({ HTTP_ACCEPT => 'application/turtle'}); my $ldh = $ld; $ldh->request($req); my $content = $ldh->_content($node, 'data'); is($content->{content_type}, 'application/turtle', "Turtle content type"); is_valid_rdf($content->{body}, 'turtle', '/foo return RDF validates'); is_rdf($content->{body}, 'turtle', "\@base .\n\@prefix rdfs: .\n\n rdfs:label \"This is a test\"\@en ; \n .", 'turtle', '/foo return RDF is OK'); like($content->{body}, qr/\@base <$base_uri> ./, 'Base URI is present in serialization'); } my $barnode = $ld->my_node(URI->new($base_uri . '/bar/baz/bing')); isa_ok($node, 'RDF::Trine::Node::Resource'); is($barnode->uri_value, 'http://localhost/bar/baz/bing', "'Bar' URI is still there"); { my $req = Plack::Request->new({ HTTP_ACCEPT => 'text/html'}); my $ldh = $ld; $ldh->request($req); my $content = $ldh->_content($barnode, 'data'); is($content->{content_type}, 'text/html', "HTML is proper data type"); { my $mcontent = $ldh->_content($barnode, 'page'); is($mcontent->{content_type}, 'text/html', "Page gives HTML"); } } is($preds->page($node), 'http://en.wikipedia.org/wiki/Foo', "/foo has a foaf:page at Wikipedia"); is($preds->page($barnode), 'http://localhost/bar/baz/bing/page', "/bar/baz/bing has default page"); done_testing; 11-constructor.t000644001750001750 136312475623770 17340 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t#!/usr/bin/perl use strict; use FindBin qw($Bin); use Test::More tests => 7; my $base_uri = 'http://localhost'; use_ok('RDF::LinkedData'); my $store = { storetype => 'Memory', sources => [ { file => $Bin . '/data/basic.ttl', syntax => 'turtle' } ] }; { my $ld = RDF::LinkedData->new(store => $store, base_uri=>$base_uri); isa_ok($ld, 'RDF::LinkedData'); is($ld->count, 3, "There are 3 triples in model"); ok(!$ld->has_endpoint_config, 'No endpoint configged'); } { my $ld = RDF::LinkedData->new(store => $store, endpoint_config => undef, base_uri=>$base_uri); isa_ok($ld, 'RDF::LinkedData'); is($ld->count, 3, "There are 3 triples in model"); ok(!$ld->has_endpoint_config, 'No endpoint configged'); } done_testing; 15-process.t000644001750001750 1152412475623770 16455 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t#!/usr/bin/perl use FindBin qw($Bin); use Plack::Request; use strict; use Test::More tests => 39; use Test::RDF; use Log::Log4perl qw(:easy); use Module::Load::Conditional qw[can_load]; Log::Log4perl->easy_init( { level => $FATAL } ) unless $ENV{TEST_VERBOSE}; my $file = $Bin . '/data/basic.ttl'; BEGIN { use_ok('RDF::LinkedData'); use_ok('RDF::Helper::Properties'); use_ok('RDF::Trine::Parser'); use_ok('RDF::Trine::Model'); } my $parser = RDF::Trine::Parser->new( 'turtle' ); my $model = RDF::Trine::Model->temporary_model; my $base_uri = 'http://localhost'; $parser->parse_file_into_model( $base_uri, $file, $model ); ok($model, "We have a model"); my $ld = can_load( modules => { 'RDF::Endpoint' => 0.03 }) ? RDF::LinkedData->new(model => $model, base=>$base_uri, endpoint_config => {endpoint_path => '/sparql'}) : RDF::LinkedData->new(model => $model, base=>$base_uri); isa_ok($ld, 'RDF::LinkedData'); cmp_ok($ld->count, '>', 0, "There are triples in the model"); { note "Get /foo"; $ld->request(Plack::Request->new({})); my $response = $ld->response($base_uri . '/foo'); isa_ok($response, 'Plack::Response'); is($response->status, 303, "Returns 303"); like($response->header('Location'), qr|/foo/data$|, "Location is OK"); } { note "Get /foo, ask for text/html"; $ld->request(Plack::Request->new({ HTTP_ACCEPT => 'text/html' })); my $response = $ld->response($base_uri . '/foo'); isa_ok($response, 'Plack::Response'); is($response->status, 303, "Returns 303"); is($response->header('Location'), 'http://en.wikipedia.org/wiki/Foo', "Location is Wikipedia page"); } { note "Get /foo, use Firefox' default Accept header"; $ld->request(Plack::Request->new({ HTTP_ACCEPT => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'})); my $response = $ld->response($base_uri . '/foo'); isa_ok($response, 'Plack::Response'); is($response->status, 303, "Returns 303"); is($response->header('Location'), 'http://en.wikipedia.org/wiki/Foo', "Location is Wikipedia page"); } { note "Get /foo, ask for RDF/XML"; $ld->request(Plack::Request->new({ HTTP_ACCEPT => 'application/rdf+xml'})); my $response = $ld->response($base_uri . '/foo'); isa_ok($response, 'Plack::Response'); is($response->status, 303, "Returns 303"); like($response->header('Location'), qr|/foo/data$|, "Location is OK"); } { note "Get /foo, ask for Turtle"; $ld->request(Plack::Request->new({ HTTP_ACCEPT => 'application/turtle'})); my $response = $ld->response($base_uri . "/foo"); like($response->header('Location'), qr|/foo/data$|, "Location is OK"); } { note "Get /dahut, ask for RDF/XML"; $ld->request(Plack::Request->new({ HTTP_ACCEPT => 'application/rdf+xml'})); my $response = $ld->response($base_uri . '/dahut'); isa_ok($response, 'Plack::Response'); is($response->status, 404, "Returns 404"); } { note "Get /foo/page"; $ld->type('page'); my $response = $ld->response($base_uri . '/foo'); isa_ok($response, 'Plack::Response'); is($response->status, 301, "Returns 301"); is($response->header('Location'), 'http://en.wikipedia.org/wiki/Foo', "Location is Wikipedia page"); } { note "Get /bar/baz/bing"; $ld->request(Plack::Request->new({ HTTP_ACCEPT => 'text/html'})); my $response = $ld->response($base_uri . "/bar/baz/bing"); isa_ok($response, 'Plack::Response'); is($response->status, 303, "Returns 303"); like($response->header('Location'), qr|/bar/baz/bing/page$|, "Location is OK"); } { note "Get /bar/baz/bing/page"; $ld->type('page'); my $response = $ld->response($base_uri . "/bar/baz/bing"); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200"); is($response->content_type, 'text/html', 'Returns HTML'); like($response->body, qr|Testing with longer URI\.|, "Test phrase in content"); my $test = 'about="' . $base_uri . '/bar/baz/bing"'; like($response->body, qr|$test|, "Subject URI OK"); } { note "Get /bar/baz/bing, ask for RDF/XML"; $ld->request(Plack::Request->new({ HTTP_ACCEPT => 'application/rdf+xml'})); my $response = $ld->response($base_uri . "/bar/baz/bing"); is($response->status, 303, "Returns 303"); like($response->header('Location'), qr|/bar/baz/bing/data$|, "Location is OK"); } { note "Get /foo/data"; $ld->type('data'); my $response = $ld->response($base_uri . '/foo'); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200"); like($response->header("ETag"), qr/^\"\w+\"$/, 'Returns a suitable, quoted ETag'); my $model = RDF::Trine::Model->temporary_model; my $parser = RDF::Trine::Parser->new( 'rdfxml' ); $parser->parse_into_model( $base_uri, $response->body, $model ); has_literal('This is a test', 'en', undef, $model, "Test phrase in content"); } 16-void.t000644001750001750 1504212475623770 15740 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t#!/usr/bin/perl use FindBin qw($Bin); use Plack::Request; use strict; use Test::More; use Test::RDF; use Log::Log4perl qw(:easy); use Module::Load::Conditional qw[check_install]; use Test::RDF; use RDF::Trine qw[iri literal blank variable statement]; use RDF::Trine::Namespace qw(rdf rdfs); use RDF::Trine::Store::Hexastore; unless (defined(check_install( module => 'RDF::Generator::Void', version => 0.02))) { plan skip_all => 'You need RDF::Generator::Void for this test' } Log::Log4perl->easy_init( { level => $FATAL } ) unless $ENV{TEST_VERBOSE}; my $file = $Bin . '/data/basic.ttl'; use_ok('RDF::LinkedData'); use_ok('RDF::Generator::Void'); my $parser = RDF::Trine::Parser->new( 'turtle' ); my $store = RDF::Trine::Store::Hexastore->temporary_store; my $model = RDF::Trine::Model->new($store); my $base_uri = 'http://localhost'; $parser->parse_file_into_model( $base_uri, $file, $model ); ok($model, "We have a model"); is($model->size, 3, "We have a model with 3 statements"); my $ld = RDF::LinkedData->new(model => $model, base_uri => $base_uri, namespaces_as_vocabularies => 1, void_config => { urispace => 'http://localhost' }); isa_ok($ld, 'RDF::LinkedData'); is($ld->count, 3, "There are 3 triples in the model"); { note "Basic VoID test"; $ld->request(Plack::Request->new({})); $ld->void->add_licenses('http://example.org/open-data-license'); my $response = $ld->response($base_uri); isa_ok($response, 'Plack::Response'); my $content = $response->content; is_valid_rdf($content, 'turtle', 'Returns valid Turtle'); my $retmodel = RDF::Trine::Model->temporary_model; $parser->parse_into_model( $base_uri, $content, $retmodel ); has_subject($base_uri . '/#dataset-0', $retmodel, "Subject URI in content"); has_predicate('http://purl.org/dc/terms/license', $retmodel, "Has license predicate"); has_object_uri('http://example.org/open-data-license', $retmodel, "Has license object"); pattern_target($retmodel); my $void = RDF::Trine::Namespace->new('http://rdfs.org/ns/void#'); my $xsd = RDF::Trine::Namespace->new('http://www.w3.org/2001/XMLSchema#'); pattern_ok( statement( iri($base_uri . '/#dataset-0'), $void->triples, literal(3, undef, $xsd->integer) ), statement( iri($base_uri . '/#dataset-0'), $rdf->type, $void->Dataset ), 'Common statements are there'); } { note "Add a statement"; is($ld->count, 3, "There are 3 triples in the model"); is($ld->last_etag, $ld->current_etag, 'Etags have not changed'); $ld->model->add_statement(statement(iri($base_uri . '/foo'), $rdfs->label, literal('DAHUT'))); is($ld->count, 4, "There are 4 triples in the model"); isnt($ld->last_etag, $ld->current_etag, 'Etags have changed'); $ld->type('data'); $ld->request(Plack::Request->new({})); my $fresponse = $ld->response($base_uri .'/foo'); isa_ok($fresponse, 'Plack::Response'); like($fresponse->content, qr/DAHUT/, 'Test string in content'); $ld->request(Plack::Request->new({})); my $response = $ld->response($base_uri); isa_ok($response, 'Plack::Response'); my $content = $response->content; is_valid_rdf($content, 'turtle', 'Returns valid Turtle'); my $retmodel = RDF::Trine::Model->temporary_model; $parser->parse_into_model( $base_uri, $content, $retmodel ); has_subject($base_uri . '/#dataset-0', $retmodel, "Subject URI in content"); pattern_target($retmodel); my $void = RDF::Trine::Namespace->new('http://rdfs.org/ns/void#'); my $xsd = RDF::Trine::Namespace->new('http://www.w3.org/2001/XMLSchema#'); pattern_ok( statement( iri($base_uri . '/#dataset-0'), $void->triples, literal(4, undef, $xsd->integer) ), statement( iri($base_uri . '/#dataset-0'), $rdf->type, $void->Dataset ), 'Common statements are there'); } { note 'Test with DBI temp store'; my $dstore = RDF::Trine::Store::DBI->temporary_store; my $dmodel = RDF::Trine::Model->new($dstore); $parser->parse_file_into_model( $base_uri, $file, $dmodel ); ok($dmodel, "We have a model"); is($dmodel->size, 3, "We have a model with 3 statements"); my $dld = RDF::LinkedData->new(model => $dmodel, base_uri => $base_uri, namespaces_as_vocabularies => 1, void_config => { urispace => 'http://localhost' }); isa_ok($dld, 'RDF::LinkedData'); is($dld->count, 3, "There are 3 triples in the model"); is($dld->last_etag, $dld->current_etag, 'Etags are the same'); is($dld->current_etag, undef, 'Current Etag is undefined'); my $void = RDF::Trine::Namespace->new('http://rdfs.org/ns/void#'); my $xsd = RDF::Trine::Namespace->new('http://www.w3.org/2001/XMLSchema#'); $dld->request(Plack::Request->new({})); my $response3 = $dld->response($base_uri); isa_ok($response3, 'Plack::Response'); my $content3 = $response3->content; is_valid_rdf($content3, 'turtle', 'Returns valid Turtle'); my $retmodel3 = RDF::Trine::Model->temporary_model; $parser->parse_into_model( $base_uri, $content3, $retmodel3 ); has_subject($base_uri . '/#dataset-0', $retmodel3, "Subject URI in content"); pattern_target($retmodel3); pattern_ok( statement( iri($base_uri . '/#dataset-0'), $void->triples, literal(3, undef, $xsd->integer) ), statement( iri($base_uri . '/#dataset-0'), $rdf->type, $void->Dataset ), 'Three triples should be counted'); $dld->model->add_statement(statement(iri($base_uri . '/foo'), $rdfs->label, literal('DAHUT'))); is($dld->count, 4, "There are 4 triples in the model"); is($dld->last_etag, $dld->current_etag, 'Etags are still the same'); is($dld->current_etag, undef, 'Current Etag is still undefined'); $dld->type('data'); $dld->request(Plack::Request->new({})); my $fresponse = $dld->response($base_uri .'/foo'); isa_ok($fresponse, 'Plack::Response'); like($fresponse->content, qr/DAHUT/, 'Test string in content'); $dld->request(Plack::Request->new({})); my $response = $dld->response($base_uri); isa_ok($response, 'Plack::Response'); my $content = $response->content; is_valid_rdf($content, 'turtle', 'Returns valid Turtle'); my $retmodel = RDF::Trine::Model->temporary_model; $parser->parse_into_model( $base_uri, $content, $retmodel ); has_subject($base_uri . '/#dataset-0', $retmodel, "Subject URI in content"); pattern_target($retmodel); pattern_ok( statement( iri($base_uri . '/#dataset-0'), $void->triples, literal(4, undef, $xsd->integer) ), statement( iri($base_uri . '/#dataset-0'), $rdf->type, $void->Dataset ), '4 statements should be counted'); } done_testing; 17-hypermedia-ro.t000644001750001750 1316112475623770 17545 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t#!/usr/bin/perl use FindBin qw($Bin); use Plack::Request; use strict; use Test::More;# tests => 37; use Test::RDF; use RDF::Trine qw[iri literal blank variable statement]; use Log::Log4perl qw(:easy); use Module::Load::Conditional qw[can_load]; Log::Log4perl->easy_init( { level => $FATAL } ) unless $ENV{TEST_VERBOSE}; my $file = $Bin . '/data/basic.ttl'; BEGIN { use_ok('RDF::LinkedData'); use_ok('RDF::Helper::Properties'); use_ok('RDF::Trine::Parser'); use_ok('RDF::Trine::Model'); } my $parser = RDF::Trine::Parser->new( 'turtle' ); my $rxparser = RDF::Trine::Parser->new( 'rdfxml' ); my $model = RDF::Trine::Model->temporary_model; my $base_uri = 'http://localhost'; $parser->parse_file_into_model( $base_uri, $file, $model ); ok($model, "We have a model"); { my $ec; if (can_load( modules => { 'RDF::Endpoint' => 0.03 })) { $ec = {endpoint_path => '/sparql'} ; } my $ld = RDF::LinkedData->new(model => $model, base_uri=>$base_uri, endpoint_config => $ec); isa_ok($ld, 'RDF::LinkedData'); cmp_ok($ld->count, '>', 0, "There are triples in the model"); { note "Get /foo, ensure nothing changed."; $ld->request(Plack::Request->new({})); my $response = $ld->response($base_uri . '/foo'); isa_ok($response, 'Plack::Response'); is($response->status, 303, "Returns 303"); like($response->header('Location'), qr|/foo/data$|, "Location is OK"); } { note "Get /foo/data"; $ld->type('data'); my $response = $ld->response($base_uri . '/foo'); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200"); my $retmodel = return_model($response->content, $rxparser); has_literal('This is a test', 'en', undef, $retmodel, "Test phrase in content"); SKIP: { skip "No endpoint configured", 2 unless ($ld->has_endpoint); has_uri($base_uri . '/sparql', $retmodel, 'SPARQL Endpoint URI is in model'); pattern_target($retmodel); SKIP: { skip "Redland behaves weirdly", 1 if ($RDF::Trine::Parser::Redland::HAVE_REDLAND_PARSER); pattern_ok( statement( iri($base_uri . '/foo/data'), iri('http://rdfs.org/ns/void#inDataset'), variable('void') ), statement( variable('void'), iri('http://rdfs.org/ns/void#sparqlEndpoint'), iri($base_uri . '/sparql'), ), 'SPARQL Endpoint is present' ) } } } } { my $ld = RDF::LinkedData->new(model => $model, base_uri=>$base_uri); isa_ok($ld, 'RDF::LinkedData'); cmp_ok($ld->count, '>', 0, "There are triples in the model"); { note "Get /foo, ensure nothing changed."; $ld->request(Plack::Request->new({})); my $response = $ld->response($base_uri . '/foo'); isa_ok($response, 'Plack::Response'); is($response->status, 303, "Returns 303"); like($response->header('Location'), qr|/foo/data$|, "Location is OK"); } { note "Get /foo/data, namespaces set"; $ld->type('data'); $ld->add_namespace_mapping(skos => 'http://www.w3.org/2004/02/skos/core#'); $ld->add_namespace_mapping(dct => 'http://purl.org/dc/terms/' ); my $response = $ld->response($base_uri . '/foo'); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200"); unlike($response->content, qr/URI::Namespace=HASH/, 'We should have real URIs as vocabs'); my $retmodel = return_model($response->content, $rxparser); has_literal('This is a test', 'en', undef, $retmodel, "Test phrase in content"); has_object_uri('http://www.w3.org/2004/02/skos/core#', $retmodel, 'SKOS URI is present'); pattern_target($retmodel); SKIP: { skip "Redland behaves weirdly", 1 if ($RDF::Trine::Parser::Redland::HAVE_REDLAND_PARSER); pattern_ok( statement( iri($base_uri . '/foo/data'), iri('http://rdfs.org/ns/void#inDataset'), variable('void') ), statement( variable('void'), iri('http://rdfs.org/ns/void#vocabulary'), iri('http://www.w3.org/2004/02/skos/core#'), ), statement( variable('void'), iri('http://rdfs.org/ns/void#vocabulary'), iri('http://purl.org/dc/terms/'), ), 'Vocabularies are present' ) } } } { note "Now testing no endpoint"; my $ld = RDF::LinkedData->new(model => $model, base_uri=>$base_uri); isa_ok($ld, 'RDF::LinkedData'); cmp_ok($ld->count, '>', 0, "There are triples in the model"); $ld->type('data'); $ld->request(Plack::Request->new({})); my $response = $ld->response($base_uri . '/foo'); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200"); my $retmodel = return_model($response->content, $rxparser); has_literal('This is a test', 'en', undef, $retmodel, "Test phrase in content"); hasnt_uri('http://rdfs.org/ns/void#sparqlEndpoint', $retmodel, 'No SPARQL endpoint entered'); } { note "Now testing no endpoint"; my $ld = RDF::LinkedData->new(model => $model, base_uri=>$base_uri, namespaces_as_vocabularies => 0); isa_ok($ld, 'RDF::LinkedData'); cmp_ok($ld->count, '>', 0, "There are triples in the model"); $ld->type('data'); $ld->request(Plack::Request->new({})); my $response = $ld->response($base_uri . '/foo'); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200"); my $retmodel = return_model($response->content, $rxparser); has_literal('This is a test', 'en', undef, $retmodel, "Test phrase in content"); hasnt_uri('http://rdfs.org/ns/void#vocabulary', $retmodel, 'No vocabs entered'); } done_testing; sub return_model { my ($content, $parser) = @_; my $retmodel = RDF::Trine::Model->temporary_model; $parser->parse_into_model( $base_uri, $content, $retmodel ); return $retmodel; } 18-fragments.t000644001750001750 2420512475623770 16770 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t#!/usr/bin/perl use FindBin qw($Bin); use Plack::Request; use strict; use Test::More;# tests => 37; use Test::RDF; use RDF::Trine qw[iri literal blank variable statement]; use Log::Log4perl qw(:easy); use RDF::Trine::Namespace qw(rdf rdfs foaf); use Module::Load::Conditional qw[check_install]; use URI::Escape; unless (defined(check_install( module => 'RDF::Generator::Void', version => 0.02))) { plan skip_all => 'You need RDF::Generator::Void for this test' } Log::Log4perl->easy_init( { level => $FATAL } ) unless $ENV{TEST_VERBOSE}; my $file = $Bin . '/data/fragments.ttl'; use_ok('RDF::LinkedData'); use_ok('RDF::Generator::Void'); my $void = RDF::Trine::Namespace->new('http://rdfs.org/ns/void#'); my $xsd = RDF::Trine::Namespace->new('http://www.w3.org/2001/XMLSchema#'); my $hydra = RDF::Trine::Namespace->new('http://www.w3.org/ns/hydra/core#'); my $dcterms = RDF::Trine::Namespace->new('http://purl.org/dc/terms/'); my $parser = RDF::Trine::Parser->new( 'turtle' ); my $rxparser = RDF::Trine::Parser->new( 'rdfxml' ); my $model = RDF::Trine::Model->temporary_model; my $base_uri = 'http://localhost'; $parser->parse_file_into_model( $base_uri, $file, $model ); ok($model, "We have a model"); my $ec = {fragments_path => '/fragments'} ; my $void_subject = iri($base_uri . '/#dataset-0'); { note 'Testing the query interface itself'; my $ld = RDF::LinkedData->new(model => $model, base_uri => $base_uri, namespaces_as_vocabularies => 1, void_config => { urispace => 'http://localhost' }, fragments_config => $ec ); isa_ok($ld, 'RDF::LinkedData'); $ld->request(Plack::Request->new({})); { my $response = $ld->response($base_uri . '/fragments?subject=' . uri_escape_utf8('http://localhost/foo')); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200"); my $retmodel = return_model($response->content, $parser); has_literal('This is a test', 'en', undef, $retmodel, "Test phrase in content"); pattern_target($retmodel); pattern_ok( statement(iri($base_uri . '/foo'), $rdfs->label, literal("This is a test", 'en')), statement(iri($base_uri . '/foo'), $foaf->page, iri('http://en.wikipedia.org/wiki/Foo')) , 'Both triples present', ); pattern_ok( statement(iri($base_uri . '/fragments?subject=' . uri_escape_utf8('http://localhost/foo')), $void->triples, literal("2", undef, $xsd->integer)), statement(iri($base_uri . '/fragments?subject=' . uri_escape_utf8('http://localhost/foo')), $hydra->totalItems, literal("2", undef, $xsd->integer)), , 'Triple count is correct', ); pattern_ok( statement(iri($base_uri . '/fragments?subject=' . uri_escape_utf8('http://localhost/foo')), $dcterms->source, $void_subject), , 'Void Subject in dct:source' ); has_subject($void_subject->uri_value, $retmodel, "Void Subject URI in content"); pattern_ok( statement($void_subject, $rdf->type, $hydra->Collection), statement($void_subject, $hydra->search, blank('template')), statement(blank('template'), $hydra->template, literal($base_uri . '/fragments{?subject,predicate,object}')), statement(blank('template'), $hydra->mapping, blank('subject')), statement(blank('template'), $hydra->mapping, blank('predicate')), statement(blank('template'), $hydra->mapping, blank('predicate')), statement(blank('template'), $hydra->mapping, blank('object')), statement(blank('subject'), $hydra->property, $rdf->subject), statement(blank('subject'), $hydra->variable, literal('subject')), statement(blank('predicate'), $hydra->property, $rdf->predicate), statement(blank('predicate'), $hydra->variable, literal('predicate')), statement(blank('object'), $hydra->property, $rdf->object), statement(blank('object'), $hydra->variable, literal('object')), "Control statements OK"); } { my $response = $ld->response($base_uri . '/fragments?predicate=' . uri_escape_utf8('http://www.w3.org/2000/01/rdf-schema#label') . '&object=' . uri_escape_utf8('"Testing with longer URI."@en')); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200"); my $retmodel = return_model($response->content, $parser); has_literal('Testing with longer URI.', 'en', undef, $retmodel, "Longer test phrase is in content"); has_literal("1", undef, $xsd->integer, $retmodel, 'Triple count is correct'); hasnt_literal('This is a test', 'en', undef, $retmodel, "Test phrase isn't in content"); } { my $response = $ld->response($base_uri . '/fragments?object=' . uri_escape_utf8('"42"^^http://www.w3.org/2001/XMLSchema#integer')); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200"); my $retmodel = return_model($response->content, $parser); has_literal('42', undef, $xsd->integer, $retmodel, "The Answer is in the content"); has_literal("1", undef, $xsd->integer, $retmodel, 'Triple count is correct'); hasnt_literal('This is a test', 'en', undef, $retmodel, "Test phrase isn't in content"); } { my $response = $ld->response($base_uri . '/fragments?predicate=' . uri_escape_utf8('http://www.w3.org/2000/01/rdf-schema#label') . '&object=' . uri_escape_utf8('"Nothing here."')); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200"); my $retmodel = return_model($response->content, $parser); hasnt_literal('Testing with longer URI.', 'en', undef, $retmodel, "Longer test phrase is in content"); has_literal("0", undef, $xsd->integer, $retmodel, 'Triple count is correct'); } { my $response = $ld->response($base_uri . '/fragments?predicate=' . uri_escape_utf8('http://www.w3.org/2000/01/rdf-schema#label') . '&subject='); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200"); my $retmodel = return_model($response->content, $parser); has_subject($base_uri . '/foo', $retmodel, 'Subject 1 is correct'); has_subject($base_uri . '/bar/baz/bing', $retmodel, 'Subject 2 is correct'); has_literal("2", undef, $xsd->integer, $retmodel, 'Triple count is correct'); has_literal('This is a test', 'en', undef, $retmodel, "Test phrase is in content"); } { my $response = $ld->response($base_uri . '/fragments?subject=&predicate=&object='); isa_ok($response, 'Plack::Response'); is($response->status, 400, "Returns 400 with all parameters empty"); } { my $response = $ld->response($base_uri . '/fragments'); isa_ok($response, 'Plack::Response'); is($response->status, 400, "Returns 400 with all parameters missing"); } { my $response = $ld->response($base_uri . '/fragments?predicate=&object='); isa_ok($response, 'Plack::Response'); is($response->status, 400, "Returns 400 with subject missing other parameters empty"); } } { note 'Testing the Void for fragments'; my $ld = RDF::LinkedData->new(model => $model, base_uri=>$base_uri, fragments_config => $ec, void_config => { urispace => 'http://localhost' }); isa_ok($ld, 'RDF::LinkedData'); $ld->request(Plack::Request->new({})); my $response = $ld->response($base_uri . '/'); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200"); my $retmodel = return_model($response->content, $parser); has_subject($void_subject->uri_value, $retmodel, "Subject URI in content"); has_predicate($hydra->search->uri_value, $retmodel, 'Hydra search predicate'); pattern_target($retmodel); pattern_ok( statement( $void_subject, $void->triples, literal(4, undef, $xsd->integer) ), statement( $void_subject, $rdf->type, $void->Dataset ), 'VoID-specific statements'); pattern_ok( statement($void_subject, $rdf->type, $hydra->Collection), statement($void_subject, $hydra->search, blank('template')), statement(blank('template'), $hydra->template, literal($base_uri . '/fragments{?subject,predicate,object}')), statement(blank('template'), $hydra->mapping, blank('subject')), statement(blank('template'), $hydra->mapping, blank('predicate')), statement(blank('template'), $hydra->mapping, blank('predicate')), statement(blank('template'), $hydra->mapping, blank('object')), statement(blank('subject'), $hydra->property, $rdf->subject), statement(blank('subject'), $hydra->variable, literal('subject')), statement(blank('predicate'), $hydra->property, $rdf->predicate), statement(blank('predicate'), $hydra->variable, literal('predicate')), statement(blank('object'), $hydra->property, $rdf->object), statement(blank('object'), $hydra->variable, literal('object')), "Control statements OK"); } { note 'Testing the allow_dump_dataset feature'; my $ld = RDF::LinkedData->new(model => $model, base_uri => $base_uri, namespaces_as_vocabularies => 1, void_config => { urispace => 'http://localhost' }, fragments_config => { %$ec , allow_dump_dataset => 1 } ); isa_ok($ld, 'RDF::LinkedData'); $ld->request(Plack::Request->new({})); { my $response = $ld->response($base_uri . '/fragments?subject=&predicate=&object='); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200 with all parameters empty"); my $retmodel = return_model($response->content, $parser); has_literal("4", undef, $xsd->integer, $retmodel, 'Triple count is correct got all 4 triples'); } } sub return_model { my ($content, $parser) = @_; my $retmodel = RDF::Trine::Model->temporary_model; $parser->parse_into_model( $base_uri, $content, $retmodel ); return $retmodel; } done_testing; 19_config_file.t000644001750001750 52112475623770 17264 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t#!/usr/bin/perl use strict; use warnings; use Test::More; use Test::JSON; foreach my $filename (glob('rdf_linkeddata*json')) { ok(open(CONFIG, '<' . $filename), "Test config file $filename opened OK"); my $json = join("\n", ); close CONFIG; is_valid_json ($json, "File $filename contains valid JSON"); } done_testing(); 20-psgi-basic.t000644001750001750 2076612475623770 17024 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 60 ; use Test::RDF; use Test::WWW::Mechanize::PSGI; use Module::Load::Conditional qw[can_load]; my $tester = do "script/linked_data.psgi"; BAIL_OUT("The application is not running") unless ($tester); use Log::Log4perl qw(:easy); Log::Log4perl->easy_init( { level => $FATAL } ) unless $ENV{TEST_VERBOSE}; { note "Get /foo, no redirects"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); my $res = $mech->get("/foo"); is($mech->status, 303, "Returns 303"); like($res->header('Location'), qr|/foo/data$|, "Location is OK"); like($res->header('Server'), qr|RDF::LinkedData/$RDF::LinkedData::VERSION|, 'Server header is there' ); } foreach my $accept_header (('text/html', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1', 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5')) { note "Get /foo, no redirects, ask for $accept_header"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); $mech->default_header('Accept' => $accept_header); my $res = $mech->get("/foo"); is($mech->status, 303, "Returns 303"); is($res->header('Location'), 'http://en.wikipedia.org/wiki/Foo', "Location is Wikipedia page"); } { note "Get /foo/page, no redirects"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); my $res = $mech->get("/foo/page"); is($mech->status, 301, "Returns 301"); is($res->header('Location'), 'http://en.wikipedia.org/wiki/Foo', "Location is Wikipedia page"); } { note "Get /foo, no redirects, ask for RDF/XML"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); $mech->default_header('Accept' => 'application/rdf+xml'); my $res = $mech->get("/foo"); is($mech->status, 303, "Returns 303"); like($res->header('Location'), qr|/foo/data$|, "Location is OK"); } { note "Get /foo, no redirects, use Tabulators Accept header"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); $mech->default_header('Accept' => 'application/rdf+xml, application/xhtml+xml;q=0.3, text/xml;q=0.2, application/xml;q=0.2, text/html;q=0.3, text/plain;q=0.1, text/n3, text/rdf+n3;q=0.5, application/x-turtle;q=0.2, text/turtle;q=1'); my $res = $mech->get("/foo"); is($mech->status, 303, "Returns 303"); like($res->header('Location'), qr|/foo/data$|, "Location is OK"); } { note "Get /dahut, no redirects, ask for RDF/XML"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); $mech->default_header('Accept' => 'application/rdf+xml'); my $res = $mech->get("/dahut"); is($mech->status, 404, "Returns 404"); } my $rxparser = RDF::Trine::Parser->new( 'rdfxml' ); my $base_uri = 'http://localhost/'; { note "Get /foo, ask for RDF/XML"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->default_header('Accept' => 'application/rdf+xml'); $mech->get_ok("/foo"); is($mech->ct, 'application/rdf+xml', "Correct content-type"); like($mech->uri, qr|/foo/data$|, "Location is OK"); my $model = RDF::Trine::Model->temporary_model; is_valid_rdf($mech->content, 'rdfxml', 'Returns valid RDF/XML'); $rxparser->parse_into_model( $base_uri, $mech->content, $model ); has_subject($base_uri . 'foo', $model, "Subject URI in content"); has_literal('This is a test', 'en', undef, $model, "Test phrase in content"); } { note "Get /foo, ask for Turtle"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->default_header('Accept' => 'application/turtle'); $mech->get_ok("/foo"); is($mech->ct, 'application/turtle', "Correct content-type"); like($mech->uri, qr|/foo/data$|, "Location is OK"); my $model = RDF::Trine::Model->temporary_model; is_valid_rdf($mech->content, 'turtle', 'Returns valid Turtle'); my $parser = RDF::Trine::Parser->new( 'turtle' ); $parser->parse_into_model( $base_uri, $mech->content, $model ); has_subject($base_uri . 'foo', $model, "Subject URI in content"); has_literal('This is a test', 'en', undef, $model, "Test phrase in content"); } { note "Get /foo/data, ask for XHTML"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->default_header('Accept' => 'application/xhtml+xml'); $mech->get_ok("/foo/data"); TODO: { local $TODO = "Seems like something after Plack modifies the content type"; is($mech->ct, 'application/xhtml+xml', "Correct content-type"); } like($mech->uri, qr|/foo/data$|, "Location is OK"); $mech->content_like(qr|about=\"http://\S+?/foo\"|, 'Subject URI is OK in RDFa' ); $mech->content_contains('rel="foaf:page"', 'foaf:page is in RDFa' ); } { note "Get /bar/baz/bing, no redirects, ask for RDF/XML"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); $mech->default_header('Accept' => 'application/rdf+xml'); $mech->add_header('Origin' => 'http://example.org'); my $res = $mech->get("/bar/baz/bing"); is($mech->status, 303, "Returns 303"); like($res->header('Location'), qr|/bar/baz/bing/data$|, "Location is OK"); SKIP: { skip 'CrossOrigin not installed', 1 unless can_load( modules => { 'Plack::Middleware::CrossOrigin' => 0 }); is($res->header('Access-Control-Allow-Origin'), '*', 'CORS header OK'); } like($mech->response->header('Server'), qr|RDF::LinkedData/$RDF::LinkedData::VERSION|, 'Server header is there' ); } { note "Get /bar/baz/bing"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->default_header('Accept' => 'text/html'); $mech->get_ok("/bar/baz/bing"); is($mech->ct, 'text/html', "Correct content-type"); like($mech->uri, qr|/bar/baz/bing/page$|, "Location is OK"); $mech->title_is('Testing with longer URI.', "Title is correct"); $mech->has_tag('h1', 'Testing with longer URI.', "Title in body is correct"); $mech->content_like(qr|about=\"http://\S+?/bar/baz/bing\"|, 'Subject URI is OK in RDFa' ); } { note "Post /bar/baz/bing"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->post("/bar/baz/bing", { 'Content-Type' => 'text/turtle', Content => "<$base_uri/foo> \"Merged triple\"\@en" }); is($mech->status, '405', "Method is not allowed"); } { note "Post /bar/baz/bing/data"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->post("/bar/baz/bing/data", { 'Content-Type' => 'text/turtle', Content => "<$base_uri/foo> \"Merged triple\"\@en" }); is($mech->status, '405', "Method is not allowed"); } { note "Get /bar/baz/bing, ask for RDF/XML"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->default_header('Accept' => 'application/rdf+xml'); $mech->get_ok("/bar/baz/bing"); is($mech->ct, 'application/rdf+xml', "Correct content-type"); like($mech->uri, qr|/bar/baz/bing/data$|, "Location is OK"); unlike($mech->response->header("ETag"), qr/^\"?http/, 'Etag should not start with http'); like($mech->response->header("ETag"), qr/^\"\w+\"$/, 'Returns a suitable, quoted ETag'); my $model = RDF::Trine::Model->temporary_model; is_valid_rdf($mech->content, 'rdfxml', 'Returns valid RDF/XML'); $rxparser->parse_into_model( $base_uri, $mech->content, $model ); has_subject($base_uri . 'bar/baz/bing', $model, "Subject URI in content"); has_literal('Testing with longer URI.', 'en', undef, $model, "Test phrase in content"); } TODO: { local $TODO = "We really should return 406 if no acceptable version is there, shouldn't we?"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->default_header('Accept' => 'application/foobar'); my $res = $mech->get("/foo/data"); is($mech->status, 406, "Returns 406"); } { note "Check for SPARQL endpoint"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->get("/sparql"); isnt($mech->status, 200, "/sparql doesn't return 200 for a get"); $mech->post("/sparql"); isnt($mech->status, 200, "/sparql doesn't return 200 for a post"); is($mech->status, 405, "/sparql returns 405 for a post"); $mech->get("/"); isnt($mech->status, 200, "root doesn't return 200"); } done_testing(); 25-psgi-endpoint.t000644001750001750 740612475623770 17544 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t#!/usr/bin/perl use strict; use warnings; use Test::More; use Test::RDF; use Test::WWW::Mechanize::PSGI; use Module::Load::Conditional qw[check_install]; unless (defined(check_install( module => 'RDF::Endpoint', version => 0.03))) { plan skip_all => 'You need RDF::Endpoint for this test' } $ENV{'RDF_LINKEDDATA_CONFIG_LOCAL_SUFFIX'} = 'end'; my $tester = do "script/linked_data.psgi"; BAIL_OUT("The application is not running") unless ($tester); use Log::Log4perl qw(:easy); Log::Log4perl->easy_init( { level => $FATAL } ) unless $ENV{TEST_VERBOSE}; { note "Get /foo, no redirects"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); my $res = $mech->get("/foo"); is($mech->status, 303, "Returns 303"); like($res->header('Location'), qr|/foo/data$|, "Location is OK"); } { note "Post /foo, no redirects"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); my $res = $mech->post("/foo"); is($mech->status, 405, "Returns 405"); } { note "Post /foo/data, no redirects"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); my $res = $mech->post("/foo/data"); is($mech->status, 405, "Returns 405"); } { note "Get /foo, no redirects, ask for RDF/XML"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); $mech->default_header('Accept' => 'application/rdf+xml'); my $res = $mech->get("/foo"); is($mech->status, 303, "Returns 303"); like($res->header('Location'), qr|/foo/data$|, "Location is OK"); } my $rxparser = RDF::Trine::Parser->new( 'rdfxml' ); my $base_uri = 'http://localhost/'; { note "Get /bar/baz/bing, ask for RDF/XML"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->default_header('Accept' => 'application/rdf+xml'); $mech->get_ok("/bar/baz/bing"); is($mech->ct, 'application/rdf+xml', "Correct content-type"); like($mech->uri, qr|/bar/baz/bing/data$|, "Location is OK"); my $model = RDF::Trine::Model->temporary_model; is_valid_rdf($mech->content, 'rdfxml', 'Returns valid RDF/XML'); $rxparser->parse_into_model( $base_uri, $mech->content, $model ); has_subject($base_uri . 'bar/baz/bing', $model, "Subject URI in content"); has_literal('Testing with longer URI.', 'en', undef, $model, "Test phrase in content"); has_uri('http://rdfs.org/ns/void#sparqlEndpoint', $model, 'SPARQL endpoint link in data'); has_uri($base_uri . '/sparql', $model, 'SPARQL endpoint in data'); } { note "Check for SPARQL endpoint using get"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->get_ok("/sparql", "Returns 200"); $mech->title_like(qr/SPARQL/, "Title contains the word SPARQL"); $mech->submit_form_ok( { form_id => 'queryform', fields => { query => 'DESCRIBE WHERE {}', 'media-type' => 'text/turtle' }, }, 'Submitting DESCRIBE query.' ); is_rdf($mech->content, 'turtle', ' "Testing with longer URI."@en .', 'turtle', 'SPARQL Query returns correct triple'); } { note "Check for SPARQL endpoint using post"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->post_ok('/sparql', { query => 'DESCRIBE WHERE {}', 'Accept' => 'application/rdf+xml' }, 'Submitting DESCRIBE query.'); is_rdf($mech->content, 'rdfxml', ' "Testing with longer URI."@en .', 'turtle', 'SPARQL Query returns correct triple'); } done_testing(); 28-psgi-void.t000644001750001750 1553212475623770 16707 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t#!/usr/bin/perl use strict; use warnings; use Test::More; use Test::RDF; use RDF::Trine qw[iri literal blank variable statement]; use Test::WWW::Mechanize::PSGI; use Module::Load::Conditional qw[check_install]; use RDF::Trine::Namespace qw(rdf rdfs foaf); use URI::Escape; unless (defined(check_install( module => 'RDF::Endpoint', version => 0.03))) { plan skip_all => 'You need RDF::Endpoint for this test' } unless (defined(check_install( module => 'RDF::Generator::Void', version => 0.04))) { plan skip_all => 'You need RDF::Generator::Void for this test' } $ENV{'RDF_LINKEDDATA_CONFIG_LOCAL_SUFFIX'} = 'void'; my $tester = do "script/linked_data.psgi"; BAIL_OUT("The application is not running") unless ($tester); use Log::Log4perl qw(:easy); Log::Log4perl->easy_init( { level => $FATAL } ) unless $ENV{TEST_VERBOSE}; { note "Get /foo, no redirects"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); my $res = $mech->get("/foo"); is($mech->status, 303, "Returns 303"); like($res->header('Location'), qr|/foo/data$|, "Location is OK"); } my $rxparser = RDF::Trine::Parser->new( 'rdfxml' ); my $parser = RDF::Trine::Parser->new( 'turtle' ); my $base_uri = 'http://localhost/'; my $void = RDF::Trine::Namespace->new('http://rdfs.org/ns/void#'); my $xsd = RDF::Trine::Namespace->new('http://www.w3.org/2001/XMLSchema#'); my $hydra = RDF::Trine::Namespace->new('http://www.w3.org/ns/hydra/core#'); { note "Get /.well-known/void, no redirects"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester, requests_redirectable => []); my $res = $mech->get("/.well-known/void"); is($mech->status, 302, "Returns 302"); like($res->header('Location'), qr|$base_uri|, "Location is OK"); } { note "Get /bar/baz/bing, ask for RDF/XML"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->default_header('Accept' => 'application/rdf+xml'); $mech->get_ok("/bar/baz/bing"); is($mech->ct, 'application/rdf+xml', "Correct content-type"); like($mech->uri, qr|/bar/baz/bing/data$|, "Location is OK"); my $model = RDF::Trine::Model->temporary_model; is_valid_rdf($mech->content, 'rdfxml', 'Returns valid RDF/XML'); $rxparser->parse_into_model( $base_uri, $mech->content, $model ); has_subject($base_uri . 'bar/baz/bing', $model, "Subject URI in content"); has_literal('Testing with longer URI.', 'en', undef, $model, "Test phrase in content"); hasnt_uri('http://rdfs.org/ns/void#sparqlEndpoint', $model, 'SPARQL endpoint link in data'); hasnt_uri($base_uri . 'sparql', $model, 'SPARQL endpoint in data'); hasnt_uri('http://purl.org/dc/terms/modified', $model, 'None of the added description in data'); has_object_uri($base_uri . '#dataset-0', $model, "Void oject URI in content"); } { note "Get the base_uri with the VoID"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->default_header('Accept' => 'application/rdf+xml'); $mech->get_ok($base_uri); is($mech->ct, 'application/rdf+xml', "Correct content-type"); my $model = RDF::Trine::Model->temporary_model; is_valid_rdf($mech->content, 'rdfxml', 'Returns valid RDF/XML'); unlike($mech->content, qr/URI::Namespace=HASH/, 'We should have real URIs as vocabs'); $rxparser->parse_into_model( $base_uri, $mech->content, $model ); has_subject($base_uri . '#dataset-0', $model, "Subject URI in content"); has_literal("This is a title", "en", undef, $model, "Correct English title"); has_literal("Dette er en tittel", "no", undef, $model, "Correct Norwegian title"); has_literal("This is a test too", "en", undef, $model, "Correct English label from addon data"); has_predicate('http://rdfs.org/ns/void#vocabulary', $model, 'Vocabularies are in'); has_predicate('http://www.w3.org/ns/hydra/core#search', $model, 'Hydra search predicate is in'); has_object_uri('http://www.w3.org/2000/01/rdf-schema#', $model, 'RDFS namespace as vocab OK'); pattern_target($model); pattern_ok( statement( iri($base_uri . '#dataset-0'), $void->triples, literal(3, undef, $xsd->integer) ), statement( iri($base_uri . '#dataset-0'), $void->sparqlEndpoint, iri($base_uri . 'sparql'), ), statement( iri($base_uri . '#dataset-0'), $rdf->type, $void->Dataset ), 'Common statements are there'); } { note "Get the base_uri with the VoID"; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->default_header('Accept' => 'application/xhtml+xml;q=1.0,text/html;q=0.94,application/xml;q=0.9,*/*;q=0.8'); $mech->get_ok($base_uri); my $model = RDF::Trine::Model->temporary_model; is_valid_rdf($mech->content, 'rdfa', 'Returns valid RDFa'); TODO: { local $TODO = 'This seems very fragile and gives different results on different platforms, but is not important'; is($mech->ct, 'application/xhtml+xml', "Correct content-type"); $mech->title_is('VoID Description for my dataset', 'Correct title in RDFa'); } } { note 'Testing Triple Pattern Fragments'; my $mech = Test::WWW::Mechanize::PSGI->new(app => $tester); $mech->default_header('Accept' => 'text/turtle'); $mech->get_ok( '/fragments?subject=' . uri_escape_utf8('http://localhost/foo')); is($mech->ct, 'text/turtle', "Correct content-type"); my $model = RDF::Trine::Model->temporary_model; is_valid_rdf($mech->content, 'turtle', 'Returns valid Turtle'); $parser->parse_into_model( $base_uri, $mech->content, $model ); has_literal('This is a test', 'en', undef, $model, "Test phrase in content"); has_subject($base_uri . '#dataset-0', $model, "Dataset subject URI in content"); has_subject($base_uri . 'foo', $model, "Result subject URI in content"); has_predicate('http://www.w3.org/ns/hydra/core#search', $model, 'Hydra search predicate is in'); pattern_target($model); pattern_ok( statement(iri($base_uri . 'foo'), $rdfs->label, literal("This is a test", 'en')), statement(iri($base_uri . 'foo'), $foaf->page, iri('http://en.wikipedia.org/wiki/Foo')) , 'Both fragment data triples present', ); pattern_ok( statement(iri($base_uri . 'fragments?subject=' . uri_escape_utf8('http://localhost/foo')), $void->triples, literal("2", undef, $xsd->integer->uri_value)), statement(iri($base_uri . 'fragments?subject=' . uri_escape_utf8('http://localhost/foo')), $hydra->totalItems, literal("2", undef, $xsd->integer->uri_value)), , 'Triple count is correct', ); pattern_ok( statement(iri($base_uri . '#dataset-0'), $rdf->type, $hydra->Collection), statement(iri($base_uri . '#dataset-0'), $hydra->search, blank('template')), statement(blank('template'), $hydra->template, literal($base_uri . 'fragments{?subject,predicate,object}')), 'Important control information present'); } done_testing(); LinkedData.pm000644001750001750 7072712475623770 17655 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/lib/RDFpackage RDF::LinkedData; use strict; use warnings; use Moo; use namespace::autoclean; use Types::Standard qw(InstanceOf Str Bool Maybe Int HashRef); use RDF::Trine qw[iri literal blank statement variable]; use RDF::Trine::Serializer; use RDF::Trine::Namespace; use Log::Log4perl qw(:easy); use Plack::Response; use RDF::Helper::Properties; use URI::NamespaceMap; use URI; use HTTP::Headers; use Module::Load::Conditional qw[can_load]; use Encode; use RDF::RDFa::Generator 0.102; use HTML::HTML5::Writer qw(DOCTYPE_XHTML_RDFA); use Data::Dumper; use Digest::MD5 ('md5_base64'); use Carp; use Try::Tiny; use List::Util qw(any); use Log::Log4perl; use Log::Log4perl ':easy'; use Log::Contextual qw( :log ), -package_logger => Log::Log4perl->get_logger; BEGIN { if ($ENV{TEST_VERBOSE}) { Log::Log4perl->easy_init( { level => $TRACE, category => 'RDF.LinkedData' } ); } else { Log::Log4perl->easy_init( { level => $FATAL, category => 'RDF.LinkedData' } ); } use Log::Contextual -logger => Log::Log4perl->get_logger; } =head1 NAME RDF::LinkedData - A Linked Data server implementation =head1 VERSION Version 0.74 =cut our $VERSION = '0.74'; =head1 SYNOPSIS For just setting this up and get it to run, you would just use the C script in this distribution. The usage of that is documented in L, with the README is a quick start guide. If you want to try and use this directly, you'd do stuff like: my $ld = RDF::LinkedData->new(store => $config->{store}, endpoint_config => $config->{endpoint}, base_uri => $config->{base_uri} ); $ld->namespaces($config->{namespaces}) if ($config->{namespaces}); $ld->request($req); return $ld->response($uri)->finalize; See L for a complete example. =head1 DESCRIPTION This module is used to create a Linked Data server that can serve RDF data out of an L. It will look up URIs in the model and do the right thing (known as the 303 dance) and mint URLs for that, as well as content negotiation. Thus, you can concentrate on URIs for your things, you need not be concerned about minting URLs for the pages to serve it. In addition, optional modules can provide other important functionalities: Cross-origin resource sharing, VoID description, cache headers, SPARQL Endpoint, Triple Pattern Fragments, etc. As such, it encompasses a fair share of Semantic Web best practices, but possibly not in a very flexible Big Data manner. =head1 METHODS =over =item C<< new ( store => $store, model => $model, base_uri => $base_uri, hypermedia => 1, namespaces_as_vocabularies => 1, request => $request, endpoint_config => $endpoint_config, void_config => $void_config ) >> Creates a new handler object based on named parameters, given a store config (recommended usage is to pass a hashref of the type that can be passed to L->new_with_config, but a simple string can also be used) or model and a base URI. Optionally, you may pass a L object (must be passed before you call C) and an C hashref if you want to have a SPARQL Endpoint running using the recommended module L. This module can also provide additional triples to turn the response into a hypermedia type. If you don't want this, set the C argument to false. Currently this entails setting the SPARQL endpoint and vocabularies used using the L. Finally, it can provide experimental L support. =item C<< BUILD >> Called by Moo to initialize an object. =cut sub BUILD { my $self = shift; # A model will be passed or built by the _build_model, so we can check directly if we have one unless ($self->model->isa('RDF::Trine::Model')) { throw Error -text => "No valid RDF::Trine::Model, need either a store config hashref or a model."; } if ($self->has_endpoint_config) { log_debug {'Endpoint config found with parameters: ' . Dumper($self->endpoint_config) }; unless (can_load( modules => { 'RDF::Endpoint' => 0.03 })) { throw Error -text => "RDF::Endpoint not installed. Please install or remove its configuration."; } unless (defined($self->endpoint_config->{endpoint_path})) { $self->endpoint_config->{endpoint_path} = '/sparql'; } $self->endpoint(RDF::Endpoint->new($self->model, $self->endpoint_config)); } else { log_info {'No endpoint config found'}; } if ($self->has_void_config) { log_debug {'VoID config found with parameters: ' . Dumper($self->void_config) }; unless (can_load( modules => { 'RDF::Generator::Void' => 0.04 })) { throw Error -text => "RDF::Generator::Void not installed. Please install or remove its configuration."; } my $dataset_uri = (defined($self->void_config->{dataset_uri})) ? $self->void_config->{dataset_uri} : URI->new($self->base_uri . '#dataset-0')->canonical; $self->_last_extvoid_mtime(0); $self->void(RDF::Generator::Void->new(inmodel => $self->model, dataset_uri => $dataset_uri, namespaces_as_vocabularies => $self->void_config->{namespaces_as_vocabularies})); if ($self->has_fragments) { log_debug {'Triple Pattern Fragments config found with parameters: ' . Dumper($self->fragments_config) }; } } else { log_info {'No VoID config found'}; } } =item C<< BUILDARGS >> Called by Moo to ensure that some attributes can be left unset. =cut around BUILDARGS => sub { my ($next, $self) = (shift, shift); my $args = $self->$next(@_); for (keys %$args) { delete $args->{$_} if not defined $args->{$_}; } return $args; }; has store => (is => 'rw', isa => HashRef | Str ); =item C<< model >> Returns the RDF::Trine::Model object. =cut has model => (is => 'ro', isa => InstanceOf['RDF::Trine::Model'], lazy => 1, builder => '_build_model', handles => { current_etag => 'etag' }); sub _build_model { my $self = shift; return $self->_load_model($self->store); } sub _load_model { my ($self, $store_config) = @_; # First, set the base if none is configured my $i = 0; if (ref($store_config) eq 'HASH') { foreach my $source (@{$store_config->{sources}}) { unless ($source->{base_uri}) { ${$store_config->{sources}}[$i]->{base_uri} = $self->base_uri; } $i++; } } my $store = RDF::Trine::Store->new( $store_config ); return RDF::Trine::Model->new( $store ); } =item C<< base_uri >> Returns or sets the base URI for this handler. =cut has base_uri => (is => 'rw', isa => Str, default => '' ); has hypermedia => (is => 'ro', isa => Bool, default => 1); has namespaces_as_vocabularies => (is => 'ro', isa => Bool, default => 1); has endpoint_config => (is => 'rw', isa=>Maybe[HashRef], predicate => 'has_endpoint_config'); has void_config => (is => 'rw', isa=>Maybe[HashRef], predicate => 'has_void_config'); has fragments_config => (is => 'rw', isa=>Maybe[HashRef], predicate => 'has_fragments'); =item C<< request ( [ $request ] ) >> Returns the L object if it exists or sets it if a L object is given as parameter. =cut has request => ( is => 'rw', isa => InstanceOf['Plack::Request']); =item C<< current_etag >> Returns the current Etag of the model suitable for use in a HTTP header. This is a read-only attribute. =item C<< last_etag >>, C<< has_last_etag >> Returns or sets the last Etag of so that changes to the model can be detected. =cut has last_etag => ( is => 'rw', isa => Str, predicate => 'has_last_etag'); =item namespaces ( { skos => 'http://www.w3.org/2004/02/skos/core#', dct => 'http://purl.org/dc/terms/' } ) Gets or sets the namespaces that some serializers use for pretty-printing. =cut has 'namespaces' => (is => 'rw', isa => InstanceOf['URI::NamespaceMap'], builder => '_build_namespaces', lazy => 1, handles => { 'add_namespace_mapping' => 'add_mapping', 'list_namespaces' => 'list_namespaces' }); sub _build_namespaces { my ($self, $ns_hash) = @_; return $ns_hash || URI::NamespaceMap->new({ rdf => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' }); } # Just a temporary compatibility hack sub _namespace_hashref { my $self = shift; my %hash; foreach my $prefix ($self->namespaces->list_prefixes) { $hash{$prefix} = $self->namespaces->namespace_uri($prefix)->as_string; } return \%hash; } =item C<< response ( $uri ) >> Will look up what to do with the given URI object and populate the response object. =cut sub response { my $self = shift; my $uri = URI->new(shift); my $response = Plack::Response->new; my $headers_in = $self->request->headers; my $server = "RDF::LinkedData/$VERSION"; $server .= " " . $response->headers->header('Server') if defined($response->headers->header('Server')); $response->headers->header('Server' => $server); my $endpoint_path; if ($self->has_endpoint) { $endpoint_path = $self->endpoint_config->{endpoint_path}; if ($uri->path eq $endpoint_path) { return $self->endpoint->run( $self->request ); } } if ($self->has_fragments && ($uri->path eq $self->fragments_config->{fragments_path})) { croak 'A VoID description is needed when using Triple Pattern Fragments' unless ($self->has_void); # First compute the selectors from the query parameters my %params = $uri->query_form; my %statement = (subject => undef, predicate => undef, object => undef); foreach my $term (keys(%statement)) { my $value = $params{$term}; next unless $value; return _client_error($response, "$term is invalid") if ref($value); # E.g. an array would be invalid if ($value =~ m/^\?(\S+)$/) { # Regexp matching variable $statement{$term} = variable($1); } elsif (($term eq 'object') && ($value =~ m/^\"(.+)\"((\@|\^\^)(\S+))?$/)) { # regexp matching literal my $string = $1; my $lang_or_datatype = $3; my $rest = $4; if (defined($lang_or_datatype) && ($lang_or_datatype eq '@')) { $statement{$term} = literal($string, $rest); } else { $statement{$term} = literal($string, undef, $rest); } } else { # Now, it may be an IRI try { $statement{$term} = iri($value); } catch { return _client_error($response, 'Was not able to parse subject as a IRI'); } } } log_debug {'Getting fragment with this selector ' . Dumper(\%statement) }; return _client_error($response, 'Returning the whole database not allowed') unless $self->fragments_config->{allow_dump_dataset} || any { defined } values(%statement); my $output_model = $self->_common_fragments_control; my $iterator = $self->model->get_statements($statement{subject}, $statement{predicate}, $statement{object}); $output_model->begin_bulk_ops; my $counter = 0; while (my $st = $iterator->next) { $counter++; # TODO: Paging goes here $output_model->add_statement($st); } $self->add_namespace_mapping(void => 'http://rdfs.org/ns/void#'); $self->add_namespace_mapping(hydra => 'http://www.w3.org/ns/hydra/core#'); my $cl = literal($counter, undef, 'http://www.w3.org/2001/XMLSchema#integer'); my $void = RDF::Trine::Namespace->new('http://rdfs.org/ns/void#'); $output_model->add_statement(statement(iri($uri), $void->triples, $cl)); $output_model->add_statement(statement(iri($uri), iri('http://www.w3.org/ns/hydra/core#totalItems'), $cl)); $output_model->add_statement(statement(iri($uri), iri('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), $void->Dataset)); $output_model->add_statement(statement($self->void->dataset_uri, $void->subset, iri($uri))); $output_model->add_statement(statement(iri($uri), iri('http://purl.org/dc/terms/source'), $self->void->dataset_uri )); $output_model->end_bulk_ops; my ($ct, $s); try { ($ct, $s) = RDF::Trine::Serializer->negotiate('request_headers' => $headers_in, base_uri => $self->base_uri, namespaces => $self->_namespace_hashref); } catch { $response->status(406); $response->headers->content_type('text/plain'); $response->body('HTTP 406: No serialization available any specified content type'); return $response; }; $response->status(200); $response->headers->header('Vary' => join(", ", qw(Accept))); if ($self->has_last_etag) { $response->headers->header('ETag' => '"' . md5_base64($self->last_etag . $ct) . '"'); } my $body = $s->serialize_model_to_string($output_model); log_trace { "Fragment message body is $body" }; $response->headers->content_type($ct); $response->body(encode_utf8($body)); return $response; } if ($self->has_void) { my $void_resp = $self->_void_content($uri, $endpoint_path); return $void_resp if (defined($void_resp)); } my $type = $self->type; $self->type(''); my $node = $self->my_node($uri); log_info{"Try rendering '$type' page for subject node: " . $node->as_string}; if ($self->count($node) > 0) { if ($type) { my $preds = $self->helper_properties; my $page = $preds->page($node); if (($type eq 'page') && ($page ne $node->uri_value . '/page')) { # Then, we have a foaf:page set that we should redirect to $response->status(301); $response->headers->header('Location' => $page); return $response; } log_debug {"Will render '$type' page " }; if ($headers_in->can('header') && $headers_in->header('Accept')) { log_debug {'Found Accept header: ' . $headers_in->header('Accept') }; } else { $headers_in->header('Accept' => 'application/rdf+xml'); if ($headers_in->header('Accept')) { log_warn { 'Setting Accept header: ' . $headers_in->header('Accept') }; } else { log_warn { 'No content type header can be set' }; } } $response->status(200); my $content = $self->_content($node, $type, $endpoint_path); $response->headers->header('Vary' => join(", ", qw(Accept))); if (defined($self->current_etag)) { $response->headers->header('ETag' => '"' . md5_base64($self->current_etag . $content->{content_type}) . '"'); } $response->headers->content_type($content->{content_type}); $response->body(encode_utf8($content->{body})); } else { $response->status(303); my ($ct, $s) = $self->_negotiate($headers_in); return $ct if ($ct->isa('Plack::Response')); # A hack to allow for the failed conneg case my $newurl = $uri . '/data'; unless ($s->isa('RDF::Trine::Serializer')) { my $preds = $self->helper_properties; $newurl = $preds->page($node); } log_debug {'Will do a 303 redirect to ' . $newurl }; $response->headers->header('Location' => $newurl); $response->headers->header('Vary' => join(", ", qw(Accept))); } return $response; } else { $response->status(404); $response->headers->content_type('text/plain'); $response->body('HTTP 404: Unknown resource'); return $response; } # We should never get here. $response->status(500); $response->headers->content_type('text/plain'); $response->body('HTTP 500: No such functionality.'); return $response; } sub _client_error { my ($response, $msg) = @_; $response->status(400); $response->headers->content_type('text/plain'); $response->body("HTTP 400: $msg"); return $response; } =item C<< helper_properties ( ) >> Returns the L object if it exists or sets it if a L object is given as parameter. =cut has helper_properties => ( is => 'rw', isa => InstanceOf['RDF::Helper::Properties'], lazy => 1, builder => '_build_helper_properties'); sub _build_helper_properties { my $self = shift; return RDF::Helper::Properties->new(model => $self->model); } =item C<< type >> Returns or sets the type of result to return, i.e. C, in the case of a human-intended page or C for machine consumption, or an empty string if it is an actual resource URI that should be redirected. =cut has 'type' => (is => 'rw', isa => Str, default => ''); =item C<< my_node >> A node for the requested URI. This node is typically used as the subject to find which statements to return as data. This expects to get a URI object containing the full URI of the node. =cut sub my_node { my ($self, $iri) = @_; log_info { "Subject URI to be used: $iri" }; return RDF::Trine::Node::Resource->new( $iri ); } =item C<< count ( $node) >> Returns the number of statements that has the $node as subject, or all if $node is undef. =cut sub count { my $self = shift; my $node = shift; return $self->model->count_statements( $node, undef, undef ); } # =item C<< _content ( $node, $type, $endpoint_path) >> # # Private method to return the a hashref with content for this URI, # based on the $node subject, and the type of node, which may be either # C or C. In the first case, an RDF document serialized to a # format set by content negotiation. In the latter, a simple HTML # document will be returned. Finally, you may pass the endpoint path if # it is available. The returned hashref has two keys: C # and C. The former is self-explanatory, the latter contains the # actual content. sub _content { my ($self, $node, $type, $endpoint_path) = @_; my $model = $self->model; my $iter = $model->bounded_description($node); my %output; if ($type eq 'data') { $self->{_type} = 'data'; my ($ctype, $s) = RDF::Trine::Serializer->negotiate('request_headers' => $self->request->headers, base => $self->base_uri, namespaces => $self->_namespace_hashref); $output{content_type} = $ctype; if ($self->hypermedia) { my $data_iri = iri($node->uri_value . '/data'); my $hmmodel = RDF::Trine::Model->temporary_model; if($self->has_void) { $hmmodel->add_statement(statement($data_iri, iri('http://rdfs.org/ns/void#inDataset'), $self->void->dataset_uri)); } else { if($self->has_endpoint) { $hmmodel->add_statement(statement($data_iri, iri('http://rdfs.org/ns/void#inDataset'), blank('void'))); $hmmodel->add_statement(statement(blank('void'), iri('http://rdfs.org/ns/void#sparqlEndpoint'), iri($self->base_uri . $endpoint_path))); } if($self->namespaces_as_vocabularies) { $hmmodel->add_statement(statement($data_iri, iri('http://rdfs.org/ns/void#inDataset'), blank('void'))); foreach my $nsuri ($self->list_namespaces) { $hmmodel->add_statement(statement(blank('void'), iri('http://rdfs.org/ns/void#vocabulary'), iri($nsuri->uri))); } } } $iter = $iter->concat($hmmodel->as_stream); } $output{body} = $s->serialize_iterator_to_string ( $iter ); log_trace { "Message body is $output{body}" }; } else { $self->{_type} = 'page'; my $returnmodel = RDF::Trine::Model->temporary_model; while (my $st = $iter->next) { $returnmodel->add_statement($st); } my $preds = $self->helper_properties; my $gen = RDF::RDFa::Generator->new( style => 'HTML::Pretty', title => $preds->title( $node ), base => $self->base_uri, namespaces => $self->_namespace_hashref); my $writer = HTML::HTML5::Writer->new( charset => 'ascii', markup => 'html' ); $output{body} = $writer->document($gen->create_document($returnmodel)); $output{content_type} = 'text/html'; } return \%output; } =item C<< endpoint ( [ $endpoint ] ) >> Returns the L object if it exists or sets it if a L object is given as parameter. In most cases, it will be created for you if you pass a C hashref to the constructor, so you would most likely not use this method. =cut has endpoint => (is => 'rw', isa => InstanceOf['RDF::Endpoint'], predicate => 'has_endpoint'); =item C<< void ( [ $voidg ] ) >> Returns the L object if it exists or sets it if a L object is given as parameter. Like C, it will be created for you if you pass a C hashref to the constructor, so you would most likely not use this method. =cut has void => (is => 'rw', isa => InstanceOf['RDF::Generator::Void'], predicate => 'has_void'); sub _negotiate { my ($self, $headers_in) = @_; my ($ct, $s); eval { ($ct, $s) = RDF::Trine::Serializer->negotiate('request_headers' => $headers_in, base_uri => $self->base_uri, namespaces => $self->_namespace_hashref, extend => { 'text/html' => 'html', 'application/xhtml+xml' => 'xhtml' } ); log_debug { "Got $ct content type" }; 1; } or do { my $response = Plack::Response->new; $response->status(406); $response->headers->content_type('text/plain'); $response->body('HTTP 406: No serialization available any specified content type'); return $response; }; return ($ct, $s) } sub _void_content { my ($self, $uri, $endpoint_path) = @_; my $generator = $self->void; my $dataset_uri = URI->new($generator->dataset_uri); my $fragment = $dataset_uri->fragment; $dataset_uri =~ s/(\#$fragment)$//; if ($uri->eq($dataset_uri)) { # First check if the model has changed, the etag will have # changed, and we will have to regenerate at some point. If # there is no current etag, we clear anyway if ((! defined($self->current_etag)) || ($self->has_last_etag && ($self->last_etag ne $self->current_etag))) { $self->_clear_voidmodel; } # First see if we should read some static stuff from file my $file_model = undef; if ($self->void_config->{add_void}) { $self->_current_extvoid_mtime((stat($self->void_config->{add_void}->{file}))[9]); if ($self->_current_extvoid_mtime != $self->_last_extvoid_mtime) { $self->_clear_voidmodel; $file_model = RDF::Trine::Model->temporary_model; my $parser = RDF::Trine::Parser->new($self->void_config->{add_void}->{syntax}); $parser->parse_file_into_model($self->base_uri, $self->void_config->{add_void}->{file}, $file_model); $self->_last_extvoid_mtime((stat($self->void_config->{add_void}->{file}))[9]); } } # Now really regenerate if there is no model now unless ($self->_has_voidmodel) { # Use the methods of the generator to add stuff from config, etc if ($self->void_config->{urispace}) { $generator->urispace($self->void_config->{urispace}); } else { $generator->urispace($self->base_uri); } if ($self->namespaces_as_vocabularies) { foreach my $nsuri ($self->list_namespaces) { $generator->add_vocabularies($nsuri->as_string); # TODO: Should be fixed in RDF::Generator::Void, but we fix it here for now } } if ($self->has_endpoint) { $generator->add_endpoints($self->base_uri . $endpoint_path); } if ($self->void_config->{licenses}) { $generator->add_licenses($self->void_config->{licenses}); } foreach my $title (@{$self->void_config->{titles}}) { $generator->add_titles(literal(@{$title})); } if ($self->void_config->{endpoints}) { $generator->add_endpoints($self->void_config->{endpoints}); } if ($self->void_config->{vocabularies}) { $generator->add_vocabularies($self->void_config->{vocabularies}); } # Do the stats and statements $self->_voidmodel($generator->generate($file_model)); $self->last_etag($self->current_etag); } if ($self->has_fragments) { $self->add_namespace_mapping(hydra => 'http://www.w3.org/ns/hydra/core#'); $self->_common_fragments_control($self->_voidmodel); } # Now start serializing. my ($ct, $s) = $self->_negotiate($self->request->headers); return $ct if ($ct->isa('Plack::Response')); # A hack to allow for the failed conneg case my $body; if ($s->isa('RDF::Trine::Serializer')) { # Then we just serialize since we have a serializer. $body = $s->serialize_model_to_string($self->_voidmodel); } else { # For (X)HTML, we need to do extra work my $gen = RDF::RDFa::Generator->new( style => 'HTML::Pretty', title => $self->void_config->{pagetitle} || 'VoID Description', base => $self->base_uri, namespaces => $self->_namespace_hashref); my $markup = ($ct eq 'application/xhtml+xml') ? 'xhtml' : 'html'; my $writer = HTML::HTML5::Writer->new( charset => 'ascii', markup => $markup ); $body = $writer->document($gen->create_document($self->_voidmodel)); } my $response = Plack::Response->new; $response->status(200); $response->headers->header('Vary' => join(", ", qw(Accept))); my $etag; $etag = $self->_last_extvoid_mtime if ($self->void_config->{add_void}); $etag .= $self->last_etag if (defined($self->last_etag)); if ($etag) { $response->headers->header('ETag' => '"' . md5_base64($etag . $ct) . '"'); } $response->headers->content_type($ct); $response->body(encode_utf8($body)); return $response; } else { return; } } has _voidmodel => (is => 'rw', isa => InstanceOf['RDF::Trine::Model'], predicate => '_has_voidmodel', clearer => '_clear_voidmodel'); has _current_extvoid_mtime => (is => 'rw', isa => Int); has _last_extvoid_mtime => (is => 'rw', isa => Int); sub _common_fragments_control { my $self = shift; my $model = shift || RDF::Trine::Model->temporary_model; my $void = RDF::Trine::Namespace->new('http://rdfs.org/ns/void#'); my $xsd = RDF::Trine::Namespace->new('http://www.w3.org/2001/XMLSchema#'); my $hydra = RDF::Trine::Namespace->new('http://www.w3.org/ns/hydra/core#'); my $rdf = RDF::Trine::Namespace->new('http://www.w3.org/1999/02/22-rdf-syntax-ns#'); $model->begin_bulk_ops; my $void_subject = $self->void->dataset_uri; $model->add_statement(statement($void_subject, $rdf->type, $hydra->Collection)); $model->add_statement(statement($void_subject, $rdf->type, $void->Dataset)); $model->add_statement(statement($void_subject, $hydra->search, blank('template'))); $model->add_statement(statement($void_subject, $void->uriLookupEndpoint, literal($self->base_uri . $self->fragments_config->{fragments_path} . '{?subject,predicate,object}'))); $model->add_statement(statement(blank('template'), $hydra->template, literal($self->base_uri . $self->fragments_config->{fragments_path} . '{?subject,predicate,object}'))); $model->add_statement(statement(blank('template'), $hydra->mapping, blank('subject'))); $model->add_statement(statement(blank('template'), $hydra->mapping, blank('predicate'))); $model->add_statement(statement(blank('template'), $hydra->mapping, blank('object'))); $model->add_statement(statement(blank('subject'), $hydra->property, $rdf->subject)); $model->add_statement(statement(blank('subject'), $hydra->variable, literal('subject'))); $model->add_statement(statement(blank('predicate'), $hydra->property, $rdf->predicate)); $model->add_statement(statement(blank('predicate'), $hydra->variable, literal('predicate'))); $model->add_statement(statement(blank('object'), $hydra->property, $rdf->object)); $model->add_statement(statement(blank('object'), $hydra->variable, literal('object'))); $model->end_bulk_ops; return $model; } =back =head1 AUTHOR Kjetil Kjernsmo, C<< >> =head1 CONTRIBUTORS Toby Inkster =head1 BUGS Please report any bugs using L =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc RDF::LinkedData The perlrdf mailing list is the right place to seek help and discuss this module: L =head1 TODO =over =item * Use L streams when they become available from the serializers. =item * Figure out what needs to be done to use this code in other frameworks, such as Magpie. =item * Make it read-write hypermedia. =item * Make the result graph configurable. =back =head1 ACKNOWLEDGEMENTS This module was started by Gregory Todd Williams C<< >> for L, but has been almost totally rewritten. =head1 COPYRIGHT & LICENSE Copyright 2010 Gregory Todd Williams Copyright 2010 ABC Startsiden AS Copyright 2010, 2011, 2012, 2013, 2014, 2015 Kjetil Kjernsmo This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; add.ttl000644001750001750 42212475623770 16510 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t/data@base . @prefix rdfs: . @prefix dct: . @prefix xsd: . rdfs:label "This is a test too"@en ; dct:modified "2012-06-30"^^xsd:date .basic.ttl000644001750001750 40512475623770 17042 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t/data@base . @prefix rdfs: . rdfs:label "This is a test"@en ; . rdfs:label "Testing with longer URI."@en .fragments.ttl000644001750001750 45612475623770 17755 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/t/data@base . @prefix rdfs: . rdfs:label "This is a test"@en ; . rdfs:label "Testing with longer URI."@en . 42 .LinkedData.pm000644001750001750 2773612475623770 21431 0ustar00kjetilkjetil000000000000RDF-LinkedData-0.74/lib/Plack/App/RDFpackage Plack::App::RDF::LinkedData; use strict; use warnings; use parent qw( Plack::Component ); use RDF::LinkedData; use URI::NamespaceMap; use Plack::Request; =head1 NAME Plack::App::RDF::LinkedData - A Plack application for running RDF::LinkedData =head1 SYNOPSIS my $linkeddata = Plack::App::RDF::LinkedData->new(); $linkeddata->configure($config); my $rdf_linkeddata = $linkeddata->to_app; builder { enable "Head"; enable "ContentLength"; enable "ConditionalGET"; $rdf_linkeddata; }; =head1 DESCRIPTION This module sets up a basic Plack application to use L to serve Linked Data, while making sure it does follow best practices for doing so. See the README for quick start, the gory details are here. =head1 MAKE IT RUN =head2 Quick setup for a demo =head3 One-liner It is possible to make it run with a single command line, e.g.: PERLRDF_STORE="Memory;path/to/some/data.ttl" plackup -host localhost script/linked_data.psgi This will start a server with the default config on localhost on port 5000, so the URIs you're going serve from the file data.ttl will have to have a base URI C. =head3 Using perlrdf command line tool A slightly longer example requires L, but sets up a persistent SQLite-based triple store, parses a file and gets the server with the default config running: export PERLRDF_STORE="DBI;mymodel;DBI:SQLite:database=rdf.db" perlrdf make_store perlrdf store_load path/to/some/data.ttl plackup -host localhost script/linked_data.psgi =head2 Configuration To configure the system for production use, create a configuration file C that looks something like: { "base_uri" : "http://localhost:3000/", "store" : { "storetype" : "Memory", "sources" : [ { "file" : "/path/to/your/data.ttl", "syntax" : "turtle" } ] }, "endpoint": { "html": { "resource_links": true } }, "expires" : "A86400" , "cors": { "origins": "*" }, "void": { "pagetitle": "VoID Description for my dataset" }, "fragments" : { "fragments_path" : "/fragments" } } In your shell set export RDF_LINKEDDATA_CONFIG=/to/where/you/put/rdf_linkeddata.json Then, figure out where your install method installed the , script, e.g. by using locate. If it was installed in C, go: plackup /usr/local/bin/linked_data.psgi --host localhost --port 3000 The C-part of the config sets up a SPARQL Endpoint. This requires the L module, which is recommended by this module. To use it, it needs to have some config, but will use defaults. It is also possible to set an C time. This needs L and uses Apache C syntax, in the example above, it will set an expires header for all resources to expire after 1 day of access. The C-part of the config enables Cross-Origin Resource Sharing, which is a W3C Recommendation for relaxing security constraints to allow data to be shared across domains. In most cases, this is what you want when you are serving open data, but in some cases, notably intranets, this should be turned off by removing this part. The C-part generates some statistics and a description of the dataset, using RDF::Generator::Void. It is strongly recommended to install and run that, but it can take some time to generate, so you may have to set the detail level. Finally, C add support for Triple Pattern Fragments, a work-in-progress, It is a more lightweight but less powerful way to query RDF data than SPARQL. If you have this, it is recommended to have CORS enabled and required to have at least a minimal VoID setup. =head2 Details of the implementation This server is a minimal Plack-script that should be sufficient for most linked data usages, and serve as a an example for most others. A minimal example of the required config file is provided above. There is are longer examples in the distribtion, which is used to run tests. In the config file, there is a C parameter, which must contain the L config hashref. It may also have a C URI and a C hashref which may contain prefix - URI mappings to be used in serializations. Note that this is a server that can only serve URIs of hosts you control, it is not a general purpose Linked Data manipulation tool, nor is it a full implementation of the L. The configuration is done using L and all its features can be used. Importantly, you can set the C environment variable to point to the config file you want to use. See also L for more information on how to use this config system. =head2 Behaviour The following documentation is adapted from the L, which preceeded this script. =over 4 =item * C Will return an HTTP 303 redirect based on the value of the request's Accept header. If the Accept header contains a recognized RDF media type or there is no Accept header, the redirect will be to C, otherwise to C. If the URI has a foaf:homepage or foaf:page predicate, the redirect will in the latter case instead use the first encountered object URI. =item * C Will return a bounded description of the C resource in an RDF serialization based on the Accept header. If the Accept header does not contain a recognized media type, RDF/XML will be returned. =item * C Will return an HTML description of the C resource including RDFa markup, or, if the URI has a foaf:homepage or foaf:page predicate, a 301 redirect to that object. =back If the RDF resource for which data is requested is not the subject of any RDF triples in the underlying triplestore, the /page and /data redirects will not take place, and a HTTP 404 (Not Found) will be returned. The HTML description of resources will be enhanced by having metadata about the predicate of RDF triples loaded into the same triplestore. Currently, only a C-predicate will be used for a title, as in this version, generation of HTML is done by L. =head2 Endpoint Usage As stated earlier, this module can set up a SPARQL Endpoint for the data using L. Often, that's what you want, but if you don't want your users to have that kind of power, or you're worried it may overload your system, you may turn it off by simply having no C section in your config. To use it, you just need to have an C section with something in it, it doesn't really matter what, as it will use defaults for everything that isn't set. L is recommended by this module, but as it is optional, you may have to install it separately. It has many configuration options, please see its documentation for details. You may also need to set the C variable to whereever the endpoint shared files are installed to. These are some CSS and Javascript files that enhance the user experience. They are not strictly necessary, but it sure makes it pretty! L should do the right thing, though, so it shouldn't be necessary. Finally, note that while L can serve these files for you, this module doesn't help you do that. That's mostly because this author thinks you should serve them using some other parts of the deployment stack. For example, to use Apache, put this in your Apache config in the appropriate C section: Alias /js/ /path/to/share/www/js/ Alias /favicon.ico /path/to/share/www/favicon.ico Alias /css/ /path/to/share/www/css/ =head2 VoID Generator Usage Like a SPARQL Endpoint, this is something most users would want. In fact, it is an even stronger recommendation than an endpoint. To enable it, you must have L installed, and just anything in the config file to enable it, like in the SYNOPSIS example. You can set several things in the config, the property attributes of L can all be set there somehow. You can also set C, which sets the title for the RDFa page that can be generated. Moreover, you can set titles in several languages for the dataset using C as the key, pointing to an arrayref with titles, where each title is a two element arrayref, where the first element is the title itself and the second is the language for that title. Please refer to the L for more details about what can be set, and the C test config in the distribution for example. By adding an C config key, you can make pass a file to the generator so that arbitrary RDF can be added to the VoID description. It will check the last modification time of the file and only update the VoID description if it has been modified. This is usefil since as much of the VoID description cannot be simply generated. To use it, the configuration would in JSON look something like this: "add_void": { "file": "/data/add.ttl", "syntax": "turtle" } where C is the full path to RDF that should be added and C is needed by the parser to parse it. Normally, the VoID description is cached in RAM and the store ETag is checked on every request to see if the description must be regenerated. If you use the C feature, you can force regeneration on the next request by touching the file. =head1 FEEDBACK WANTED Please contact the author if this documentation is unclear. It is really very simple to get it running, so if it appears difficult, this documentation is most likely to blame. =head1 METHODS You would most likely not need to call these yourself, but rather use the C script supplied with the distribution. =over =item C<< configure >> This is the only method you would call manually, as it can be used to pass a hashref with configuration to the application. =cut sub configure { my $self = shift; $self->{config} = shift; return $self; } =item C<< prepare_app >> Will be called by Plack to set the application up. =item C<< call >> Will be called by Plack to process the request. =back =cut sub prepare_app { my $self = shift; my $config = $self->{config}; $self->{linkeddata} = RDF::LinkedData->new(store => $config->{store}, endpoint_config => $config->{endpoint}, void_config => $config->{void}, fragments_config => $config->{fragments}, base_uri => $config->{base_uri} ); $self->{linkeddata}->namespaces(URI::NamespaceMap->new($config->{namespaces})) if ($config->{namespaces}); } sub call { my($self, $env) = @_; my $req = Plack::Request->new($env); my $uri = $req->uri; my $ld = $self->{linkeddata}; my $endpoint_path; if ($ld->has_endpoint) { $endpoint_path = $ld->endpoint_config->{endpoint_path}; } unless (($req->method eq 'GET') || ($req->method eq 'HEAD') || (($req->method eq 'POST') && defined($endpoint_path) && ($uri =~ m|$endpoint_path$|))) { return [ 405, [ 'Content-type', 'text/plain' ], [ 'Method not allowed' ] ]; } if (($uri->path eq '/.well-known/void') && ($ld->has_void)) { return [ 302, [ 'Location', $ld->base_uri . '/' ], [ '' ] ]; } if ($uri->as_iri =~ m!^(.+?)/?(page|data)$!) { $uri = URI->new($1); $ld->type($2); } $ld->request($req); return $ld->response($uri)->finalize; } 1; =head1 AUTHOR Kjetil Kjernsmo, C<< >> =head1 COPYRIGHT & LICENSE Copyright 2010, 2011, 2012, 2013, 2014, 2015 Kjetil Kjernsmo This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut