COPYRIGHT000644001750001750 214112443662100 16126 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: RDF-Generator-HTTP Upstream-Contact: Kjetil Kjernsmo (KJETILK) Source: https://metacpan.org/release/RDF-Generator-HTTP Files: Changes META.json META.yml dist.ini doap.ttl Copyright: Copyright 2014 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: README README.pod lib/RDF/Generator/HTTP.pm t/01basic.t t/message.t Copyright: This software is copyright (c) 2014 by Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: COPYRIGHT CREDITS SIGNATURE Copyright: None License: public-domain Files: INSTALL LICENSE Copyright: Unknown License: Unknown Files: Makefile.PL Copyright: Copyright 2013 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 License: Artistic-1.0 This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The Artistic License 1.0 License: GPL-1.0 This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 CREDITS000644001750001750 7412443662100 15616 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003Maintainer: - Kjetil Kjernsmo (KJETILK) Changes000644001750001750 112312443662100 16125 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003RDF-Generator-HTTP ================== Created: 2014-10-08 Home page: Bug tracker: Wiki: Mailing list: Maintainer: Kjetil Kjernsmo (KJETILK) 0.003 2014-12-15 Attributes for subjects [ Documentation ] - Fix internal link [ Other ] - Added: Create attributes to set and access the subjects of messages. 0.002 2014-12-14 Improve documentation 0.001 2014-10-08 Initial release INSTALL000644001750001750 173312443662100 15672 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003 Installing RDF-Generator-HTTP should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm RDF::Generator::HTTP 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::Generator::HTTP INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan RDF::Generator::HTTP 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-Generator-HTTP: % 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 4366412443662100 15677 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003This software is copyright (c) 2014 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) 2014 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) 2014 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 26212443662100 15746 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README README.pod SIGNATURE dist.ini doap.ttl lib/RDF/Generator/HTTP.pm t/01basic.t t/message.t META.json000644001750001750 420012443662100 16252 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003{ "abstract" : "Generate RDF from a HTTP request", "author" : [ "Kjetil Kjernsmo (KJETILK) " ], "dynamic_config" : 0, "generated_by" : "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.133380", "keywords" : [], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "RDF-Generator-HTTP", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : {}, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "develop" : { "recommends" : { "Dist::Inkt" : "0.001" } }, "runtime" : { "requires" : { "Carp" : "0", "HTTP::Message" : "0", "Moo" : "0", "RDF::Trine" : "0", "Types::Standard" : "0", "URI" : "0", "URI::NamespaceMap" : "0" } }, "test" : { "requires" : { "Test::More" : "0.96", "Test::RDF" : "0" } } }, "provides" : { "RDF::Generator::HTTP" : { "file" : "lib/RDF/Generator/HTTP.pm", "version" : "0.003" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/kjetilk/p5-rdf-generator-http/issues" }, "homepage" : "https://metacpan.org/release/RDF-Generator-HTTP", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/kjetilk/p5-rdf-generator-http.git", "web" : "https://github.com/kjetilk/p5-rdf-generator-http" }, "x_IRC" : "irc://irc.perl.org/#perlrdf", "x_identifier" : "http://purl.org/NET/cpan-uri/dist/RDF-Generator-HTTP/project", "x_mailinglist" : "http://lists.perlrdf.org/listinfo/dev", "x_wiki" : "http://wiki.perlrdf.org/" }, "version" : "0.003" } META.yml000644001750001750 231012443662100 16102 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003--- abstract: 'Generate RDF from a HTTP request' author: - 'Kjetil Kjernsmo (KJETILK) ' build_requires: Test::More: 0.96 Test::RDF: 0 configure_requires: ExtUtils::MakeMaker: 6.17 dynamic_config: 0 generated_by: 'Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.133380' keywords: [] license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: RDF-Generator-HTTP no_index: directory: - eg - examples - inc - t - xt optional_features: {} provides: RDF::Generator::HTTP: file: lib/RDF/Generator/HTTP.pm version: 0.003 requires: Carp: 0 HTTP::Message: 0 Moo: 0 RDF::Trine: 0 Types::Standard: 0 URI: 0 URI::NamespaceMap: 0 resources: IRC: irc://irc.perl.org/#perlrdf Identifier: http://purl.org/NET/cpan-uri/dist/RDF-Generator-HTTP/project Mailinglist: http://lists.perlrdf.org/listinfo/dev Wiki: http://wiki.perlrdf.org/ bugtracker: https://github.com/kjetilk/p5-rdf-generator-http/issues homepage: https://metacpan.org/release/RDF-Generator-HTTP license: http://dev.perl.org/licenses/ repository: git://github.com/kjetilk/p5-rdf-generator-http.git version: 0.003 Makefile.PL000644001750001750 1302012443662100 16623 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "Generate RDF from a HTTP request", "author" => ["Kjetil Kjernsmo (KJETILK) "], "dynamic_config" => 0, "generated_by" => "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.133380", "keywords" => [], "license" => ["perl_5"], "meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => 2, }, "name" => "RDF-Generator-HTTP", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "prereqs" => { configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } }, develop => { recommends => { "Dist::Inkt" => 0.001 } }, runtime => { requires => { "Carp" => 0, "HTTP::Message" => 0, "Moo" => 0, "RDF::Trine" => 0, "Types::Standard" => 0, "URI" => 0, "URI::NamespaceMap" => 0, }, }, test => { requires => { "Test::More" => 0.96, "Test::RDF" => 0 } }, }, "provides" => { "RDF::Generator::HTTP" => { file => "lib/RDF/Generator/HTTP.pm", version => 0.003 }, }, "release_status" => "stable", "resources" => { bugtracker => { web => "https://github.com/kjetilk/p5-rdf-generator-http/issues", }, homepage => "https://metacpan.org/release/RDF-Generator-HTTP", license => ["http://dev.perl.org/licenses/"], repository => { type => "git", url => "git://github.com/kjetilk/p5-rdf-generator-http.git", web => "https://github.com/kjetilk/p5-rdf-generator-http", }, x_identifier => "http://purl.org/NET/cpan-uri/dist/RDF-Generator-HTTP/project", x_IRC => "irc://irc.perl.org/#perlrdf", x_mailinglist => "http://lists.perlrdf.org/listinfo/dev", x_wiki => "http://wiki.perlrdf.org/", }, "version" => 0.003, }; 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 1514012443662100 15536 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003NAME RDF::Generator::HTTP - Generate RDF from a HTTP message SYNOPSIS use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $response = $ua->get('http://search.cpan.org/'); use RDF::Generator::HTTP; use RDF::Trine qw(iri); my $g = RDF::Generator::HTTP->new(message => $response, graph => iri('http://example.org/graphname'), blacklist => ['Last-Modified', 'Accept']); my $model = $g->generate; print $model->size; my $s = RDF::Trine::Serializer->new('turtle', namespaces => { httph => 'http://www.w3.org/2007/ont/httph#', http => 'http://www.w3.org/2007/ont/http#' } ); $s->serialize_model_to_file(\*STDOUT, $model); DESCRIPTION This module simply takes a HTTP::Message object, and based on its content, especially the content the HTTP::Header object(s) it contains, creates a simple RDF representation of the contents. It is useful chiefly for recording data when crawling resources on the Web, but it may also have other uses. Constructor `new(%attributes)` Moose-style constructor function. Attributes These attributes may be passed to the constructor to set them, or called like methods to get them. `message` A HTTP::Message (or subclass thereof) object to generate RDF for. Required. `blacklist` An `ArrayRef` of header field names that you do not want to see in the output. `whitelist` An `ArrayRef` of the only header field names that you want to see in the output. The whitelist will be ignored if the blacklist is set. `graph` You may pass an optional graph name to be used for all triples in the output. This must be an object of RDF::Trine::Node::Resource. `ns` An URI::NamespaceMap object containing namespace prefixes used in the module. You should probably not override this even though you can. `request_subject` An RDF::Trine::Node object containing the subject of any statements describing requests. If unset, it will default to a blank node. `response_subject` An RDF::Trine::Node object containing the subject of any statements describing responses. If unset, it will default to a blank node. Methods The above attributes all have read-accessors by the same name. `blacklist`, `whitelist` and `graph` also has writers and predicates, which is used to test if the attribute has been set, by prefixing `has_` to the attribute name. This class has two methods: `generate ( [ $model ] )` This method will generate the RDF. It may optionally take an RDF::Trine::Model as parameter. If it exists, the RDF will be added to this model, if not, a new Memory model will be created and returned. `ok_to_add ( $field )` This method will look up in the blacklists and whitelists and return true if the given field and value may be added to the model. EXAMPLES For an example of what the module can be used to create, consider the example in the "SYNOPSIS", which at the time of this writing outputs the following Turtle: @prefix http: . @prefix httph: . [] a http:RequestMessage ; http:hasResponse [ a http:ResponseMessage ; http:status "200" ; httph:client_date "Sun, 14 Dec 2014 21:28:21 GMT" ; httph:client_peer "207.171.7.59:80" ; httph:client_response_num "1" ; httph:connection "close" ; httph:content_length "3643" ; httph:content_type "text/html" ; httph:date "Sun, 14 Dec 2014 21:28:21 GMT" ; httph:link "; rel=\"alternate\"; title=\"RSS 1.0\"; type=\"application/rss+xml\"", "; rel=\"search\"; title=\"SearchCPAN\"; type=\"application/opensearchdescription+xml\"", "; media=\"print\"; rel=\"stylesheet\"; type=\"text/css\"", "; rel=\"stylesheet\"; type=\"text/css\"" ; httph:server "Plack/Starman (Perl)" ; httph:title "The CPAN Search Site - search.cpan.org" ; httph:x_proxy "proxy2" ] ; http:method "GET" ; http:requestURI ; httph:user_agent "libwww-perl/6.05" . NOTES HTTP Vocabularies There have been many efforts to create HTTP vocabularies (or ontologies), where the most elaborate and complete is the HTTP Vocabulary in RDF 1.0 . Nevertheless, I decided not to support this, but rather support an older and much less complete vocabulary that has been in the Tabulator project, with the namespace prefixes and . The problem of modelling HTTP is that headers modify each other, so if you want to record the HTTP headers so that they can be used in an actual HTTP dialogue afterwards, they have to be in a container so that the order can be reconstructed. Moreover, there is a lot of microstructure in the values, and that also adds complexity if you want to translate all that to RDF. That's what the former vocabulary does. However, for now, all the author wants to do is to record them, and then neither of these concerns are important. Therefore, I opted to go for a much simpler vocabulary, where each field is a simple predicate. That is not to say that the former approach isn't valid, it is just not something I need now. BUGS This is a very early release, but it works for the author. Please report any bugs to . AUTHOR Kjetil Kjernsmo . COPYRIGHT AND LICENCE This software is copyright (c) 2014 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. DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. README.pod000644001750001750 2712312443662100 16323 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003package RDF::Generator::HTTP; use 5.010001; use strict; use warnings; our $AUTHORITY = 'cpan:KJETILK'; our $VERSION = '0.003'; use Moo; use Carp qw(carp); use RDF::Trine qw(statement blank iri literal); use URI::NamespaceMap; use Types::Standard qw(InstanceOf ArrayRef Str); has message => (is => 'ro', isa => InstanceOf['HTTP::Message'], required => 1); has blacklist => (is => 'rw', isa => ArrayRef[Str], predicate => 'has_blacklist'); has whitelist => (is => 'rw', isa => ArrayRef[Str], predicate => 'has_whitelist'); has graph => (is => 'rw', isa => InstanceOf['RDF::Trine::Node::Resource'], predicate => 'has_graph'); has request_subject => (is => 'ro', isa => InstanceOf['RDF::Trine::Node'], default => sub { return blank }); has response_subject => (is => 'ro', isa => InstanceOf['RDF::Trine::Node'], default => sub { return blank }); has ns => (is => 'ro', isa => InstanceOf['URI::NamespaceMap'], lazy => 1, builder => '_build_namespacemap'); sub _build_namespacemap { my $self = shift; return URI::NamespaceMap->new({ rdf => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', http => 'http://www.w3.org/2007/ont/http#', httph => 'http://www.w3.org/2007/ont/httph#' }); } sub generate { my $self = shift; my $model = shift || RDF::Trine::Model->temporary_model; my $reqsubj = $self->request_subject; my $ressubj = $self->response_subject; my @graph = $self->has_graph ? ($self->graph) : (); my $ns = $self->ns; if ($self->message->isa('HTTP::Request')) { $self->_request_statements($model, $self->message, $reqsubj); $self->message->headers->scan(sub { my ($field, $value) = @_; if ($self->ok_to_add($field)) { $model->add_statement(statement($reqsubj, iri($ns->httph->uri(_fix_headers($field))), literal($value), @graph)); } }); } elsif ($self->message->isa('HTTP::Response')) { $model->add_statement(statement($ressubj, iri($ns->uri('rdf:type')), iri($ns->uri('http:ResponseMessage')), @graph)); $model->add_statement(statement($ressubj, iri($ns->uri('http:status')), literal($self->message->code), @graph)); $self->message->headers->scan(sub { my ($field, $value) = @_; if ($self->ok_to_add($field)) { $model->add_statement(statement($ressubj, iri($ns->httph->uri(_fix_headers($field))), literal($value), @graph)); } }); if ($self->message->request) { $model->add_statement(statement($reqsubj, iri($ns->uri('http:hasResponse')), $ressubj, @graph)); $self->_request_statements($model, $self->message->request, $reqsubj); $self->message->request->headers->scan(sub { my ($field, $value) = @_; if ($self->ok_to_add($field)) { $model->add_statement(statement($reqsubj, iri($ns->httph->uri(_fix_headers($field))), literal($value), @graph)); } }); } } else { carp "Don't know what to do with message object of class " . ref($self->message); } return $model; } sub ok_to_add { my ($self, $field) = @_; unless ($self->has_blacklist or $self->has_whitelist) { return 1; } if ($self->has_blacklist) { foreach my $entry (@{$self->blacklist}) { if ($entry eq $field) { return 0; } } return 1; } if ($self->has_whitelist) { foreach my $entry (@{$self->whitelist}) { if ($entry eq $field) { return 1; } } return 0; } } sub _request_statements { my ($self, $model, $r, $subj) = @_; my $ns = $self->ns; my @graph = $self->has_graph ? ($self->graph) : (); $model->add_statement(statement($subj, iri($ns->uri('rdf:type')), iri($ns->uri('http:RequestMessage')), @graph)); $model->add_statement(statement($subj, iri($ns->uri('http:method')), literal('GET'), @graph)); $model->add_statement(statement($subj, iri($ns->uri('http:requestURI')), iri($r->uri), @graph)); } sub _fix_headers { my $field = shift; $field =~ tr/-/_/; $field = lc $field; return $field; } 1; __END__ =pod =encoding utf-8 =head1 NAME RDF::Generator::HTTP - Generate RDF from a HTTP message =head1 SYNOPSIS use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $response = $ua->get('http://search.cpan.org/'); use RDF::Generator::HTTP; use RDF::Trine qw(iri); my $g = RDF::Generator::HTTP->new(message => $response, graph => iri('http://example.org/graphname'), blacklist => ['Last-Modified', 'Accept']); my $model = $g->generate; print $model->size; my $s = RDF::Trine::Serializer->new('turtle', namespaces => { httph => 'http://www.w3.org/2007/ont/httph#', http => 'http://www.w3.org/2007/ont/http#' } ); $s->serialize_model_to_file(\*STDOUT, $model); =head1 DESCRIPTION This module simply takes a L object, and based on its content, especially the content the L object(s) it contains, creates a simple RDF representation of the contents. It is useful chiefly for recording data when crawling resources on the Web, but it may also have other uses. =head2 Constructor =over =item C<< new(%attributes) >> Moose-style constructor function. =back =head2 Attributes These attributes may be passed to the constructor to set them, or called like methods to get them. =over =item C<< message >> A L (or subclass thereof) object to generate RDF for. Required. =item C<< blacklist >> An C of header field names that you do not want to see in the output. =item C<< whitelist >> An C of the only header field names that you want to see in the output. The whitelist will be ignored if the blacklist is set. =item C<< graph >> You may pass an optional graph name to be used for all triples in the output. This must be an object of L. =item C<< ns >> An L object containing namespace prefixes used in the module. You should probably not override this even though you can. =item C<< request_subject >> An L object containing the subject of any statements describing requests. If unset, it will default to a blank node. =item C<< response_subject >> An L object containing the subject of any statements describing responses. If unset, it will default to a blank node. =back =head2 Methods The above attributes all have read-accessors by the same name. C, C and C also has writers and predicates, which is used to test if the attribute has been set, by prefixing C to the attribute name. This class has two methods: =over =item C<< generate ( [ $model ] ) >> This method will generate the RDF. It may optionally take an L as parameter. If it exists, the RDF will be added to this model, if not, a new Memory model will be created and returned. =item C<< ok_to_add ( $field ) >> This method will look up in the blacklists and whitelists and return true if the given field and value may be added to the model. =back =head1 EXAMPLES For an example of what the module can be used to create, consider the example in the L, which at the time of this writing outputs the following Turtle: @prefix http: . @prefix httph: . [] a http:RequestMessage ; http:hasResponse [ a http:ResponseMessage ; http:status "200" ; httph:client_date "Sun, 14 Dec 2014 21:28:21 GMT" ; httph:client_peer "207.171.7.59:80" ; httph:client_response_num "1" ; httph:connection "close" ; httph:content_length "3643" ; httph:content_type "text/html" ; httph:date "Sun, 14 Dec 2014 21:28:21 GMT" ; httph:link "; rel=\"alternate\"; title=\"RSS 1.0\"; type=\"application/rss+xml\"", "; rel=\"search\"; title=\"SearchCPAN\"; type=\"application/opensearchdescription+xml\"", "; media=\"print\"; rel=\"stylesheet\"; type=\"text/css\"", "; rel=\"stylesheet\"; type=\"text/css\"" ; httph:server "Plack/Starman (Perl)" ; httph:title "The CPAN Search Site - search.cpan.org" ; httph:x_proxy "proxy2" ] ; http:method "GET" ; http:requestURI ; httph:user_agent "libwww-perl/6.05" . =head1 NOTES =head2 HTTP Vocabularies There have been many efforts to create HTTP vocabularies (or ontologies), where the most elaborate and complete is the L. Nevertheless, I decided not to support this, but rather support an older and much less complete vocabulary that has been in the L project, with the namespace prefixes L and L. The problem of modelling HTTP is that headers modify each other, so if you want to record the HTTP headers so that they can be used in an actual HTTP dialogue afterwards, they have to be in a container so that the order can be reconstructed. Moreover, there is a lot of microstructure in the values, and that also adds complexity if you want to translate all that to RDF. That's what the former vocabulary does. However, for now, all the author wants to do is to record them, and then neither of these concerns are important. Therefore, I opted to go for a much simpler vocabulary, where each field is a simple predicate. That is not to say that the former approach isn't valid, it is just not something I need now. =head1 BUGS This is a very early release, but it works for the author. Please report any bugs to L. =head1 AUTHOR Kjetil Kjernsmo Ekjetilk@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Kjetil Kjernsmo. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. SIGNATURE000644001750001750 431312443662113 16126 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003This 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 6b63ebc43661ce43ac3dbe353474769f843d3daf COPYRIGHT SHA1 e3e0e39296ce1cb035cb7c372a53ac507bbbda5f CREDITS SHA1 4d4af81edf4b386f00a0860ad987e17f3ad50caf Changes SHA1 3b9005d79d4d95b4682956c65a21e62cad45f907 INSTALL SHA1 bab09840c4a5314fa843ed1dc253c826b0931fb8 LICENSE SHA1 50dc2f55e5f31031c1b9b0b29e2a633896db63ac MANIFEST SHA1 e271df8164022f514aad665f5769a90f27598a7e META.json SHA1 17945493fd5c1dd22329df217be04da7e808caf3 META.yml SHA1 6d6e28d56d396b27b76f00460a63e8783a669b13 Makefile.PL SHA1 3ab8a5ab027cc8552985bf8682b85964d9554634 README SHA1 23e2cb7a7749afb3769b3997dff72c9273041b46 README.pod SHA1 e630e871b145a960f6b79498eb21f9eb9252b4fb dist.ini SHA1 49a31b98af6bdf1908969abde66f815a77f80211 doap.ttl SHA1 23e2cb7a7749afb3769b3997dff72c9273041b46 lib/RDF/Generator/HTTP.pm SHA1 0ae2b7d7b5a696e4b07b0cd7b1306be8c9578875 t/01basic.t SHA1 ee64e05410d17736abed81911f3fada0f69173fc t/message.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUBVI9kQH++6N86nkqlAQilSA//Rh7Sc6ped1eaeJFTTEoCKoEfaHJlJ6aX BJqxjyXkBkOeS667h+wAs2ozGZaxurA0MDOJdHzL9nik+rS0KYPPn7jZw6/iIieQ qU4mdQtyykDXqPYcqrT+niWJEt6wkedFA8vtaU+MVLduBjFDpLh2SThqWhKjkNNw hqO+bNlAZLdM0/1S69zaGr7FnPjZXCnHnighfqauguUwj5xQxYmZ4Bc7pXptkPhF FCKUU8l0GhNg4/1vjefA6njasqMG2W5oFq9zA9HOOF9E2uPaSn39Tec8RU/KG5o2 8goSuDIUu7u2ZWWgtdbn1CqaKTQN4k8GYJN9puQG2OFcUjVJv/eIDLAc0tnTJKmJ vmIEArywsP72aUKlDqh/A6RdSfEcfvWPvQVnPp7av3wQYjdWM5rquU1NoTMbBAjD Gb8GsH5rL7i750Y5mv/jeCUu3iLCG1dFyy1dtwHT0bF+5dQIwttutBGhNExJqlwb ct1FupUwPr2/bkDHntFw8Ey/1D7rLvK84yV79lcKgxuiFV0WQXKmFyfcqR4/Rcsz osvRns9kQwH+fBbQxcD2JNmnuq33RTejDIkd8mmzbOHA0wmg85DlsDcg1oczM+FS yKnwq6A/ohSdH19CO0gAtzgbDJf8+ghVKjy7D7PlgMAdOK1USTAMLtn8MrUd+0Hq qZWgtOEtZ/M= =kSUB -----END PGP SIGNATURE----- dist.ini000644001750001750 10412443662100 16254 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003;;class='Dist::Inkt::Profile::TOBYINK' ;;name='RDF-Generator-HTTP' doap.ttl000644001750001750 1161412443662100 16330 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003@prefix cpan-uri: . @prefix dc: . @prefix doap: . @prefix doap-changeset: . @prefix doap-deps: . @prefix foaf: . @prefix owl: . @prefix prov: . @prefix rdfs: . @prefix xsd: . dc:title "the same terms as the perl 5 programming language system itself". a doap:Project; cpan-uri:x_IRC ; dc:contributor ; doap-deps:develop-recommendation [ doap-deps:on "Dist::Inkt 0.001"^^doap-deps:CpanId ]; doap-deps:runtime-requirement [ doap-deps:on "Moo"^^doap-deps:CpanId ], [ doap-deps:on "Carp"^^doap-deps:CpanId ], [ doap-deps:on "RDF::Trine"^^doap-deps:CpanId ], [ doap-deps:on "URI::NamespaceMap"^^doap-deps:CpanId ], [ doap-deps:on "Types::Standard"^^doap-deps:CpanId ], [ doap-deps:on "HTTP::Message"^^doap-deps:CpanId ], [ doap-deps:on "URI"^^doap-deps:CpanId ]; doap-deps:test-requirement [ doap-deps:on "Test::More 0.96"^^doap-deps:CpanId ], [ doap-deps:on "Test::RDF"^^doap-deps:CpanId ]; doap:bug-database ; doap:category , ; doap:created "2014-10-08"^^xsd:date; doap:developer ; doap:download-page ; doap:homepage ; doap:license ; doap:mailing-list ; doap:maintainer ; doap:name "RDF-Generator-HTTP"; doap:programming-language "Perl"; doap:release , , ; doap:repository [ a doap:GitRepository; doap:browse ; prov:has_provenance ; ]; doap:shortdesc "Generate RDF from a HTTP request"@en; doap:wiki . a doap:Version; rdfs:label "Initial release"; dc:identifier "RDF-Generator-HTTP-0.001"^^xsd:string; dc:issued "2014-10-08"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.001"^^xsd:string. a doap:Version; rdfs:label "Improve documentation"; dc:identifier "RDF-Generator-HTTP-0.002"^^xsd:string; dc:issued "2014-12-14"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.002"^^xsd:string. a doap:Version; rdfs:label "Attributes for subjects"; dc:identifier "RDF-Generator-HTTP-0.003"^^xsd:string; dc:issued "2014-12-15"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Fix internal link"; ], [ a doap-changeset:Addition; rdfs:label "Create attributes to set and access the subjects of messages."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.003"^^xsd:string. a foaf:Person; foaf:mbox ; foaf:name "Kjetil Kjernsmo"; foaf:nick "KJETILK"; foaf:page ; owl:sameAs , . 01basic.t000644001750001750 71612443662100 16473 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003/t=pod =encoding utf-8 =head1 PURPOSE Test that RDF::Generator::HTTP compiles. =head1 AUTHOR Kjetil Kjernsmo Ekjetilk@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Kjetil Kjernsmo. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut use strict; use warnings; use Test::More; use_ok('RDF::Generator::HTTP'); done_testing; message.t000644001750001750 2011612443662100 16731 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003/t=pod =encoding utf-8 =head1 PURPOSE Test that RDF::Generator::HTTP generates RDF. =head1 AUTHOR Kjetil Kjernsmo Ekjetilk@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Kjetil Kjernsmo. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut use strict; use warnings; use Test::More; use HTTP::Response; use Test::RDF; use RDF::Trine qw(statement variable iri literal); use_ok('RDF::Generator::HTTP'); my $h = HTTP::Headers->new( Date => 'Thu, 14 Feb 2014 20:48:33 GMT', Content_Type => 'text/turtle;charset=UTF-8', Expires => 'Thu, 14 Feb 2014 21:48:33 GMT', 'Last-Modified' => 'Thu, 07 Feb 2014 20:48:33 GMT', Server => 'Dahutomatic/4.2' ); my $rdf = RDF::Trine::Namespace->new('http://www.w3.org/1999/02/22-rdf-syntax-ns#'); my $http = RDF::Trine::Namespace->new('http://www.w3.org/2007/ont/http#'); my $httph = RDF::Trine::Namespace->new('http://www.w3.org/2007/ont/httph#'); # Setting up the response my $r = HTTP::Response->new(200, "OK", $h, "<> a ."); my $requestURI = 'http://www.example.invalid/'; $r->request(HTTP::Request->new(GET => $requestURI, [Accept => 'application/rdf+xml'])); { my $g = RDF::Generator::HTTP->new(message => $r); isa_ok($g, 'RDF::Generator::HTTP'); isa_ok($g->response_subject, 'RDF::Trine::Node::Blank'); my $model = $g->generate; isa_ok($g->request_subject, 'RDF::Trine::Node::Blank'); isa_ok($model, 'RDF::Trine::Model'); has_predicate($httph->date->uri_value, $model, 'Date Predicate URI is found'); has_predicate($httph->content_type->uri_value, $model, 'Content-Type Predicate URI is found'); pattern_target($model); my $pattern = RDF::Trine::Pattern->new( statement(variable('req'), $rdf->type, $http->RequestMessage), statement(variable('req'), $http->method, literal('GET')), statement(variable('req'), $httph->accept, literal('application/rdf+xml')), statement(variable('req'), $http->requestURI, iri($requestURI)), statement(variable('req'), $http->hasResponse, variable('res')), statement(variable('res'), $rdf->type, $http->ResponseMessage), statement(variable('res'), $http->status, literal('200')), statement(variable('res'), $httph->date, literal('Thu, 14 Feb 2014 20:48:33 GMT')), statement(variable('res'), $httph->content_type, literal('text/turtle;charset=UTF-8')), statement(variable('res'), $httph->expires, literal('Thu, 14 Feb 2014 21:48:33 GMT')), statement(variable('res'), $httph->last_modified, literal('Thu, 07 Feb 2014 20:48:33 GMT')), statement(variable('res'), $httph->server, literal('Dahutomatic/4.2')) ); pattern_ok($pattern, 'Full pattern found'); } { my $reqs = iri('http://example.org/request'); my $ress = iri('http://example.org/response'); my $g = RDF::Generator::HTTP->new(message => $r, blacklist => ['Last-Modified', 'Accept'], request_subject => $reqs, response_subject => $ress ); isa_ok($g, 'RDF::Generator::HTTP'); isa_ok($g->response_subject, 'RDF::Trine::Node::Resource'); my $model = $g->generate; isa_ok($g->request_subject, 'RDF::Trine::Node::Resource'); ok($g->request_subject->equal($reqs), 'We get the request subject URI back'); isa_ok($model, 'RDF::Trine::Model'); has_subject('http://example.org/request', $model, 'Request subject URI is found'); has_subject('http://example.org/response', $model, 'Response subject URI is found'); has_predicate($httph->date->uri_value, $model, 'Date Predicate URI is found'); has_predicate($httph->content_type->uri_value, $model, 'Content-Type Predicate URI is found'); hasnt_uri($httph->accept->uri_value, $model, 'Accept Predicate URI is not found'); hasnt_uri($httph->last_modified->uri_value, $model, 'Last-Modified Predicate URI is not found'); hasnt_literal('Thu, 07 Feb 2014 20:48:33 GMT', undef, undef, $model, 'Last-Modified literal string is not found'); pattern_target($model); my $pattern = RDF::Trine::Pattern->new( statement(variable('req'), $rdf->type, $http->RequestMessage), statement(variable('req'), $http->method, literal('GET')), statement(variable('req'), $http->requestURI, iri($requestURI)), statement(variable('req'), $http->hasResponse, variable('res')), statement(variable('res'), $rdf->type, $http->ResponseMessage), statement(variable('res'), $http->status, literal('200')), statement(variable('res'), $httph->date, literal('Thu, 14 Feb 2014 20:48:33 GMT')), statement(variable('res'), $httph->content_type, literal('text/turtle;charset=UTF-8')), statement(variable('res'), $httph->expires, literal('Thu, 14 Feb 2014 21:48:33 GMT')), statement(variable('res'), $httph->server, literal('Dahutomatic/4.2')) ); pattern_ok($pattern, 'Rest of pattern found'); } { my $reqs = iri('http://example.org/request'); my $ress = iri('http://example.org/response'); my $g = RDF::Generator::HTTP->new(message => $r, whitelist => ['Date', 'Content-Type', 'Expires'], request_subject => $reqs, response_subject => $ress ); isa_ok($g, 'RDF::Generator::HTTP'); my $model = $g->generate; isa_ok($model, 'RDF::Trine::Model'); isa_ok($g->request_subject, 'RDF::Trine::Node::Resource'); has_subject('http://example.org/request', $model, 'Request subject URI is found'); has_subject('http://example.org/response', $model, 'Response subject URI is found'); has_object_uri('http://example.org/response', $model, 'Response object URI is found'); has_predicate($httph->date->uri_value, $model, 'Date Predicate URI is found'); has_predicate($httph->content_type->uri_value, $model, 'Content-Type Predicate URI is found'); has_literal('text/turtle;charset=UTF-8', undef, undef, $model, 'Content-Type literal is found'); hasnt_literal('Thu, 07 Feb 2014 20:48:33 GMT', undef, undef, $model, 'Last-Modified literal string is not found'); pattern_target($model); my $pattern = RDF::Trine::Pattern->new( statement($reqs, $rdf->type, $http->RequestMessage), statement($reqs, $http->method, literal('GET')), statement($reqs, $http->requestURI, iri($requestURI)), statement($reqs, $http->hasResponse, $ress), statement($ress, $rdf->type, $http->ResponseMessage), statement($ress, $http->status, literal('200')), statement($ress, $httph->date, literal('Thu, 14 Feb 2014 20:48:33 GMT')), statement($ress, $httph->content_type, literal('text/turtle;charset=UTF-8')), statement($ress, $httph->expires, literal('Thu, 14 Feb 2014 21:48:33 GMT')) ); pattern_ok($pattern, 'Rest of whitelist pattern found'); pattern_fail( statement(variable('req'), $httph->accept, literal('application/rdf+xml')), statement(variable('res'), $httph->last_modified, literal('Thu, 07 Feb 2014 20:48:33 GMT')), statement(variable('res'), $httph->server, literal('Dahutomatic/4.2')), 'Banned not found'); } { my $g = RDF::Generator::HTTP->new(message => $r, graph => iri('http://example.org/graphname')); isa_ok($g, 'RDF::Generator::HTTP'); my $model = $g->generate; isa_ok($model, 'RDF::Trine::Model'); has_predicate($httph->date->uri_value, $model, 'Date Predicate URI is found'); has_predicate($httph->content_type->uri_value, $model, 'Content-Type Predicate URI is found'); has_literal('text/turtle;charset=UTF-8', undef, undef, $model, 'Content-Type literal is found'); is($model->size, 12, 'Model has the correct number of triples'); is($model->count_statements(undef, undef, undef, iri('http://example.org/graphname')), 12, 'Model has the correct number of triples given graph'); my @graphs = $model->get_contexts->get_all; is(scalar @graphs, 1, 'Just one graph'); is($graphs[0]->uri_value, 'http://example.org/graphname', 'Correct graph name'); } done_testing; HTTP.pm000644001750001750 2712312443662100 21106 0ustar00kjetilkjetil000000000000RDF-Generator-HTTP-0.003/lib/RDF/Generatorpackage RDF::Generator::HTTP; use 5.010001; use strict; use warnings; our $AUTHORITY = 'cpan:KJETILK'; our $VERSION = '0.003'; use Moo; use Carp qw(carp); use RDF::Trine qw(statement blank iri literal); use URI::NamespaceMap; use Types::Standard qw(InstanceOf ArrayRef Str); has message => (is => 'ro', isa => InstanceOf['HTTP::Message'], required => 1); has blacklist => (is => 'rw', isa => ArrayRef[Str], predicate => 'has_blacklist'); has whitelist => (is => 'rw', isa => ArrayRef[Str], predicate => 'has_whitelist'); has graph => (is => 'rw', isa => InstanceOf['RDF::Trine::Node::Resource'], predicate => 'has_graph'); has request_subject => (is => 'ro', isa => InstanceOf['RDF::Trine::Node'], default => sub { return blank }); has response_subject => (is => 'ro', isa => InstanceOf['RDF::Trine::Node'], default => sub { return blank }); has ns => (is => 'ro', isa => InstanceOf['URI::NamespaceMap'], lazy => 1, builder => '_build_namespacemap'); sub _build_namespacemap { my $self = shift; return URI::NamespaceMap->new({ rdf => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', http => 'http://www.w3.org/2007/ont/http#', httph => 'http://www.w3.org/2007/ont/httph#' }); } sub generate { my $self = shift; my $model = shift || RDF::Trine::Model->temporary_model; my $reqsubj = $self->request_subject; my $ressubj = $self->response_subject; my @graph = $self->has_graph ? ($self->graph) : (); my $ns = $self->ns; if ($self->message->isa('HTTP::Request')) { $self->_request_statements($model, $self->message, $reqsubj); $self->message->headers->scan(sub { my ($field, $value) = @_; if ($self->ok_to_add($field)) { $model->add_statement(statement($reqsubj, iri($ns->httph->uri(_fix_headers($field))), literal($value), @graph)); } }); } elsif ($self->message->isa('HTTP::Response')) { $model->add_statement(statement($ressubj, iri($ns->uri('rdf:type')), iri($ns->uri('http:ResponseMessage')), @graph)); $model->add_statement(statement($ressubj, iri($ns->uri('http:status')), literal($self->message->code), @graph)); $self->message->headers->scan(sub { my ($field, $value) = @_; if ($self->ok_to_add($field)) { $model->add_statement(statement($ressubj, iri($ns->httph->uri(_fix_headers($field))), literal($value), @graph)); } }); if ($self->message->request) { $model->add_statement(statement($reqsubj, iri($ns->uri('http:hasResponse')), $ressubj, @graph)); $self->_request_statements($model, $self->message->request, $reqsubj); $self->message->request->headers->scan(sub { my ($field, $value) = @_; if ($self->ok_to_add($field)) { $model->add_statement(statement($reqsubj, iri($ns->httph->uri(_fix_headers($field))), literal($value), @graph)); } }); } } else { carp "Don't know what to do with message object of class " . ref($self->message); } return $model; } sub ok_to_add { my ($self, $field) = @_; unless ($self->has_blacklist or $self->has_whitelist) { return 1; } if ($self->has_blacklist) { foreach my $entry (@{$self->blacklist}) { if ($entry eq $field) { return 0; } } return 1; } if ($self->has_whitelist) { foreach my $entry (@{$self->whitelist}) { if ($entry eq $field) { return 1; } } return 0; } } sub _request_statements { my ($self, $model, $r, $subj) = @_; my $ns = $self->ns; my @graph = $self->has_graph ? ($self->graph) : (); $model->add_statement(statement($subj, iri($ns->uri('rdf:type')), iri($ns->uri('http:RequestMessage')), @graph)); $model->add_statement(statement($subj, iri($ns->uri('http:method')), literal('GET'), @graph)); $model->add_statement(statement($subj, iri($ns->uri('http:requestURI')), iri($r->uri), @graph)); } sub _fix_headers { my $field = shift; $field =~ tr/-/_/; $field = lc $field; return $field; } 1; __END__ =pod =encoding utf-8 =head1 NAME RDF::Generator::HTTP - Generate RDF from a HTTP message =head1 SYNOPSIS use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $response = $ua->get('http://search.cpan.org/'); use RDF::Generator::HTTP; use RDF::Trine qw(iri); my $g = RDF::Generator::HTTP->new(message => $response, graph => iri('http://example.org/graphname'), blacklist => ['Last-Modified', 'Accept']); my $model = $g->generate; print $model->size; my $s = RDF::Trine::Serializer->new('turtle', namespaces => { httph => 'http://www.w3.org/2007/ont/httph#', http => 'http://www.w3.org/2007/ont/http#' } ); $s->serialize_model_to_file(\*STDOUT, $model); =head1 DESCRIPTION This module simply takes a L object, and based on its content, especially the content the L object(s) it contains, creates a simple RDF representation of the contents. It is useful chiefly for recording data when crawling resources on the Web, but it may also have other uses. =head2 Constructor =over =item C<< new(%attributes) >> Moose-style constructor function. =back =head2 Attributes These attributes may be passed to the constructor to set them, or called like methods to get them. =over =item C<< message >> A L (or subclass thereof) object to generate RDF for. Required. =item C<< blacklist >> An C of header field names that you do not want to see in the output. =item C<< whitelist >> An C of the only header field names that you want to see in the output. The whitelist will be ignored if the blacklist is set. =item C<< graph >> You may pass an optional graph name to be used for all triples in the output. This must be an object of L. =item C<< ns >> An L object containing namespace prefixes used in the module. You should probably not override this even though you can. =item C<< request_subject >> An L object containing the subject of any statements describing requests. If unset, it will default to a blank node. =item C<< response_subject >> An L object containing the subject of any statements describing responses. If unset, it will default to a blank node. =back =head2 Methods The above attributes all have read-accessors by the same name. C, C and C also has writers and predicates, which is used to test if the attribute has been set, by prefixing C to the attribute name. This class has two methods: =over =item C<< generate ( [ $model ] ) >> This method will generate the RDF. It may optionally take an L as parameter. If it exists, the RDF will be added to this model, if not, a new Memory model will be created and returned. =item C<< ok_to_add ( $field ) >> This method will look up in the blacklists and whitelists and return true if the given field and value may be added to the model. =back =head1 EXAMPLES For an example of what the module can be used to create, consider the example in the L, which at the time of this writing outputs the following Turtle: @prefix http: . @prefix httph: . [] a http:RequestMessage ; http:hasResponse [ a http:ResponseMessage ; http:status "200" ; httph:client_date "Sun, 14 Dec 2014 21:28:21 GMT" ; httph:client_peer "207.171.7.59:80" ; httph:client_response_num "1" ; httph:connection "close" ; httph:content_length "3643" ; httph:content_type "text/html" ; httph:date "Sun, 14 Dec 2014 21:28:21 GMT" ; httph:link "; rel=\"alternate\"; title=\"RSS 1.0\"; type=\"application/rss+xml\"", "; rel=\"search\"; title=\"SearchCPAN\"; type=\"application/opensearchdescription+xml\"", "; media=\"print\"; rel=\"stylesheet\"; type=\"text/css\"", "; rel=\"stylesheet\"; type=\"text/css\"" ; httph:server "Plack/Starman (Perl)" ; httph:title "The CPAN Search Site - search.cpan.org" ; httph:x_proxy "proxy2" ] ; http:method "GET" ; http:requestURI ; httph:user_agent "libwww-perl/6.05" . =head1 NOTES =head2 HTTP Vocabularies There have been many efforts to create HTTP vocabularies (or ontologies), where the most elaborate and complete is the L. Nevertheless, I decided not to support this, but rather support an older and much less complete vocabulary that has been in the L project, with the namespace prefixes L and L. The problem of modelling HTTP is that headers modify each other, so if you want to record the HTTP headers so that they can be used in an actual HTTP dialogue afterwards, they have to be in a container so that the order can be reconstructed. Moreover, there is a lot of microstructure in the values, and that also adds complexity if you want to translate all that to RDF. That's what the former vocabulary does. However, for now, all the author wants to do is to record them, and then neither of these concerns are important. Therefore, I opted to go for a much simpler vocabulary, where each field is a simple predicate. That is not to say that the former approach isn't valid, it is just not something I need now. =head1 BUGS This is a very early release, but it works for the author. Please report any bugs to L. =head1 AUTHOR Kjetil Kjernsmo Ekjetilk@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Kjetil Kjernsmo. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.