COPYRIGHT000644001750001750 335113150776471 15364 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02Format: 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: Changes META.json META.yml doap.ttl 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 Copyright: Copyright 2017 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: INSTALL LICENSE README rdf_linkeddata.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: COPYRIGHT CREDITS SIGNATURE Copyright: None License: public-domain Files: Makefile.PL Copyright: Copyright 2013 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: lib/RDF/LinkedData.pm Copyright: Copyright 2010 Gregory Todd Williams. Copyright 2010 ABC Startsiden AS. Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: lib/Plack/App/RDF/LinkedData.pm Copyright: Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: dist.ini Copyright: Copyright 2016 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 License: Artistic-1.0 This software is Copyright (c) 2017 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) 2017 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 CREDITS000644001750001750 36413150776467 15077 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02Maintainer: - Kjetil Kjernsmo Contributor: - Gregory Todd Williams - Patrick Hochstenbach (HOCHSTEN) - Richard Lewis Thanks: - Shlomi Fish (SHLOMIF) Changes000644001750001750 2550713150776467 15420 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02RDF-LinkedData ============== Created: 2009-04-23 Home page: Bug tracker: Wiki: Mailing list: Maintainer: Kjetil Kjernsmo 1.02 2017-08-28 Skip some tests if no RDFa parser is present. [ Bug Fixes ] - Skip some tests if no RDFa parser is present. 1.00 2017-08-25 Clean up for Milestone 1.0. [ Bug Fixes ] - Tests had wrong base_uri attribute. [ Other ] - A few smaller changes. - Proofread and improve documentation. Shlomi Fish++ - Remove the Error module, use Carp::croak. - Remove the final eval, use Try::Tiny. - Return Turtle rather than RDF/XML if no content type is given. - Updated: Can't rely on . in @INC. - Updated: Check that Integer URI is OK in test. - Use can_load to check for optionals in tests. 0.78 2017-01-03 Use Config::ZOMG for config. [ Bug Fixes ] - Fix packaging bug with Config::ZOMG. 0.76 2017-01-02 Improve Namespace handling and hypermedia controls. - Also check the request path for the endpoints. Richard Lewis++ - Hypermedia controls for the 'all' fragment. - Updated: Use MooX::Log::Any for logging. - Updated: Use URI::NamespaceMap properly. 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 170413150776466 15126 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02 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 4366413150776466 15135 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02This software is copyright (c) 2017 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) 2017 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) 2017 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 101513150776471 15215 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02COPYRIGHT 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_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 703613150776471 15516 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02{ "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.150005", "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::ZOMG" : "0", "JSON" : "0", "Log::Any::Adapter" : "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", "Module::Load::Conditional" : "0", "Moo" : "0", "MooX::Log::Any" : "0", "Plack" : "0.9939", "RDF::Helper::Properties" : "0.10", "RDF::NS::Curated" : "0", "RDF::RDFa::Generator" : "0.102", "RDF::Trine" : "0.133", "Scalar::Util" : "0", "Try::Tiny" : "0", "Types::Standard" : "0", "URI" : "1.52", "URI::NamespaceMap" : "0.32", "namespace::autoclean" : "0.12", "parent" : "0", "perl" : "5.006" } }, "test" : { "requires" : { "Config::ZOMG" : "0", "FindBin" : "0", "Log::Any::Adapter" : "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", "version" : "1.02" }, "RDF::LinkedData" : { "file" : "lib/RDF/LinkedData.pm", "version" : "1.02" } }, "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" : "1.02", "x_contributors" : [ "Gregory Todd Williams ", "Richard Lewis", "Patrick Hochstenbach (HOCHSTEN) " ], "x_provides_scripts" : { "linked_data.psgi" : { "file" : "script/linked_data.psgi" } }, "x_serialization_backend" : "JSON::PP version 2.27202" } META.yml000644001750001750 443313150776471 15344 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02--- abstract: 'Base class and scripts for servers that serve RDF as Linked Data.' author: - 'Kjetil Kjernsmo ' build_requires: Config::ZOMG: '0' FindBin: '0' Log::Any::Adapter: '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.150005' 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 version: '1.02' RDF::LinkedData: file: lib/RDF/LinkedData.pm version: '1.02' recommends: Config::ZOMG: '0' JSON: '0' Log::Any::Adapter: '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' Module::Load::Conditional: '0' Moo: '0' MooX::Log::Any: '0' Plack: '0.9939' RDF::Helper::Properties: '0.10' RDF::NS::Curated: '0' RDF::RDFa::Generator: '0.102' RDF::Trine: '0.133' Scalar::Util: '0' Try::Tiny: '0' Types::Standard: '0' URI: '1.52' URI::NamespaceMap: '0.32' namespace::autoclean: '0.12' parent: '0' 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: '1.02' x_contributors: - 'Gregory Todd Williams ' - 'Richard Lewis' - 'Patrick Hochstenbach (HOCHSTEN) ' x_provides_scripts: linked_data.psgi: file: script/linked_data.psgi x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Makefile.PL000644001750001750 2033413150776471 16063 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02use 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.150005", "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::ZOMG" => 0, "JSON" => 0, "Log::Any::Adapter" => 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, "Module::Load::Conditional" => 0, "Moo" => 0, "MooX::Log::Any" => 0, "namespace::autoclean" => 0.12, "parent" => 0, "perl" => 5.006, "Plack" => 0.9939, "RDF::Helper::Properties" => "0.10", "RDF::NS::Curated" => 0, "RDF::RDFa::Generator" => 0.102, "RDF::Trine" => 0.133, "Scalar::Util" => 0, "Try::Tiny" => 0, "Types::Standard" => 0, "URI" => 1.52, "URI::NamespaceMap" => 0.32, }, }, test => { requires => { "Config::ZOMG" => 0, "FindBin" => 0, "Log::Any::Adapter" => 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", version => 1.02 }, "RDF::LinkedData" => { file => "lib/RDF/LinkedData.pm", version => 1.02 }, }, "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" => 1.02, "x_contributors" => [ "Gregory Todd Williams ", "Richard Lewis", "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 1526613150776465 15004 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02RDF::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 functionality: 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 Note that in some environments, for example if the Plack server is dynamically configured and/or behind a proxy server, the server may fail to bind to the address you give it as hostname. In this case, it is wise to allow the server to bind to any public IP address, i.e. set the host name to 0.0.0.0. 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, 2015, 2016, 2017 Kjetil Kjernsmo This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SIGNATURE000644001750001750 646413150776471 15365 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02This 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 7acaef345d24cacd1c4bd8afed31ca8ea1949b7e COPYRIGHT SHA1 5d7242049e5d873099981de7b7824130beb8f07d CREDITS SHA1 961da6e4d58bdb44244aef8b3ecc80957455a8f2 Changes SHA1 a545b0fdb29256f6b04bd794e34de8e0aa421a99 INSTALL SHA1 7afae05d67ecea9c5e9328c4c29442c9d343da86 LICENSE SHA1 59dca5582266a861d9d5e14a08f228a8a481964e MANIFEST SHA1 8aa05e9023adc99bfe540e5d6fb33cf64afd9884 META.json SHA1 4f5f5e30c38e1b91327f89258efef83f2b6ab787 META.yml SHA1 247fbb6fa1e4a079788a17c5312829c3d9c16676 Makefile.PL SHA1 c25e1561966494c1e11db02d704fbd4a56ff8e1a README SHA1 157d43e84e6d5cfd366437aee68e9ef433d697b7 dist.ini SHA1 6d6fe65e862529ce3f5468c883c2e8d738db8227 doap.ttl SHA1 776143aa19ec143f638cf0b40830dba63e37d8e3 lib/Plack/App/RDF/LinkedData.pm SHA1 13537a02873c0195fde950d48e2e68a92ad01f8f lib/RDF/LinkedData.pm SHA1 7890d0364e0d89d03b38f8de3f086c36be390e57 rdf_linkeddata.json SHA1 48e075eb90e32fda410fffbeba517c3bbb3adea3 rdf_linkeddata_dev.json SHA1 4f9198217c1a849b4d9c8713b017f34039789b2c rdf_linkeddata_end.json SHA1 c6f589ed77ca675ad6c6fecc79f2f42707d3f02f rdf_linkeddata_void.json SHA1 30e091ff92a851e46b9fa8579fc5adbe2512d943 script/linked_data.psgi SHA1 af175eb27d75d4dc2890b917d845a2e2b04b5d49 t/00-load.t SHA1 281696a176bc56e8708f0dd6d2061319d81aa325 t/10-basic.t SHA1 e627ae83c66dacec243ae55d2cd6f0f646673a2c t/11-constructor.t SHA1 341c487a9b1a1570a65cd717d4adf0a4805294a9 t/15-process.t SHA1 18afe5a28033b00f5cbf1e0532a8e45a65e4943f t/16-void.t SHA1 8979bf395e4dc1dcaf4e3361f606ebab7fe8a8ae t/17-hypermedia-ro.t SHA1 5464dc4233bc152e12b29cc5184afc2386affb79 t/18-fragments.t SHA1 2d9cf5d5d1cf5f586edf8e6252abeeac7fdc8013 t/19_config_file.t SHA1 d888f678c1edf754e23e7d16a2895565580abeda t/20-psgi-basic.t SHA1 91839254de8fd93c2695519022a615308703d712 t/25-psgi-endpoint.t SHA1 04e9b463bb9fc1d39d2c5ba106284497e2c9bb8f t/28-psgi-void.t SHA1 f637dccab2e10c22988378721c189153468a0846 t/data/add.ttl SHA1 a0946a1631578df073be5dbef1e81694bcd83fd2 t/data/basic.ttl SHA1 262ba8c31b0d06304f5cdd1dbfcf1e6ad8e189d5 t/data/fragments.ttl -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUBWaP9OX++6N86nkqlAQhgUg//UH4ziPrjPXSSrwIhxZ3QqZ1eYLUvyFqA 5SOWAPq/bQ3p7Y5mrOnxbB7SLHekAmIY1Kl57qQ1LoI9cxxlCqe5yhG4KkX3sk7j Cm38DlYBulHZjIrl+7SKZ+O+ty83Cr+ZX6j8yvynx97MRXz7xDAX1wJIsHwjck20 mPUf5Z0zzIqSC8NXRrGBEfxAasEECSWCMdR+yjar4emWRcGiwouJ4pyCN55pul8b R7hNWP00mXk5Cend3e47eNjvCuNwjPxyvz4dinbIyvUQ0nDUAVfGZyoQwXpydiVu FHJe0FAvKW+pN8/APke4PFdn7mbBXq7cVd6+g/amvJ4QVCMueINASIEpZH/zGZJ7 dEaXZQT19+viQQn1hcJ0pn+9k5wgmvnzd1ai32qNn4H3EecbnLPTWAage4IeJy+X 3bsvaMBmSXsujowjZNJscTzPSnPd/+ZC/7fqOza7VVptnhD0OwMPOCv4FOnkThqG 3iok+YiBU3koj7x4GTTeNvTWxOq7OQhPf8ZP521+FINNwgXqL4jsnIy7796J6+Dx dgWM4OD/0PMmCEIuTVXw6Y6Jg0sEn2r8QE5C6+HaGLj5qEtAqfQ5QAZFBRRz9uJN P1pYUGjhf6RKttgoGLzj7dxKrTvnxieCH6OVcpSNBL4pJaOIJJA0LaLT8Z2g5Hny BaF8PKu1pn8= =y8hN -----END PGP SIGNATURE----- dist.ini000644001750001750 7713150776465 15502 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02;;class='Dist::Inkt::Profile::TOBYINK' ;;name='RDF-LinkedData' doap.ttl000644001750001750 10614213150776471 15603 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02@prefix dc: . @prefix doap: . @prefix doap-changeset: . @prefix doap-deps: . @prefix foaf: . @prefix owl: . @prefix prov: . @prefix rdfs: . @prefix types: . @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; dc:identifier "RDF::LinkedData"^^doap-deps:CpanId; doap-deps:runtime-recommendation [ doap-deps:on "Config::ZOMG"^^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:on "Log::Any::Adapter"^^doap-deps:CpanId ]; doap-deps:runtime-requirement [ doap-deps:on "Types::Standard"^^doap-deps:CpanId ], [ doap-deps:on "MooX::Log::Any"^^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 0.32"^^doap-deps:CpanId; ], [ doap-deps:on "RDF::NS::Curated"^^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 "parent"^^doap-deps:CpanId ], [ doap-deps:on "List::Util 1.33"^^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 "Log::Any::Adapter"^^doap-deps:CpanId ], [ doap-deps:on "Config::ZOMG"^^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:support-forum ; 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 "Triple Pattern Fragments support."@en; ], [ a doap-changeset:Addition; rdfs:label "Improve documentation."@en; ], [ 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; ]; ]; 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 "Improve Namespace handling and hypermedia controls."@en; dc:issued "2017-01-02"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Use URI::NamespaceMap properly."@en; ], [ a doap-changeset:Update; rdfs:label "Use MooX::Log::Any for logging."@en; ], [ a doap-changeset:Change; rdfs:label "Hypermedia controls for the 'all' fragment."@en; ], [ a doap-changeset:Change; rdfs:label "Also check the request path for the endpoints."@en; doap-changeset:blame ; ]; ]; doap:revision "0.76"^^xsd:string. a doap:Version; rdfs:label "Use Config::ZOMG for config."@en; dc:issued "2017-01-03"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix packaging bug with Config::ZOMG."@en; ]; ]; doap:revision "0.78"^^xsd:string. 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: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; ], [ a doap-changeset:Change; rdfs:label "Allow namespaces to be skipped from the config."@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 "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; ], [ 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; ]; ]; 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 doap:Version; rdfs:label "Clean up for Milestone 1.0."@en; dc:issued "2017-08-25"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Remove the final eval, use Try::Tiny."@en; ], [ a doap-changeset:Change; rdfs:label "Use can_load to check for optionals in tests."@en; ], [ a doap-changeset:Change; rdfs:label "A few smaller changes."@en; ], [ a doap-changeset:Change; rdfs:label "Proofread and improve documentation."@en; doap-changeset:thanks ; ], [ a doap-changeset:Update; rdfs:label "Check that Integer URI is OK in test."@en; ], [ a doap-changeset:Update; rdfs:label "Can't rely on . in @INC."@en; ], [ a doap-changeset:Change; rdfs:label "Return Turtle rather than RDF/XML if no content type is given."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Tests had wrong base_uri attribute."@en; ], [ a doap-changeset:Change; rdfs:label "Remove the Error module, use Carp::croak."@en; ]; ]; doap:revision "1.00"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Skip some tests if no RDFa parser is present."@en; dc:issued "2017-08-28"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Skip some tests if no RDFa parser is present."@en; ]; ]; doap:revision "1.02"^^xsd:string; owl:sameAs . a foaf:Person; foaf:homepage ; foaf:mbox ; foaf:name "Patrick Hochstenbach"; owl:sameAs . a foaf:Person; foaf:name "Shlomi Fish"; foaf:nick "SHLOMIF"; foaf:page ; owl:sameAs . a foaf:Person; foaf:homepage ; foaf:name "Richard Lewis"; foaf:nick "ironChicken". a foaf:Person; foaf:mbox ; foaf:name "Kjetil Kjernsmo"; owl:sameAs , . a types:ChatChannel. rdf_linkeddata.json000644001750001750 54613150776465 17705 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02{ "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#", "dc" : "http://purl.org/dc/terms/" }, "cors" : { "origins" : "*" } }rdf_linkeddata_dev.json000644001750001750 104013150776465 20551 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02{ "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#", "dc" : "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 55613150776465 20534 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02{ "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#", "dc" : "http://purl.org/dc/terms/" } }rdf_linkeddata_void.json000644001750001750 125413150776465 20743 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02{ "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#", "dc" : "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 313013150776465 20516 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/script#!/usr/bin/env perl use strict; use warnings; use Plack::App::RDF::LinkedData; use RDF::LinkedData; use Plack::Request; use Plack::Builder; use Config::ZOMG; 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::ZOMG->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, 2016, 2017 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 23013150776465 15631 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t#!perl use Test::More tests => 1; BEGIN { use_ok( 'RDF::LinkedData' ); } diag( "Testing RDF::LinkedData $RDF::LinkedData::VERSION, Perl $], $^X" ); 10-basic.t000644001750001750 630113150776465 16021 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t#!/usr/bin/env 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::Any::Adapter; Log::Any::Adapter->set($ENV{LOG_ADAPTER} || 'Stderr') if $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#', dc => '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 137113150776466 17331 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t#!/usr/bin/env 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 configured'); } { 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 configured'); } done_testing; 15-process.t000644001750001750 1153213150776466 16446 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t#!/usr/bin/env perl use FindBin qw($Bin); use Plack::Request; use strict; use Test::More tests => 39; use Test::RDF; use Log::Any::Adapter; use Module::Load::Conditional qw[can_load]; Log::Any::Adapter->set($ENV{LOG_ADAPTER} || 'Stderr') if $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_uri=>$base_uri, endpoint_config => {endpoint_path => '/sparql'}) : 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"; $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 1463613150776466 15742 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t#!/usr/bin/env perl use FindBin qw($Bin); use Plack::Request; use strict; use Test::More; use Test::RDF; use Log::Any::Adapter; use Module::Load::Conditional qw[can_load]; use Test::RDF; use RDF::Trine qw[iri literal blank variable statement]; use RDF::Trine::Store::Hexastore; unless (can_load( modules => { 'RDF::Generator::Void' => 0.04 })) { plan skip_all => 'You need RDF::Generator::Void for this test' } Log::Any::Adapter->set($ENV{LOG_ADAPTER} || 'Stderr') if $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'; my $ns = URI::NamespaceMap->new(['rdf', 'rdfs', 'void', 'xsd']); $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); pattern_ok( statement( iri($base_uri . '/#dataset-0'), iri($ns->void->triples), literal(3, undef, iri($ns->xsd->integer)) ), statement( iri($base_uri . '/#dataset-0'), iri($ns->rdf->type), iri($ns->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'), iri($ns->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"); is($ns->xsd->integer, 'http://www.w3.org/2001/XMLSchema#integer', 'Integer URI is OK (check if XML::CommonNS provides ns if this fails)'); pattern_target($retmodel); pattern_ok( statement( iri($base_uri . '/#dataset-0'), iri($ns->void->triples), literal(4, undef, iri($ns->xsd->integer)) ), statement( iri($base_uri . '/#dataset-0'), iri($ns->rdf->type), iri($ns->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'); $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'), iri($ns->void->triples), literal(3, undef, iri($ns->xsd->integer)) ), statement( iri($base_uri . '/#dataset-0'), iri($ns->rdf->type), iri($ns->void->Dataset) ), 'Three triples should be counted'); $dld->model->add_statement(statement(iri($base_uri . '/foo'), iri($ns->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'), iri($ns->void->triples), literal(4, undef, iri($ns->xsd->integer)) ), statement( iri($base_uri . '/#dataset-0'), iri($ns->rdf->type), iri($ns->void->Dataset) ), '4 statements should be counted'); } done_testing; 17-hypermedia-ro.t000644001750001750 1306013150776466 17535 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t#!/usr/bin/env 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::Any::Adapter; use Module::Load::Conditional qw[can_load]; Log::Any::Adapter->set($ENV{LOG_ADAPTER} || 'Stderr') if $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 $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, $parser); 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(dc => '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, $parser); 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, $parser); 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, $parser); 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 3122313150776466 16760 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t#!/usr/bin/env 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::Any::Adapter; use URI::NamespaceMap; use Module::Load::Conditional qw[can_load]; use URI::Escape; unless (can_load( modules => { 'RDF::Generator::Void' => 0.04 })) { plan skip_all => 'You need RDF::Generator::Void for this test' } Log::Any::Adapter->set($ENV{LOG_ADAPTER} || 'Stderr') if $ENV{TEST_VERBOSE}; my $file = $Bin . '/data/fragments.ttl'; use_ok('RDF::LinkedData'); use_ok('RDF::Generator::Void'); my $ns = URI::NamespaceMap->new(['rdf', 'rdfs', 'foaf', 'void', 'dc', 'xsd']); $ns->add_mapping('hydra' => 'http://www.w3.org/ns/hydra/core#'); 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'), iri($ns->rdfs->label), literal("This is a test", 'en')), statement(iri($base_uri . '/foo'), iri($ns->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')), iri($ns->void->triples), literal("2", undef, iri($ns->xsd->integer))), statement(iri($base_uri . '/fragments?subject=' . uri_escape_utf8('http://localhost/foo')), iri($ns->hydra->totalItems), literal("2", undef, iri($ns->xsd->integer))), , 'Triple count is correct', ); pattern_ok( statement(iri($base_uri . '/fragments?subject=' . uri_escape_utf8('http://localhost/foo')), iri($ns->dc->source), $void_subject), , 'Void Subject in dc:source' ); has_subject($void_subject->uri_value, $retmodel, "Void Subject URI in content"); pattern_ok( statement($void_subject, iri($ns->rdf->type), iri($ns->hydra->Collection)), statement($void_subject, iri($ns->hydra->search), blank('template')), statement(blank('template'), iri($ns->hydra->template), literal($base_uri . '/fragments{?subject,predicate,object}')), statement(blank('template'), iri($ns->hydra->mapping), blank('subject')), statement(blank('template'), iri($ns->hydra->mapping), blank('predicate')), statement(blank('template'), iri($ns->hydra->mapping), blank('predicate')), statement(blank('template'), iri($ns->hydra->mapping), blank('object')), statement(blank('subject'), iri($ns->hydra->property), iri($ns->rdf->subject)), statement(blank('subject'), iri($ns->hydra->variable), literal('subject')), statement(blank('predicate'), iri($ns->hydra->property), iri($ns->rdf->predicate)), statement(blank('predicate'), iri($ns->hydra->variable), literal('predicate')), statement(blank('object'), iri($ns->hydra->property), iri($ns->rdf->object)), statement(blank('object'), iri($ns->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, $ns->xsd->integer->as_string, $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, $ns->xsd->integer->as_string, $retmodel, "The Answer is in the content"); has_literal("1", undef, $ns->xsd->integer->as_string, $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, $ns->xsd->integer->as_string, $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, $ns->xsd->integer->as_string, $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, 200, "Returns 200 with all parameters empty"); } { my $response = $ld->response($base_uri . '/fragments'); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200 with all parameters missing"); my $retmodel = return_model($response->content, $parser); has_predicate('http://www.w3.org/ns/hydra/core#next', $retmodel, 'Has hydra:next predicate'); has_object_uri($base_uri . '/fragments?allow_dump_dataset=1', $retmodel, '...and object with ? to find the rest'); } { my $response = $ld->response($base_uri . '/fragments?predicate=&object='); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200 with subject missing other parameters empty"); my $retmodel = return_model($response->content, $parser); has_predicate('http://www.w3.org/ns/hydra/core#next', $retmodel, 'Has hydra:next predicate'); has_object_uri($base_uri . '/fragments?allow_dump_dataset=1', $retmodel, '...and object with & to find the rest'); } } { 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($ns->hydra->search->as_string, $retmodel, 'Hydra search predicate'); pattern_target($retmodel); pattern_ok( statement( $void_subject, iri($ns->void->triples), literal(4, undef, iri($ns->xsd->integer)) ), statement( $void_subject, iri($ns->rdf->type), iri($ns->void->Dataset) ), 'VoID-specific statements'); pattern_ok( statement($void_subject, iri($ns->rdf->type), iri($ns->hydra->Collection)), statement($void_subject, iri($ns->hydra->search), blank('template')), statement(blank('template'), iri($ns->hydra->template), literal($base_uri . '/fragments{?subject,predicate,object}')), statement(blank('template'), iri($ns->hydra->mapping), blank('subject')), statement(blank('template'), iri($ns->hydra->mapping), blank('predicate')), statement(blank('template'), iri($ns->hydra->mapping), blank('predicate')), statement(blank('template'), iri($ns->hydra->mapping), blank('object')), statement(blank('subject'), iri($ns->hydra->property), iri($ns->rdf->subject)), statement(blank('subject'), iri($ns->hydra->variable), literal('subject')), statement(blank('predicate'), iri($ns->hydra->property), iri($ns->rdf->predicate)), statement(blank('predicate'), iri($ns->hydra->variable), literal('predicate')), statement(blank('object'), iri($ns->hydra->property), iri($ns->rdf->object)), statement(blank('object'), iri($ns->hydra->variable), literal('object')), "Control statements OK"); } { note 'Testing the allow_dump_dataset feature with config param'; 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, $ns->xsd->integer->as_string, $retmodel, 'Triple count is correct got all 4 triples'); } } { note 'Testing the allow_dump_dataset feature with hypermedia'; 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=&predicate=&object='); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200 with all parameters empty"); my $retmodel1 = return_model($response->content, $parser); has_literal("4", undef, $ns->xsd->integer->as_string, $retmodel1, 'Triple count is correct got all 4 triples'); my $size1 = $retmodel1->size; is($size1, 20, 'Returned triples contain only controls and metadata'); has_predicate('http://www.w3.org/ns/hydra/core#next', $retmodel1, 'Has hydra:next predicate'); has_object_uri($base_uri . '/fragments?allow_dump_dataset=1', $retmodel1, '...and object to find the rest'); my $response2 = $ld->response($base_uri . '/fragments?allow_dump_dataset=1'); isa_ok($response, 'Plack::Response'); is($response->status, 200, "Returns 200 with all parameters empty"); my $retmodel2 = return_model($response2->content, $parser); has_literal("4", undef, $ns->xsd->integer->as_string, $retmodel2, 'Triple count is correct got all 4 triples'); cmp_ok($size1 + 4 - 1 , '==', $retmodel2->size, 'Size is now three more (+data, -hydra:next)'); cmp_ok($size1, '<', $retmodel2->size, 'Size is now larger'); hasnt_uri('http://www.w3.org/ns/hydra/core#next', $retmodel2, 'Hasnt hydra:next predicate'); } } 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 52513150776466 17262 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t#!/usr/bin/env 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 2104413150776466 17004 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t#!/usr/bin/env 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" or BAIL_OUT("Can't do script: " . ($@ || $!)); BAIL_OUT("The application is not running") unless ($tester); use Log::Any::Adapter; Log::Any::Adapter->set($ENV{LOG_ADAPTER} || 'Stderr') if $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 743513150776466 17540 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::RDF; use Test::WWW::Mechanize::PSGI; use Module::Load::Conditional qw[can_load]; unless (can_load( modules => { 'RDF::Endpoint' => 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" or BAIL_OUT("Can't do script: " . ($@ || $!)); BAIL_OUT("The application is not running") unless ($tester); use Log::Any::Adapter; Log::Any::Adapter->set($ENV{LOG_ADAPTER} || 'Stderr') if $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 1574713150776466 16711 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t#!/usr/bin/env 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[can_load]; use URI::Escape; unless (can_load( modules => { 'RDF::Endpoint' => 0.03 })) { plan skip_all => 'You need RDF::Endpoint for this test' } unless (can_load( modules => { 'RDF::Generator::Void' => 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" or BAIL_OUT("Can't do script: " . ($@ || $!)); BAIL_OUT("The application is not running") unless ($tester); use Log::Any::Adapter; Log::Any::Adapter->set($ENV{LOG_ADAPTER} || 'Stderr') if $ENV{TEST_VERBOSE}; subtest "Get /foo, no redirects" => sub { 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 $ns = URI::NamespaceMap->new(['rdf', 'rdfs', 'foaf', 'void', 'xsd']); $ns->add_mapping('hydra' => 'http://www.w3.org/ns/hydra/core#'); subtest "Get /.well-known/void, no redirects" => sub { 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"); }; subtest "Get /bar/baz/bing, ask for RDF/XML" => sub { 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"); }; subtest "Get the base_uri with the VoID" => sub { 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'), iri($ns->void->triples), literal(3, undef, iri($ns->xsd->integer)) ), statement( iri($base_uri . '#dataset-0'), iri($ns->void->sparqlEndpoint), iri($base_uri . 'sparql'), ), statement( iri($base_uri . '#dataset-0'), iri($ns->rdf->type), iri($ns->void->Dataset) ), 'Common statements are there'); }; subtest "Get the base_uri with the VoID and RDFa" => sub { plan skip_all => 'RDFa parser not present' unless $RDF::Trine::Parser::RDFa::HAVE_RDFA_PARSER; 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'); } }; subtest 'Testing Triple Pattern Fragments' => sub { 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'), iri($ns->rdfs->label), literal("This is a test", 'en')), statement(iri($base_uri . 'foo'), iri($ns->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')), iri($ns->void->triples), literal("2", undef, iri($ns->xsd->integer))), statement(iri($base_uri . 'fragments?subject=' . uri_escape_utf8('http://localhost/foo')), iri($ns->hydra->totalItems), literal("2", undef, iri($ns->xsd->integer))), , 'Triple count is correct', ); pattern_ok( statement(iri($base_uri . '#dataset-0'), iri($ns->rdf->type), iri($ns->hydra->Collection)), statement(iri($base_uri . '#dataset-0'), iri($ns->hydra->search), blank('template')), statement(blank('template'), iri($ns->hydra->template), literal($base_uri . 'fragments{?subject,predicate,object}')), 'Important control information present'); }; done_testing(); LinkedData.pm000644001750001750 7046613150776466 17647 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/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::Iterator::Graph; 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); with 'MooX::Log::Any'; =head1 NAME RDF::LinkedData - A Linked Data server implementation =head1 VERSION Version 1.02 =cut our $VERSION = '1.02'; =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 being 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 perform content negotiation. Thus, you can concentrate on URIs for your things, and you need not be concerned about minting URLs for the pages to serve it. In addition, optional modules can provide other important functionality: 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 the 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 a model and a base URI. Optionally, you may pass a L object (which 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')) { croak "No valid RDF::Trine::Model, need either a store config hashref or a model."; } if ($self->has_endpoint_config) { $self->log->debug('Endpoint config found with parameters: ' . Dumper($self->endpoint_config) ); unless (can_load( modules => { 'RDF::Endpoint' => 0.03 })) { croak "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 { $self->log->info('No endpoint config found'); } if ($self->has_void_config) { $self->log->debug('VoID config found with parameters: ' . Dumper($self->void_config) ); unless (can_load( modules => { 'RDF::Generator::Void' => 0.04 })) { croak "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) { $self->log->debug('Triple Pattern Fragments config found with parameters: ' . Dumper($self->fragments_config) ); } } else { $self->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 ( $namespace_map ) Gets or sets the namespaces that some serializers use for pretty-printing. Should be handed a L object. =cut has 'namespaces' => (is => 'rw', isa => InstanceOf['URI::NamespaceMap'], builder => '_build_namespaces', lazy => 1, handles => { 'add_namespace_mapping' => 'add_mapping', 'guess_namespaces' => 'guess_and_add', 'list_namespaces' => 'list_namespaces' }); sub _build_namespaces { my $self = shift; return shift || URI::NamespaceMap->new(); } # 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) || ($self->request->path eq $endpoint_path)) { return $self->endpoint->run( $self->request ); } } if ($self->has_fragments && (($uri->path eq $self->fragments_config->{fragments_path}) || ($self->request->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'); } } } $self->log->debug('Getting fragment with this selector ' . Dumper(\%statement) ); my $output_model = $self->_common_fragments_control; my $iterator; my $counter = 0; if ($params{allow_dump_dataset} || $self->fragments_config->{allow_dump_dataset} || any { defined } values(%statement)) { $iterator = $self->model->get_statements($statement{subject}, $statement{predicate}, $statement{object}); } else { $counter = $self->model->size - 1; my $nexturi = $uri; $nexturi->query_form('allow_dump_dataset' => 1); $iterator = RDF::Trine::Iterator::Graph->new([ statement(iri($uri), iri('http://www.w3.org/ns/hydra/core#next'), iri($nexturi)) ]); } $output_model->begin_bulk_ops; while (my $st = $iterator->next) { $counter++; # TODO: Paging goes here $output_model->add_statement($st); } my $cl = literal($counter, undef, 'http://www.w3.org/2001/XMLSchema#integer'); $self->guess_namespaces('void'); my $void = $self->namespaces->void; $output_model->add_statement(statement(iri($uri), iri($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'), iri($void->Dataset))); $output_model->add_statement(statement($self->void->dataset_uri, iri($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); $self->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); $self->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; } $self->log->debug("Will render '$type' page " ); if ($headers_in->can('header') && $headers_in->header('Accept')) { $self->log->debug('Found Accept header: ' . $headers_in->header('Accept') ); } else { $headers_in->header('Accept' => 'text/turtle'); if ($headers_in->header('Accept')) { $self->log->warn('Setting Accept header: ' . $headers_in->header('Accept') ); } else { $self->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); } $self->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 an L object is given as a 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) = @_; $self->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 ); $self->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 an 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); try { ($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' } ); $self->log->debug("Got $ct content type" ); } catch { 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->_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; $self->guess_namespaces('rdf', 'void'); $self->add_namespace_mapping(hydra => 'http://www.w3.org/ns/hydra/core#'); my $void = $self->namespaces->void; my $hydra = $self->namespaces->hydra; my $rdf = $self->namespaces->rdf; $model->begin_bulk_ops; my $void_subject = $self->void->dataset_uri; $model->add_statement(statement($void_subject, iri($rdf->type), iri($hydra->Collection))); $model->add_statement(statement($void_subject, iri($rdf->type), iri($void->Dataset))); $model->add_statement(statement($void_subject, iri($hydra->search), blank('template'))); $model->add_statement(statement($void_subject, iri($void->uriLookupEndpoint), literal($self->base_uri . $self->fragments_config->{fragments_path} . '{?subject,predicate,object}'))); $model->add_statement(statement(blank('template'), iri($hydra->template), literal($self->base_uri . $self->fragments_config->{fragments_path} . '{?subject,predicate,object}'))); $model->add_statement(statement(blank('template'), iri($hydra->mapping), blank('subject'))); $model->add_statement(statement(blank('template'), iri($hydra->mapping), blank('predicate'))); $model->add_statement(statement(blank('template'), iri($hydra->mapping), blank('object'))); $model->add_statement(statement(blank('subject'), iri($hydra->property), iri($rdf->subject))); $model->add_statement(statement(blank('subject'), iri($hydra->variable), literal('subject'))); $model->add_statement(statement(blank('predicate'), iri($hydra->property), iri($rdf->predicate))); $model->add_statement(statement(blank('predicate'), iri($hydra->variable), literal('predicate'))); $model->add_statement(statement(blank('object'), iri($hydra->property), iri($rdf->object))); $model->add_statement(statement(blank('object'), iri($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 This module does what it is supposed to do rather well and has thus reached the 1.0 milestone. To support a wider variety of use cases, the current module isn't flexible enough, so future versions will need substantial changes, but the version number is intended to reflect that. =head1 ACKNOWLEDGMENTS This module was started by Gregory Todd Williams C<< >> for RDF::LinkedData::Apache, 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, 2016, 2017 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 42013150776466 16500 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t/data@base . @prefix rdfs: . @prefix dc: . @prefix xsd: . rdfs:label "This is a test too"@en ; dc:modified "2012-06-30"^^xsd:date .basic.ttl000644001750001750 40513150776466 17034 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t/data@base . @prefix rdfs: . rdfs:label "This is a test"@en ; . rdfs:label "Testing with longer URI."@en .fragments.ttl000644001750001750 45613150776466 17747 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/t/data@base . @prefix rdfs: . rdfs:label "This is a test"@en ; . rdfs:label "Testing with longer URI."@en . 42 .LinkedData.pm000644001750001750 3120213150776466 21402 0ustar00kjetilkjetil000000000000RDF-LinkedData-1.02/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 VERSION Version 1.02 =cut our $VERSION = '1.02'; =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. Note that in some environments, for example if the Plack server is dynamically configured and/or behind a proxy server, the server may fail to bind to the address you give it as hostname. In this case, it is wise to allow the server to bind to any public IP address, i.e. set the host name to 0.0.0.0. =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 distribution, 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. Certain namespace, namely RDF, VoID, Hydra, DC Terms and XML Schema are added by the module and do not need to be declared. 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 an implementation of Linked Data Platform or the Linked Data API. 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 RDF::LinkedData::Apache, which preceded this module. =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 wherever 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 useful since as much of the VoID description is expensive to compute. 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}); # Ensure that certain namespaces are always declared $self->{linkeddata}->guess_namespaces('rdf', 'dc', 'xsd', 'void'); $self->{linkeddata}->add_namespace_mapping(hydra => 'http://www.w3.org/ns/hydra/core#'); } 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, 2016, 2017 Kjetil Kjernsmo This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut