COPYRIGHT000644001750001750 304713152353061 14273 0ustar00kjetilkjetil000000000000Test-RDF-1.22Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Test-RDF Upstream-Contact: Kjetil Kjernsmo Source: https://metacpan.org/module/Test::RDF Files: Changes META.json META.yml doap.ttl t/has_uri.t Copyright: Copyright 2017 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: t/are_subgraphs.t t/has_literal.t t/is_rdf.t t/isomorph_graphs.t Copyright: Copyright 2011 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: t/00-load.t t/hasnt_literal.t t/is_valid_rdf.t Copyright: Copyright 2013 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: t/pattern_fail.t t/pattern_ok.t Copyright: Copyright 2012 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: README lib/Test/RDF.pm Copyright: Copyright 2010 ABC Startsiden AS. Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2017 Kjetil Kjernsmo. License: GPL-1.0 Files: dist.ini Copyright: Copyright 2014 Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: Makefile.PL Copyright: Copyright 2013 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 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 11713152353060 13772 0ustar00kjetilkjetil000000000000Test-RDF-1.22Maintainer: - Kjetil Kjernsmo Contributor: - Toby Inkster Changes000644001750001750 566613152353060 14303 0ustar00kjetilkjetil000000000000Test-RDF-1.22Test-RDF ======== Created: 2010-09-03 Home page: Bug tracker: Maintainer: Kjetil Kjernsmo 1.22 2017-08-31 Add has_type function. - Added: Add has_type function. - Minor cosmetic changes. 1.20 2014-10-16 Fix packaging. - Added: Skip README.pod for CPAN. 1.19 2014-10-15 Cosmetic changes and diagnostics. [ Bug Fixes ] - Old metadata wasn't overwritten, deleted to allow Dist::Inkt to work. [ Other ] - Added: Add links to Debian. - Removed: Remove inc/ 1.18 2014-10-14 Cosmetic changes and diagnostics. - Added: Improve diagnostics if a model isn't given. - Added: Improve package metadata. - Use Dist::Inkt packaging. 1.16 2013-06-27 Bugfix and hasnt_literal. [ Bug Fixes ] - The new Turtle parser reports errors on a different spot. - With the new URI tests, my tests needs to check. [ Other ] - Added: Add new hasnt_literal test. 1.14 2012-11-21 Scalar::Util strange bug. - Updated: Dependency on Scalar::Util is anything but 1.23, set it to 1.24. 1.11 2012-10-17 Update to RDF::Trine 1.001. - Updated: Update test to check the new errors of RDF::Trine::Parser::Turtle 1.001. 1.10 2012-09-10 Add pattern_fail. - Added: Function to test if pattern doesn't exist. - Use RDF-based packaging. 1.00 2012-06-30 Stable release. - Added: Add a description to the POD. 0.26 2012-06-11 New hasnt_uri test. - Added: Add hasnt uri test. - Added: Improve pattern_ok diagnostics. - Added: Minor cosmetics. - Reorgnize metadata to exploit new modules - Use github issue tracker. 0.24 2011-10-10 Pattern tests. [ Bug Fixes ] - Parser may need an empty sub sometimes. [ Other ] - Added: Minor cosmetics. - Added: New pattern_ok and pattern_target functions. Toby Inkster++ - Added: Test for empty RDF strings 0.22 2011-04-01 Subgraph tests. - Added: Add a are_subgraphs function for testing if one graph is a subgraph of another. - Added: More documentation. - Added: Use the RDF::Graph::Trine error function for diagnostics - Removed: Remove the now unneeded dependency on Text::Diff::Table. 0.20 2010-12-18 Add functions for testing resources and literals. - Added: has_literal function to test if a literal is present. - Added: has_object_uri function to test if a URI is present as object. - Added: has_predicate function to test if a URI is present as predicate. - Added: has_subject function to test if a URI is present as subject. - Added: has_uri function to test if a URI is present at all in the graph. - Check Redland error messages in addition to Trine. 0.11 2010-11-08 Fix tainting problem. - Fix the tainting problem many cpantesters have. - Got authorized!. - Small cosmetic changes. 0.10 2010-11-06 Complete rewrite. - A complete rewrite from scratch using RDF::Trine. - Backwards incompatible with previous releases. 0.0.3 2006-13-04 Michael Hendricks old release based on RDF::Redland. INSTALL000644001750001750 164613152353060 14033 0ustar00kjetilkjetil000000000000Test-RDF-1.22 Installing Test-RDF should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm Test::RDF 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 Test::RDF INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan Test::RDF 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 Test-RDF: % 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 4366413152353060 14035 0ustar00kjetilkjetil000000000000Test-RDF-1.22This 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 44113152353061 14104 0ustar00kjetilkjetil000000000000Test-RDF-1.22COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE dist.ini doap.ttl lib/Test/RDF.pm t/00-load.t t/are_subgraphs.t t/has_literal.t t/has_uri.t t/hasnt_literal.t t/is_rdf.t t/is_valid_rdf.t t/isomorph_graphs.t t/pattern_fail.t t/pattern_ok.t META.json000644001750001750 352613152353061 14423 0ustar00kjetilkjetil000000000000Test-RDF-1.22{ "abstract" : "Test RDF data for validity and equality.", "author" : [ "Kjetil Kjernsmo " ], "dynamic_config" : 0, "generated_by" : "Dist::Inkt::Profile::TOBYINK version 0.024, CPAN::Meta::Converter version 2.150005", "keywords" : [], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Test-RDF", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : {}, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "runtime" : { "requires" : { "RDF::Trine" : "0.134", "Scalar::Util" : "1.24", "Test::Builder::Module" : "0", "Test::More" : "0", "perl" : "5.006" } }, "test" : { "requires" : { "Test::Tester" : "0" } } }, "provides" : { "Test::RDF" : { "file" : "lib/Test/RDF.pm", "version" : "1.22" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/kjetilk/Test-RDF/issues" }, "homepage" : "https://metacpan.org/module/Test::RDF", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "web" : "https://github.com/kjetilk/Test-RDF/" }, "x_IRC" : "irc://irc.perl.org/#perlrdf", "x_identifier" : "http://purl.org/NET/cpan-uri/dist/Test-RDF/project" }, "version" : "1.22", "x_contributors" : [ "Toby Inkster" ], "x_serialization_backend" : "JSON::PP version 2.27202", "x_static_install" : 1 } META.yml000644001750001750 221413152353061 14244 0ustar00kjetilkjetil000000000000Test-RDF-1.22--- abstract: 'Test RDF data for validity and equality.' author: - 'Kjetil Kjernsmo ' build_requires: Test::Tester: '0' configure_requires: ExtUtils::MakeMaker: '6.17' dynamic_config: 0 generated_by: 'Dist::Inkt::Profile::TOBYINK version 0.024, CPAN::Meta::Converter version 2.150005' keywords: [] license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Test-RDF no_index: directory: - eg - examples - inc - t - xt optional_features: {} provides: Test::RDF: file: lib/Test/RDF.pm version: '1.22' requires: RDF::Trine: '0.134' Scalar::Util: '1.24' Test::Builder::Module: '0' Test::More: '0' perl: '5.006' resources: IRC: irc://irc.perl.org/#perlrdf Identifier: http://purl.org/NET/cpan-uri/dist/Test-RDF/project bugtracker: https://github.com/kjetilk/Test-RDF/issues homepage: https://metacpan.org/module/Test::RDF license: http://dev.perl.org/licenses/ repository: https://github.com/kjetilk/Test-RDF/ version: '1.22' x_contributors: - 'Toby Inkster' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' x_static_install: 1 Makefile.PL000644001750001750 1141513152353061 14770 0ustar00kjetilkjetil000000000000Test-RDF-1.22use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "Test RDF data for validity and equality.", "author" => ["Kjetil Kjernsmo "], "dynamic_config" => 0, "generated_by" => "Dist::Inkt::Profile::TOBYINK version 0.024, CPAN::Meta::Converter version 2.150005", "keywords" => [], "license" => ["perl_5"], "meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => 2, }, "name" => "Test-RDF", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "prereqs" => { configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } }, runtime => { requires => { "perl" => 5.006, "RDF::Trine" => 0.134, "Scalar::Util" => 1.24, "Test::Builder::Module" => 0, "Test::More" => 0, }, }, test => { requires => { "Test::Tester" => 0 } }, }, "provides" => { "Test::RDF" => { file => "lib/Test/RDF.pm", version => 1.22 } }, "release_status" => "stable", "resources" => { bugtracker => { web => "https://github.com/kjetilk/Test-RDF/issues" }, homepage => "https://metacpan.org/module/Test::RDF", license => ["http://dev.perl.org/licenses/"], repository => { type => "git", web => "https://github.com/kjetilk/Test-RDF/" }, x_identifier => "http://purl.org/NET/cpan-uri/dist/Test-RDF/project", x_IRC => "irc://irc.perl.org/#perlrdf", }, "version" => 1.22, "x_contributors" => ["Toby Inkster"], "x_static_install" => 1, }; my %dynamic_config; my %WriteMakefileArgs = ( ABSTRACT => $meta->{abstract}, AUTHOR => ($EUMM >= 6.5702 ? $meta->{author} : $meta->{author}[0]), DISTNAME => $meta->{name}, VERSION => $meta->{version}, EXE_FILES => [ map $_->{file}, values %{ $meta->{x_provides_scripts} || {} } ], NAME => do { my $n = $meta->{name}; $n =~ s/-/::/g; $n }, test => { TESTS => "t/*.t" }, %dynamic_config, ); $WriteMakefileArgs{LICENSE} = $meta->{license}[0] if $EUMM >= 6.3001; sub deps { my %r; for my $stage (@_) { for my $dep (keys %{$meta->{prereqs}{$stage}{requires}}) { next if $dep eq 'perl'; my $ver = $meta->{prereqs}{$stage}{requires}{$dep}; $r{$dep} = $ver if !exists($r{$dep}) || $ver >= $r{$dep}; } } \%r; } my ($build_requires, $configure_requires, $runtime_requires, $test_requires); if ($EUMM >= 6.6303) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{TEST_REQUIRES} ||= deps('test'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.5503) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build', 'test'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.52) { $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime', 'build', 'test'); } else { $WriteMakefileArgs{PREREQ_PM} ||= deps('configure', 'build', 'test', 'runtime'); } { my ($minperl) = reverse sort( grep defined && /^[0-9]+(\.[0-9]+)?$/, map $meta->{prereqs}{$_}{requires}{perl}, qw( configure build runtime ) ); if (defined($minperl)) { die "Installing $meta->{name} requires Perl >= $minperl" unless $] >= $minperl; $WriteMakefileArgs{MIN_PERL_VERSION} ||= $minperl if $EUMM >= 6.48; } } sub FixMakefile { return unless -d 'inc'; my $file = shift; local *MAKEFILE; open MAKEFILE, "< $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; my $makefile = do { local $/; }; close MAKEFILE or die $!; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; open MAKEFILE, "> $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; print MAKEFILE $makefile or die $!; close MAKEFILE or die $!; } my $mm = WriteMakefile(%WriteMakefileArgs); FixMakefile($mm->{FIRST_MAKEFILE} || 'Makefile'); exit(0); README000644001750001750 1464313152353060 13703 0ustar00kjetilkjetil000000000000Test-RDF-1.22NAME Test::RDF - Test RDF data for content, validity and equality, etc. VERSION Version 1.22 SYNOPSIS use Test::RDF; is_valid_rdf($rdf_string, $syntax, 'RDF string is valid according to selected syntax'); is_rdf($rdf_string, $syntax1, $expected_rdf_string, $syntax2, 'The two strings have the same triples'); isomorph_graphs($model, $expected_model, 'The two models have the same triples'); are_subgraphs($model1, $model2, 'Model 1 is a subgraph of model 2' ); has_uri($uri_string, $model, 'Has correct URI'); hasnt_uri($uri_string, $model, "Hasn't correct URI"); has_subject($uri_string, $model, 'Subject URI is found'); has_predicate($uri_string, $model, 'Predicate URI is found'); has_object_uri($uri_string, $model, 'Object URI is found'); has_type($uri_string, $model, 'Class URI is found'); has_literal($string, $language, $datatype, $model, 'Literal is found'); hasnt_literal($string, $language, $datatype, $model, 'Literal is not found'); pattern_target($model); pattern_ok($pattern, '$pattern found in $model'); pattern_fail($pattern, '$pattern not found in $model'); DESCRIPTION This Perl module, Test::RDF, provides tools for testing code which deals with RDF. It can test RDF for validity, check if two RDF graphs are the same, or subgraphs of each other, if a URI is or is not in a dataset, if it has certain subjects, predicates, objects or literals. It can also test to see if a full pattern is present or absent. EXPORT is_valid_rdf Use to check if the input RDF string is valid in the chosen syntax is_rdf Use to check if the input RDF strings are isomorphic (i.e. the same). isomorph_graphs Use to check if the input RDF::Trine::Models have isomorphic graphs. are_subgraphs Use to check if the first RDF::Trine::Models is a subgraph of the second. has_subject Check if the string URI passed as first argument is a subject in any of the statements given in the model given as second argument. has_predicate Check if the string URI passed as first argument is a predicate in any of the statements given in the model given as second argument. has_object_uri Check if the string URI passed as first argument is a object in any of the statements given in the model given as second argument. has_type Check if the string URI passed as first argument is an RDF class instance in any of the statements given in the model given as second argument. has_literal Check if the string passed as first argument, with corresponding optional language and datatype as second and third respectively, is a literal in any of the statements given in the model given as fourth argument. language and datatype may not occur in the same statement, so the test fails if they are both set. If none are used, use `undef`, like e.g. has_literal('A test', undef, undef, $model, 'Simple literal'); A test for a typed literal may be done like has_literal('42', undef, 'http://www.w3.org/2001/XMLSchema#integer', $model, 'Just an integer'); and a language literal like has_literal('This is a Another test', 'en', undef, $model, 'Language literal'); hasnt_literal This is like the above, only the opposite: It checks if a literal doesn't exist. Like the above, the test will fail if the literal is invalid, however. has_uri Check if the string URI passed as first argument is present in any of the statements given in the model given as second argument. hasnt_uri Check if the string URI passed as first argument is not present in any of the statements given in the model given as second argument. pattern_target Tests that the object passed as its parameter is an RDF::Trine::Model or RDF::Trine::Store. That is, tests that it is a valid thing to match basic graph patterns against. Additionally, this test establishes the target for future `pattern_ok` tests. pattern_ok Tests that the pattern passed matches against the target established by `pattern_target`. The pattern may be passed as an RDF::Trine::Pattern, or a list of RDF::Trine::Statement objects. use Test::RDF; use RDF::Trine qw[iri literal blank variable statement]; use My::Module; my $foaf = RDF::Trine::Namespace->new('http://xmlns.com/foaf/0.1/'); pattern_target(My::Module->get_model); # check isa RDF::Trine::Model pattern_ok( statement( variable('who'), $foaf->name, literal('Kjetil Kjernsmo') ), statement( variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/') ), "Data contains Kjetil's details." ); Note: `pattern_target` must have been tested before any `pattern_ok` tests. pattern_fail The same as above, but tests if the pattern returns no results instead. NOTE Graph isomorphism is a complex problem, so do not attempt to run the isomorphism tests on large datasets. For more information see . AUTHOR Kjetil Kjernsmo, `` BUGS Please report any bugs using github SUPPORT You can find documentation for this module with the perldoc command. perldoc Test::RDF You may find the Perl and RDF community website useful. You can also look for information at: * AnnoCPAN: Annotated CPAN documentation * CPAN Ratings * Search CPAN * MetaCPAN ACKNOWLEDGEMENTS Michael Hendricks wrote the first Test::RDF. The present module is a complete rewrite from scratch using Gregory Todd William's RDF::Trine::Graph to do the heavy lifting. Toby Inkster has submitted the pattern_* functions. LICENSE AND COPYRIGHT Copyright 2010 ABC Startsiden AS. Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2017 Kjetil Kjernsmo. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. SIGNATURE000644001750001750 517413152353121 14264 0ustar00kjetilkjetil000000000000Test-RDF-1.22This 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 7b8698284f806c96847625dc75736c5e29854505 COPYRIGHT SHA1 df8cccf2efb0ae1a3b5b67cbad3da01e5d5d2087 CREDITS SHA1 06ebe8bbc8998728202959f31912cd7e8d14c93b Changes SHA1 9304476a656062aebc7ec99dda542e277d3affc8 INSTALL SHA1 7afae05d67ecea9c5e9328c4c29442c9d343da86 LICENSE SHA1 d428227379cef1641f0ef849eaaccedcfb3676f9 MANIFEST SHA1 8503b931f720fa3292ab8194d93dc4912b85a3f1 META.json SHA1 48355d6bb3c71775c7fc026cba0b359a05fdb067 META.yml SHA1 8b39eb6c22e32d973396fbd96cbb746d96949463 Makefile.PL SHA1 c6ede1116bb15f7f89c791e851a940aa286171ba README SHA1 923010d9edd00c16c601951dcecf3ec2ec83fdd6 dist.ini SHA1 d0bf478b6cfee20a337defe04a0c66fc866d3051 doap.ttl SHA1 bca065c925490bab637c7ab41b2ee41522ff52f1 lib/Test/RDF.pm SHA1 8c1510eabbc3a16dad03804bb61bd1b1ed44ebb9 t/00-load.t SHA1 45b601013f2b4a6f2f80b95a7708ff21f9212568 t/are_subgraphs.t SHA1 cf96f178cca61688f8ab8266f2d9964fb0c50984 t/has_literal.t SHA1 7ce603fa473dd1bb5e741ef628d3d6b0bdbb6193 t/has_uri.t SHA1 4bceb9ac21385b04dc126913078ce35657d29713 t/hasnt_literal.t SHA1 e94673346e7b3d4b948eacd680570f54235a449b t/is_rdf.t SHA1 37cec96fe4bd6e1930b32a4bcac468de7c133f22 t/is_valid_rdf.t SHA1 53a4d03276d84484ad3c5c12b3ffdcc08bddd5d1 t/isomorph_graphs.t SHA1 7768914589944c8c07140cc3bd0f5c82fd585a2e t/pattern_fail.t SHA1 80d80f06401ba7ccea49158e59a410680a676a81 t/pattern_ok.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUBWanWMX++6N86nkqlAQi/tw//ZIaM2ETv58q7Kgs/szC7qF6Knt4Mw50L zwn6o11CM3KvuE6G/eyU+yr4YNsF0t4W4GMQAjq59KobodZeYr0gaefpXWifVAlQ EsfkN4XMnZ5oQtyYQe4CP6NorEvcNnCtymS+7OvsJKorQNoSX76Eo4bzEzJkXsAt isPbdof3phat2zMvnZAhfTEdaixz4Nc+Rq80tx8tczBKsEOBKJt7lgBDUiBYsXlF TNMixbVvV4RtSQVZHraaGrBKVYbIoqMyX+3hmyQCAKEwdqSCrfIb2j7H7pNT/KQd ZVZQyIRQnCfMLBIISaPavE2yTO/I/XCp3z9mC9/1pOuKkmuF5ugkqcjOHoO5UFiH lb3Gb21mRmaoamrnOl/jXnIfyU4Sp0XSkk8oDgC3wynfkS3Qm6QohqwM3X+SF9zt azjI7UFrkW4vVHOTSnSIgqhfFBfhoFbdfF/mtPNvfkoWD9S8xt1rsBDgCdBlCPC1 rzoxsMRYSwQ4cRuXSwgaRc4JoH7PdNn1x0BTXH5llLm1G+XY/Yuvwe0G5fnBP0DA SF6PFGSBFrFfwijkG6EoLL6CJ6oxmxsJRK0pzGeHwurh61xbbwnnlHCYv1DwDVAT hqICSPdzQLRWGLAbHUMeAhAyjIMsILHieV5bR0YUWEsh3sHcRSMshAsQLtJRuT4y ba5h2iO/RvY= =3HX2 -----END PGP SIGNATURE----- dist.ini000644001750001750 12713152353057 14425 0ustar00kjetilkjetil000000000000Test-RDF-1.22;;class='Dist::Inkt::Profile::TOBYINK' ;;name='Test-RDF' ;;also_skip = [qr/README.pod/]doap.ttl000644001750001750 3015313152353061 14466 0ustar00kjetilkjetil000000000000Test-RDF-1.22@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 Test-RDF"@en. a doap:Project; doap-deps:runtime-requirement [ doap-deps:on "Scalar::Util 1.24"^^doap-deps:CpanId ], [ doap-deps:on "Test::More"^^doap-deps:CpanId ], [ doap-deps:on "Test::Builder::Module"^^doap-deps:CpanId; ], [ doap-deps:on "RDF::Trine 0.134"^^doap-deps:CpanId ], [ doap-deps:on "perl 5.006"^^doap-deps:CpanId ]; doap-deps:test-requirement [ doap-deps:on "Test::Tester"^^doap-deps:CpanId ]; doap:bug-database ; doap:created "2010-09-03"^^xsd:date; doap:homepage ; doap:license ; doap:maintainer ; doap:name "Test-RDF"; doap:programming-language "Perl"; doap:release , , , , , , , , , , , , , , , ; doap:repository [ a doap:GitRepository; doap:browse ; prov:has_provenance ; ]; doap:shortdesc "Test RDF data for validity and equality."@en; doap:support-forum ; owl:sameAs . a doap:Version; rdfs:label "Michael Hendricks old release based on RDF::Redland."@en; dc:creator ; dc:issued "2006-13-04"^^xsd:date; doap:revision "0.0.3"^^xsd:string. a doap:Version; rdfs:label "Complete rewrite."@en; dc:issued "2010-11-06"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "A complete rewrite from scratch using RDF::Trine."@en; ], [ a doap-changeset:Change; rdfs:label "Backwards incompatible with previous releases."@en; ]; ]; doap:revision "0.10"^^xsd:string. a doap:Version; rdfs:label "Fix tainting problem."@en; dc:issued "2010-11-08"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Fix the tainting problem many cpantesters have."@en; ], [ a doap-changeset:Change; rdfs:label "Small cosmetic changes."@en; ], [ a doap-changeset:Change; rdfs:label "Got authorized!."@en; ]; ]; doap:revision "0.11"^^xsd:string. a doap:Version; rdfs:label "Add functions for testing resources and literals."@en; dc:issued "2010-12-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "has_subject function to test if a URI is present as subject."@en; ], [ a doap-changeset:Addition; rdfs:label "has_predicate function to test if a URI is present as predicate."@en; ], [ a doap-changeset:Addition; rdfs:label "has_object_uri function to test if a URI is present as object."@en; ], [ a doap-changeset:Addition; rdfs:label "has_uri function to test if a URI is present at all in the graph."@en; ], [ a doap-changeset:Addition; rdfs:label "has_literal function to test if a literal is present."@en; ], [ a doap-changeset:Change; rdfs:label "Check Redland error messages in addition to Trine."@en; ]; ]; doap:revision "0.20"^^xsd:string. a doap:Version; rdfs:label "Subgraph tests."@en; dc:issued "2011-04-01"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Use the RDF::Graph::Trine error function for diagnostics"@en; ], [ a doap-changeset:Removal; rdfs:label "Remove the now unneeded dependency on Text::Diff::Table."@en; ], [ a doap-changeset:Addition; rdfs:label "Add a are_subgraphs function for testing if one graph is a subgraph of another."@en; ], [ a doap-changeset:Addition; rdfs:label "More documentation."@en; ]; ]; doap:revision "0.22"^^xsd:string. a doap:Version; rdfs:label "Pattern tests."@en; dc:issued "2011-10-10"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Test for empty RDF strings"@en; ], [ a doap-changeset:Bugfix; rdfs:label "Parser may need an empty sub sometimes."@en; ], [ a doap-changeset:Addition; rdfs:label "New pattern_ok and pattern_target functions."@en; doap-changeset:blame ; ], [ a doap-changeset:Addition; rdfs:label "Minor cosmetics."@en; ]; ]; doap:revision "0.24"^^xsd:string. a doap:Version; rdfs:label "New hasnt_uri test."@en; dc:issued "2012-06-11"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Reorgnize metadata to exploit new modules"@en; ], [ a doap-changeset:Change; rdfs:label "Use github issue tracker."@en; ], [ a doap-changeset:Addition; rdfs:label "Add hasnt uri test."@en; ], [ a doap-changeset:Addition; rdfs:label "Improve pattern_ok diagnostics."@en; ], [ a doap-changeset:Addition; rdfs:label "Minor cosmetics."@en; ]; ]; doap:revision "0.26"^^xsd:string. a doap:Version; rdfs:label "Bugfix and hasnt_literal."@en; dc:issued "2013-06-27"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Add new hasnt_literal test."@en; ], [ a doap-changeset:Bugfix; rdfs:label "The new Turtle parser reports errors on a different spot."@en; ], [ a doap-changeset:Bugfix; rdfs:label "With the new URI tests, my tests needs to check."@en; ]; ]; doap:revision "1.16"^^xsd:string. a doap:Version; rdfs:label "Cosmetic changes and diagnostics."@en; dc:issued "2014-10-14"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Improve diagnostics if a model isn't given."@en; ], [ a doap-changeset:Change; rdfs:label "Use Dist::Inkt packaging."@en; ], [ a doap-changeset:Addition; rdfs:label "Improve package metadata."@en; ]; ]; doap:revision "1.18"^^xsd:string. a doap:Version; rdfs:label "Cosmetic changes and diagnostics."@en; dc:issued "2014-10-15"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Old metadata wasn't overwritten, deleted to allow Dist::Inkt to work."@en; ], [ a doap-changeset:Addition; rdfs:label "Add links to Debian."@en; ], [ a doap-changeset:Removal; rdfs:label "Remove inc/"@en; ]; ]; doap:revision "1.19"^^xsd:string. a doap:Version; rdfs:label "Fix packaging."@en; dc:issued "2014-10-16"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Skip README.pod for CPAN."@en; ]; ]; doap:revision "1.20"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Add has_type function."@en; dc:issued "2017-08-31"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Add has_type function."@en; ], [ a doap-changeset:Change; rdfs:label "Minor cosmetic changes."@en; ]; ]; doap:revision "1.22"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Stable release."@en; dc:issued "2012-06-30"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Add a description to the POD."@en; ]; ]; doap:revision "1.00"^^xsd:string. a doap:Version; rdfs:label "Update to RDF::Trine 1.001."@en; dc:issued "2012-10-17"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Update test to check the new errors of RDF::Trine::Parser::Turtle 1.001."@en; ]; ]; doap:revision "1.11"^^xsd:string. a doap:Version; rdfs:label "Scalar::Util strange bug."@en; dc:issued "2012-11-21"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Dependency on Scalar::Util is anything but 1.23, set it to 1.24."@en; ]; ]; doap:revision "1.14"^^xsd:string. a doap:Version; rdfs:label "Add pattern_fail."@en; dc:issued "2012-09-10"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Use RDF-based packaging."@en; ], [ a doap-changeset:Addition; rdfs:label "Function to test if pattern doesn't exist."@en; ]; ]; doap:revision "1.10"^^xsd:string. a foaf:Person; foaf:name "Michael Hendricks"@en. a foaf:Person; foaf:homepage ; foaf:name "Toby Inkster". a foaf:Person; foaf:mbox ; foaf:name "Kjetil Kjernsmo"; owl:sameAs , . a types:ChatChannel. 00-load.t000644001750001750 30013152353057 14536 0ustar00kjetilkjetil000000000000Test-RDF-1.22/t#!perl use Test::More tests => 1; BEGIN { use_ok( 'Test::RDF' ) || print "Bail out! "; } diag( "Testing Test::RDF $Test::RDF::VERSION, RDF::Trine $RDF::Trine::VERSION, Perl $], $^X" ); are_subgraphs.t000644001750001750 1503013152353057 16275 0ustar00kjetilkjetil000000000000Test-RDF-1.22/tuse Test::Tester tests => 52; use Test::RDF; check_test( sub { my $model1 = RDF::Trine::Model->temporary_model; my $model2 = RDF::Trine::Model->temporary_model; my $parser = RDF::Trine::Parser->new( 'turtle' ); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model1); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model2); are_subgraphs($model1, $model2, 'Compare Turtle exact matches' ); }, { ok => 1, name => 'Compare Turtle exact matches', } ); check_test( sub { my $model1 = RDF::Trine::Model->temporary_model; my $model2 = RDF::Trine::Model->temporary_model; my $parser = RDF::Trine::Parser->new( 'turtle' ); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en ; "With more" .', $model1); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model2); are_subgraphs($model1, $model2, 'Compare Turtle with extra in model1' ); }, { ok => 0, name => 'Compare Turtle with extra in model1', diag => "Graph not subgraph: invocant had too many blank node statements to be a subgraph of argument\nHint: There are 2 statement(s) in model1 and 1 statement(s) in model2" } ); check_test( sub { my $model1 = RDF::Trine::Model->temporary_model; my $model2 = RDF::Trine::Model->temporary_model; my $parser = RDF::Trine::Parser->new( 'turtle' ); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en ; "With more" .', $model1); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en ; "With other" .', $model2); are_subgraphs($model1, $model2, 'Compare Turtle with extra in both' ); }, { ok => 0, name => 'Compare Turtle with extra in both', diag => "Hint: There are 2 statement(s) in model1 and 2 statement(s) in model2" } ); check_test( sub { my $model1 = RDF::Trine::Model->temporary_model; my $model2 = RDF::Trine::Model->temporary_model; my $parser1 = RDF::Trine::Parser->new( 'turtle' ); my $parser2 = RDF::Trine::Parser->new( 'rdfxml' ); $parser1->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model1); $parser2->parse_into_model( 'http://example.org', 'This is a Another test', $model2); are_subgraphs($model1, $model2, 'Compare RDF/XML and Turtle'); }, { ok => 1, name => 'Compare RDF/XML and Turtle', } ); check_test( sub { my $model1 = RDF::Trine::Model->temporary_model; my $model2 = RDF::Trine::Model->temporary_model; my $parser = RDF::Trine::Parser->new( 'turtle' ); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model1); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en ; "With more" .', $model2); are_subgraphs($model1, $model2, 'Compare Turtle with extra in model2' ); }, { ok => 1, name => 'Compare Turtle with extra in model2', } ); check_test( sub { my $model1 = RDF::Trine::Model->temporary_model; my $model2 = RDF::Trine::Model->temporary_model; my $parser1 = RDF::Trine::Parser->new( 'turtle' ); my $parser2 = RDF::Trine::Parser->new( 'rdfxml' ); $parser1->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model1); $parser2->parse_into_model( 'http://example.org', 'This is a Another test', $model2); are_subgraphs($model1, $model2, 'Compare RDF/XML and Turtle'); }, { ok => 1, name => 'Compare RDF/XML and Turtle', } ); check_test( sub { my $model1 = RDF::Trine::Model->temporary_model; my $model2 = RDF::Trine::Model->temporary_model; my $parser = RDF::Trine::Parser->new( 'turtle' ); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model1); $parser->parse_into_model( 'http://example.org', ' "This is a test"@en .', $model2); are_subgraphs($model1, $model2, 'Compare Turtle exact matches, with error' ); }, { ok => 0, name => 'Compare Turtle exact matches, with error', diag => "Hint: There are 1 statement(s) in model1 and 1 statement(s) in model2" } ); check_test( sub { my $model1 = RDF::Trine::Model->temporary_model; my $model2 = RDF::Trine::Model->temporary_model; my $parser1 = RDF::Trine::Parser->new( 'turtle' ); my $parser2 = RDF::Trine::Parser->new( 'rdfxml' ); $parser1->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model1); $parser2->parse_into_model( 'http://example.org', 'This is a test', $model2); are_subgraphs($model1, $model2, 'Compare RDF/XML and Turtle, with error'); }, { ok => 0, name => 'Compare RDF/XML and Turtle, with error', diag => "Hint: There are 1 statement(s) in model1 and 1 statement(s) in model2" } ); has_literal.t000644001750001750 600013152353057 15714 0ustar00kjetilkjetil000000000000Test-RDF-1.22/tuse Test::Tester tests => 80; use Test::RDF; use RDF::Trine; my $model = RDF::Trine::Model->temporary_model; my $parser = RDF::Trine::Parser->new( 'turtle' ); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en ; "A test" ; 42 ; a .', $model); check_test( sub { has_literal('A test', undef, undef, $model, 'Simple literal'); }, { ok => 1, name => 'Simple literal', } ); check_test( sub { has_literal('A test', 'en', undef, $model, 'Not a simple literal'); }, { ok => 0, name => 'Not a simple literal', diag => 'No matching literals found in model' } ); check_test( sub { has_literal('42', undef, 'http://www.w3.org/2001/XMLSchema#integer', $model, 'Just an integer'); }, { ok => 1, name => 'Just an integer', } ); check_test( sub { has_literal('42', undef, undef, $model, 'Not a simple literal'); }, { ok => 0, name => 'Not a simple literal', diag => 'No matching literals found in model' } ); check_test( sub { has_literal('42', 'en', 'http://www.w3.org/2001/XMLSchema#integer', $model, 'Not a simple literal'); }, { ok => 0, name => 'Not a simple literal', diag => "Invalid literal:\n\n\tLiteral values cannot have both language and datatype" } ); check_test( sub { has_literal('42', 'en', undef, $model, 'Not a simple literal'); }, { ok => 0, name => 'Not a simple literal', diag => 'No matching literals found in model' } ); check_test( sub { has_literal('This is a Another test', 'en', undef, $model, 'Language literal'); }, { ok => 1, name => 'Language literal', } ); check_test( sub { has_literal('This is a Another test', 'en', undef, $model, 'Language literal'); }, { ok => 1, name => 'Language literal', } ); check_test( sub { has_literal('This is a Another test', 'no', undef, $model, 'Literal with wrong language'); }, { ok => 0, name => 'Literal with wrong language', diag => 'No matching literals found in model' } ); check_test( sub { has_literal('This is a Another test', 'en', 'http://www.w3.org/2001/XMLSchema#integer', $model, 'Literal with language and datatype'); }, { ok => 0, name => 'Literal with language and datatype', diag => "Invalid literal:\n\n\tLiteral values cannot have both language and datatype" } ); check_test( sub { has_literal('http://example.com/Bar', undef, undef, $model, 'Has a URI'); }, { ok => 0, name => 'Has a URI', diag => 'No matching literals found in model' } ); check_test( sub { has_literal('"This is a Another test"@en', undef, undef, $model, 'Has a string not literal'); }, { ok => 0, name => 'Has a string not literal', diag => 'No matching literals found in model' } ); has_uri.t000644001750001750 1024513152353057 15105 0ustar00kjetilkjetil000000000000Test-RDF-1.22/tuse Test::Tester tests => 125; use Test::RDF; use RDF::Trine; my $model = RDF::Trine::Model->temporary_model; my $parser = RDF::Trine::Parser->new( 'turtle' ); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en ; a .', $model); check_test( sub { has_subject('http://example.org/foo', $model, 'Has correct subject URI'); }, { ok => 1, name => 'Has correct subject URI', } ); check_test( sub { has_subject('http://example.com/foo', $model, 'Has not correct subject URI'); }, { ok => 0, name => 'Has not correct subject URI', diag => 'No matching URIs found in model' } ); check_test( sub { has_subject('"This is a Another test"@en', $model, 'Has literal not subject'); }, { ok => 0, name => 'Has literal not subject', diag => 'No matching URIs found in model' } ); check_test( sub { has_predicate('http://www.w3.org/2000/01/rdf-schema#label', $model, 'Has correct predicate URI'); }, { ok => 1, name => 'Has correct predicate URI', } ); check_test( sub { has_predicate('http://example.com/foo', $model, 'Has not correct predicate URI'); }, { ok => 0, name => 'Has not correct predicate URI', diag => 'No matching URIs found in model' } ); check_test( sub { has_object_uri('http://example.org/Bar', $model, 'Has correct object URI'); }, { ok => 1, name => 'Has correct object URI', } ); check_test( sub { has_object_uri('http://example.com/Bar', $model, 'Has not correct object URI'); }, { ok => 0, name => 'Has not correct object URI', diag => 'No matching URIs found in model' } ); check_test( sub { has_type('http://example.com/Bar', $model, 'Has not correct type URI'); }, { ok => 0, name => 'Has not correct type URI', diag => 'No matching URIs found in model' } ); check_test( sub { has_object_uri('"This is a Another test"@en', $model, 'Has literal not URI'); }, { ok => 0, name => 'Has literal not URI', diag => 'No matching URIs found in model' } ); check_test( sub { has_uri('http://example.org/foo', $model, 'Has correct subject URI'); }, { ok => 1, name => 'Has correct subject URI', } ); check_test( sub { has_uri('http://www.w3.org/2000/01/rdf-schema#label', $model, 'Has correct predicate URI'); }, { ok => 1, name => 'Has correct predicate URI', } ); check_test( sub { has_uri('http://example.org/Bar', $model, 'Has correct object URI'); }, { ok => 1, name => 'Has correct object URI', } ); check_test( sub { has_uri('http://example.com/foo', $model, 'Has not correct URI'); }, { ok => 0, name => 'Has not correct URI', diag => 'No matching URIs found in model' } ); check_test( sub { has_uri('"This is a Another test"@en', $model, 'Has a literal'); }, { ok => 0, name => 'Has a literal', diag => 'No matching URIs found in model' } ); check_test( sub { hasnt_uri('http://example.org/foo', $model, 'Has correct subject URI'); }, { ok => 0, diag => 'Matching URIs found in model', name => 'Has correct subject URI', } ); check_test( sub { hasnt_uri('http://www.w3.org/2000/01/rdf-schema#label', $model, 'Has correct predicate URI'); }, { ok => 0, diag => 'Matching URIs found in model', name => 'Has correct predicate URI', } ); check_test( sub { hasnt_uri('http://example.org/Bar', $model, 'Has correct object URI'); }, { ok => 0, diag => 'Matching URIs found in model', name => 'Has correct object URI', } ); check_test( sub { hasnt_uri('http://example.com/foo', $model, 'Has not correct URI'); }, { ok => 1, name => 'Has not correct URI', } ); check_test( sub { hasnt_uri('"This is a Another test"@en', $model, 'Has a literal'); }, { ok => 1, name => 'Has a literal', } ); hasnt_literal.t000644001750001750 612713152353057 16270 0ustar00kjetilkjetil000000000000Test-RDF-1.22/tuse Test::Tester tests => 83; use Test::RDF; use RDF::Trine; my $model = RDF::Trine::Model->temporary_model; my $parser = RDF::Trine::Parser->new( 'turtle' ); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en ; "A test" ; 42 ; a .', $model); check_test( sub { hasnt_literal('A new test', undef, undef, $model, 'Simple literal'); }, { ok => 1, name => 'Simple literal', } ); check_test( sub { hasnt_literal('A test', 'en', undef, $model, 'Not a simple literal'); }, { ok => 1, name => 'Not a simple literal', } ); check_test( sub { hasnt_literal('A test', undef, undef, $model, 'Not a simple literal'); }, { ok => 0, name => 'Not a simple literal', diag => 'Matching literals found in model' } ); check_test( sub { hasnt_literal('42', undef, 'http://www.w3.org/2001/XMLSchema#integer', $model, 'Just an integer'); }, { ok => 0, name => 'Just an integer', diag => 'Matching literals found in model' } ); check_test( sub { hasnt_literal('42', undef, undef, $model, 'Not a integer simple literal'); }, { ok => 1, name => 'Not a integer simple literal', } ); check_test( sub { hasnt_literal('42', 'en', 'http://www.w3.org/2001/XMLSchema#integer', $model, 'Integer with lang and datatype'); }, { ok => 0, name => 'Integer with lang and datatype', diag => "Invalid literal:\n\n\tLiteral values cannot have both language and datatype" } ); check_test( sub { hasnt_literal('42', 'en', undef, $model, 'Literal integer with lang'); }, { ok => 1, name => 'Literal integer with lang', } ); check_test( sub { hasnt_literal('This is a Another test', 'en', undef, $model, 'Language literal'); }, { ok => 0, name => 'Language literal', diag => 'Matching literals found in model' } ); check_test( sub { hasnt_literal('This is not Another test', 'en', undef, $model, 'Language literal'); }, { ok => 1, name => 'Language literal', } ); check_test( sub { hasnt_literal('This is a Another test', 'no', undef, $model, 'Literal with wrong language'); }, { ok => 1, name => 'Literal with wrong language', } ); check_test( sub { hasnt_literal('This is a Another test', 'en', 'http://www.w3.org/2001/XMLSchema#integer', $model, 'Literal with language and datatype'); }, { ok => 0, name => 'Literal with language and datatype', diag => "Invalid literal:\n\n\tLiteral values cannot have both language and datatype" } ); check_test( sub { hasnt_literal('http://example.com/Bar', undef, undef, $model, 'Has a URI'); }, { ok => 1, name => 'Has a URI', } ); check_test( sub { hasnt_literal('"This is a Another test"@en', undef, undef, $model, 'Has a string not literal'); }, { ok => 1, name => 'Has a string not literal', } ); is_rdf.t000644001750001750 517113152353057 14703 0ustar00kjetilkjetil000000000000Test-RDF-1.22/tuse Test::Tester tests => 33; use Test::RDF; check_test( sub { is_rdf(' "This is a Another test"@en .', 'turtle',' "This is a Another test"@en .', 'turtle', 'Compare Turtle exact matches' ); }, { ok => 1, name => 'Compare Turtle exact matches', } ); check_test( sub { is_rdf(' "This is a Another test"@en .', 'turtle', 'This is a Another test', 'rdfxml', 'Compare RDF/XML and Turtle'); }, { ok => 1, name => 'Compare RDF/XML and Turtle', } ); check_test( sub { is_rdf(' "This is a Another test"@en .', 'turtle',' "This is a test"@en .', 'turtle', 'Compare Turtle exact matches, with error' ); }, { ok => 0, name => 'Compare Turtle exact matches, with error', diag => "Graphs differ:\nnon-blank triples don't match: \$VAR1 = '(triple \"This is a Another test\"\@en)';\n\$VAR2 = '(triple \"This is a test\"\@en)';" } ); check_test( sub { is_rdf('', 'turtle',' "This is a test"@en .', 'turtle', 'Pass empty string' ); }, { ok => 0, name => 'Pass empty string', diag => 'No input was given.' } ); check_test( sub { is_rdf(' "This is a Another test"@en .', 'turtle', 'This is a test', 'rdfxml', 'Compare RDF/XML and Turtle, with error'); }, { ok => 0, name => 'Compare RDF/XML and Turtle, with error', diag => "Graphs differ:\nnon-blank triples don't match: \$VAR1 = '(triple \"This is a Another test\"\@en)';\n\$VAR2 = '(triple \"This is a test\"\@en)';" } ); is_valid_rdf.t000644001750001750 362113152353057 16060 0ustar00kjetilkjetil000000000000Test-RDF-1.22/tuse Test::Tester tests => 23; use Test::More; use Test::RDF; check_test( sub { is_valid_rdf(' "This is a Another test"@en .', 'turtle', 'Valid turtle'); }, { ok => 1, name => 'Valid turtle' } ); check_test( sub { is_valid_rdf('', 'turtle', 'Pass empty string' ); }, { ok => 0, name => 'Pass empty string', diag => 'No input was given.' } ); { my ($premature, @results) = run_tests( sub { is_valid_rdf(' "This is a Another test@en .', 'turtle', 'Valid turtle'); }); is($results[0]->{ok}, 0, 'Not Valid turtle'); like($results[0]->{diag}, qr/Input was not valid RDF:\n\n\t(No tokens|Redland error: syntax error at '"'|Got '"' while expecting string character at 1:[5-8]\d)/, 'Error message is correct'); } check_test( sub { is_valid_rdf('This is a Another test', 'rdfxml', 'Valid RDF/XML'); }, { ok => 1, name => 'Valid RDF/XML', } ); { my ($premature, @results) = run_tests( sub { is_valid_rdf('', 'rdfxml', 'Valid RDF/XML'); }); is($results[0]->{ok}, 0, 'Not Valid RDF/XML'); like($results[0]->{diag}, qr/Input was not valid RDF:\n\n\t(Unknown namespace: |Redland error: Using an element 'Description' without a namespace is forbidden.)/, 'Error message is correct'); } isomorph_graphs.t000644001750001750 725013152353057 16641 0ustar00kjetilkjetil000000000000Test-RDF-1.22/tuse Test::Tester tests => 26; use Test::RDF; check_test( sub { my $model1 = RDF::Trine::Model->temporary_model; my $model2 = RDF::Trine::Model->temporary_model; my $parser = RDF::Trine::Parser->new( 'turtle' ); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model1); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model2); isomorph_graphs($model1, $model2, 'Compare Turtle exact matches' ); }, { ok => 1, name => 'Compare Turtle exact matches', } ); check_test( sub { my $model1 = RDF::Trine::Model->temporary_model; my $model2 = RDF::Trine::Model->temporary_model; my $parser1 = RDF::Trine::Parser->new( 'turtle' ); my $parser2 = RDF::Trine::Parser->new( 'rdfxml' ); $parser1->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model1); $parser2->parse_into_model( 'http://example.org', 'This is a Another test', $model2); isomorph_graphs($model1, $model2, 'Compare RDF/XML and Turtle'); }, { ok => 1, name => 'Compare RDF/XML and Turtle', } ); check_test( sub { my $model1 = RDF::Trine::Model->temporary_model; my $model2 = RDF::Trine::Model->temporary_model; my $parser = RDF::Trine::Parser->new( 'turtle' ); $parser->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model1); $parser->parse_into_model( 'http://example.org', ' "This is a test"@en .', $model2); isomorph_graphs($model1, $model2, 'Compare Turtle exact matches, with error' ); }, { ok => 0, name => 'Compare Turtle exact matches, with error', diag => "Graphs differ:\nnon-blank triples don't match: \$VAR1 = '(triple \"This is a Another test\"\@en)';\n\$VAR2 = '(triple \"This is a test\"\@en)';" } ); check_test( sub { my $model1 = RDF::Trine::Model->temporary_model; my $model2 = RDF::Trine::Model->temporary_model; my $parser1 = RDF::Trine::Parser->new( 'turtle' ); my $parser2 = RDF::Trine::Parser->new( 'rdfxml' ); $parser1->parse_into_model( 'http://example.org', ' "This is a Another test"@en .', $model1); $parser2->parse_into_model( 'http://example.org', 'This is a test', $model2); isomorph_graphs($model1, $model2, 'Compare RDF/XML and Turtle, with error'); }, { ok => 0, name => 'Compare RDF/XML and Turtle, with error', diag => "Graphs differ:\nnon-blank triples don't match: \$VAR1 = '(triple \"This is a Another test\"\@en)';\n\$VAR2 = '(triple \"This is a test\"\@en)';" } ); pattern_fail.t000644001750001750 554513152353057 16112 0ustar00kjetilkjetil000000000000Test-RDF-1.22/tuse Test::Tester tests=>43; use Test::RDF; use RDF::Trine qw[iri variable literal statement]; my $model; check_test( sub { pattern_target($model = RDF::Trine::Model->new); }, { ok => 1, name => 'Data is an RDF::Trine::Model.', }, 'pattern_target - target model' ); RDF::Trine::Parser->new('turtle')->parse_into_model('http://example.org', <<'TURTLE', $model); @prefix foaf: . [] a foaf:Person ; foaf:name "Kjetil Kjernsmo" ; foaf:page . [] a foaf:Person ; foaf:name "Toby Inkster" ; foaf:page . TURTLE my $foaf = RDF::Trine::Namespace->new('http://xmlns.com/foaf/0.1/'); check_test( sub { pattern_fail( statement(variable('who'), $foaf->name, literal('Kjetil Kjernsmo')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), ); }, { ok => 0, }, 'pattern_fail - statement list' ); check_test( sub { pattern_fail( RDF::Trine::Pattern->new( statement(variable('who'), $foaf->name, literal('Kjetil Kjernsmo')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), ), ); }, { ok => 0, }, 'pattern_fail - pattern' ); check_test( sub { pattern_fail( statement(variable('who'), $foaf->name, literal('Kjetil Kjernsmo')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), "FOO", ); }, { ok => 0, name => 'FOO', }, 'pattern_fail - statement list plus message' ); check_test( sub { pattern_fail( RDF::Trine::Pattern->new( statement(variable('who'), $foaf->name, literal('Kjetil Kjernsmo')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), ), "FOO", ); }, { ok => 0, name => 'FOO', }, 'pattern_fail - pattern plus message' ); check_test( sub { pattern_fail( statement(variable('who'), $foaf->name, literal('Toby Inkster')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), ); }, { ok => 1, }, 'pattern_fail - statement list should fail' ); check_test( sub { pattern_fail( RDF::Trine::Pattern->new( statement(variable('who'), $foaf->name, literal('Toby Inkster')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), ), ); }, { ok => 1, }, 'pattern_fail - pattern should fail' ); check_test( sub { pattern_fail( RDF::Trine::Pattern->new( statement(variable('who'), $foaf->name, literal('DAHUT')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), ), ); }, { ok => 1, }, 'pattern_fail - pattern should fail' ); pattern_ok.t000644001750001750 715713152353057 15611 0ustar00kjetilkjetil000000000000Test-RDF-1.22/tuse Test::Tester tests=>65; use Test::RDF; use RDF::Trine qw[iri variable literal statement]; check_test( sub { pattern_target(100); }, { ok => 0, name => 'Data is not an RDF::Trine::Model or RDF::Trine::Store.', }, 'pattern_target - invalid target' ); check_test( sub { pattern_ok(); }, { ok => 0, name => 'Pattern match', diag => 'No target defined for pattern match. Call pattern_target test first.', }, 'pattern_ok - uninitialised target' ); check_test( sub { my $store = RDF::Trine::Store->temporary_store; pattern_target($store); }, { ok => 1, name => 'Data is an RDF::Trine::Store.', }, 'pattern_target - target store' ); my $model; check_test( sub { pattern_target($model = RDF::Trine::Model->new); }, { ok => 1, name => 'Data is an RDF::Trine::Model.', }, 'pattern_target - target model' ); RDF::Trine::Parser->new('turtle')->parse_into_model('http://example.org', <<'TURTLE', $model); @prefix foaf: . [] a foaf:Person ; foaf:name "Kjetil Kjernsmo" ; foaf:page . [] a foaf:Person ; foaf:name "Toby Inkster" ; foaf:page . TURTLE my $foaf = RDF::Trine::Namespace->new('http://xmlns.com/foaf/0.1/'); check_test( sub { pattern_ok( statement(variable('who'), $foaf->name, literal('Kjetil Kjernsmo')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), ); }, { ok => 1, }, 'pattern_ok - statement list' ); check_test( sub { pattern_ok( RDF::Trine::Pattern->new( statement(variable('who'), $foaf->name, literal('Kjetil Kjernsmo')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), ), ); }, { ok => 1, }, 'pattern_ok - pattern' ); check_test( sub { pattern_ok( statement(variable('who'), $foaf->name, literal('Kjetil Kjernsmo')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), "FOO", ); }, { ok => 1, name => 'FOO', }, 'pattern_ok - statement list plus message' ); check_test( sub { pattern_ok( RDF::Trine::Pattern->new( statement(variable('who'), $foaf->name, literal('Kjetil Kjernsmo')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), ), "FOO", ); }, { ok => 1, name => 'FOO', }, 'pattern_ok - pattern plus message' ); check_test( sub { pattern_ok( statement(variable('who'), $foaf->name, literal('Toby Inkster')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), ); }, { ok => 0, diag => 'Pattern as a whole did not match' }, 'pattern_ok - statement list should fail' ); check_test( sub { pattern_ok( RDF::Trine::Pattern->new( statement(variable('who'), $foaf->name, literal('Toby Inkster')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), ), ); }, { ok => 0, diag => 'Pattern as a whole did not match' }, 'pattern_ok - pattern should fail' ); check_test( sub { pattern_ok( RDF::Trine::Pattern->new( statement(variable('who'), $foaf->name, literal('DAHUT')), statement(variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/')), ), ); }, { ok => 0, diag => "Triples that had no results:\n(triple ?who \"DAHUT\")" }, 'pattern_ok - pattern should fail' ); RDF.pm000644001750001750 4123713152353057 15466 0ustar00kjetilkjetil000000000000Test-RDF-1.22/lib/Testpackage Test::RDF; use 5.006; use warnings; use strict; use Carp qw(confess); use RDF::Trine; use RDF::Trine::Parser; use RDF::Trine::Model; use RDF::Trine::Graph; use Scalar::Util qw/blessed/; use base 'Test::Builder::Module'; our @EXPORT = qw/are_subgraphs is_rdf is_valid_rdf isomorph_graphs has_subject has_predicate has_object_uri has_type has_uri hasnt_uri has_literal hasnt_literal pattern_target pattern_ok pattern_fail/; =head1 NAME Test::RDF - Test RDF data for content, validity and equality, etc. =head1 VERSION Version 1.22 =cut our $VERSION = '1.22'; =head1 SYNOPSIS use Test::RDF; is_valid_rdf($rdf_string, $syntax, 'RDF string is valid according to selected syntax'); is_rdf($rdf_string, $syntax1, $expected_rdf_string, $syntax2, 'The two strings have the same triples'); isomorph_graphs($model, $expected_model, 'The two models have the same triples'); are_subgraphs($model1, $model2, 'Model 1 is a subgraph of model 2' ); has_uri($uri_string, $model, 'Has correct URI'); hasnt_uri($uri_string, $model, "Hasn't correct URI"); has_subject($uri_string, $model, 'Subject URI is found'); has_predicate($uri_string, $model, 'Predicate URI is found'); has_object_uri($uri_string, $model, 'Object URI is found'); has_type($uri_string, $model, 'Class URI is found'); has_literal($string, $language, $datatype, $model, 'Literal is found'); hasnt_literal($string, $language, $datatype, $model, 'Literal is not found'); pattern_target($model); pattern_ok($pattern, '$pattern found in $model'); pattern_fail($pattern, '$pattern not found in $model'); =head1 DESCRIPTION This Perl module, Test::RDF, provides tools for testing code which deals with RDF. It can test RDF for validity, check if two RDF graphs are the same, or subgraphs of each other, if a URI is or is not in a dataset, if it has certain subjects, predicates, objects or literals. It can also test to see if a full pattern is present or absent. =head1 EXPORT =head2 is_valid_rdf Use to check if the input RDF string is valid in the chosen syntax =cut sub is_valid_rdf { my ($rdf, $syntax, $name) = @_; my $test = __PACKAGE__->builder; unless ($rdf) { $test->ok( 0, $name ); $test->diag("No input was given."); return; } my $parser = RDF::Trine::Parser->new($syntax); eval { $parser->parse('http://example.org/', $rdf, sub {}); }; if ( my $error = $@ ) { $test->ok( 0, $name ); $test->diag("Input was not valid RDF:\n\n\t$error"); return; } else { $test->ok( 1, $name ); return 1; } } =head2 is_rdf Use to check if the input RDF strings are isomorphic (i.e. the same). =cut sub is_rdf { my ($rdf1, $syntax1, $rdf2, $syntax2, $name) = @_; my $test = __PACKAGE__->builder; unless ($rdf1) { $test->ok( 0, $name ); $test->diag("No input was given."); return; } my $parser1 = RDF::Trine::Parser->new($syntax1); local $Test::Builder::Level = $Test::Builder::Level + 1; # First, test if the input RDF is OK my $model1 = RDF::Trine::Model->temporary_model; eval { $parser1->parse_into_model('http://example.org/', $rdf1, $model1); }; if ( my $error = $@ ) { $test->ok( 0, $name ); $test->diag("Input was not valid RDF:\n\n\t$error"); return; } # If the expected RDF is non-valid, don't catch the exception my $parser2 = RDF::Trine::Parser->new($syntax2); my $model2 = RDF::Trine::Model->temporary_model; $parser2->parse_into_model('http://example.org/', $rdf2, $model2); return isomorph_graphs($model1, $model2, $name); } =head2 isomorph_graphs Use to check if the input RDF::Trine::Models have isomorphic graphs. =cut sub isomorph_graphs { my ($model1, $model2, $name) = @_; confess 'No valid models given in test' unless ((blessed($model1) && $model1->isa('RDF::Trine::Model')) && (blessed($model2) && $model2->isa('RDF::Trine::Model'))); my $g1 = RDF::Trine::Graph->new( $model1 ); my $g2 = RDF::Trine::Graph->new( $model2 ); my $test = __PACKAGE__->builder; if ($g1->equals($g2)) { $test->ok( 1, $name ); return 1; } else { $test->ok( 0, $name ); $test->diag('Graphs differ:'); $test->diag($g1->error); return; } } =head2 are_subgraphs Use to check if the first RDF::Trine::Models is a subgraph of the second. =cut sub are_subgraphs { my ($model1, $model2, $name) = @_; confess 'No valid models given in test' unless ((blessed($model1) && $model1->isa('RDF::Trine::Model')) && (blessed($model2) && $model2->isa('RDF::Trine::Model'))); my $g1 = RDF::Trine::Graph->new( $model1 ); my $g2 = RDF::Trine::Graph->new( $model2 ); my $test = __PACKAGE__->builder; if ($g1->is_subgraph_of($g2)) { $test->ok( 1, $name ); return 1; } else { $test->ok( 0, $name ); $test->diag('Graph not subgraph: ' . $g1->error) if defined($g1->error); $test->diag('Hint: There are ' . $model1->size . ' statement(s) in model1 and ' . $model2->size . ' statement(s) in model2'); return; } } =head2 has_subject Check if the string URI passed as first argument is a subject in any of the statements given in the model given as second argument. =cut sub has_subject { my ($uri, $model, $name) = @_; confess 'No valid model given in test' unless (blessed($model) && $model->isa('RDF::Trine::Model')); my $resource = _resource_uri_checked($uri, $name); return $resource unless ($resource); my $count = $model->count_statements($resource, undef, undef); return _single_uri_tests($count, $name); } =head2 has_predicate Check if the string URI passed as first argument is a predicate in any of the statements given in the model given as second argument. =cut sub has_predicate { my ($uri, $model, $name) = @_; confess 'No valid model given in test' unless (blessed($model) && $model->isa('RDF::Trine::Model')); my $resource = _resource_uri_checked($uri, $name); return $resource unless ($resource); my $count = $model->count_statements(undef, $resource, undef); return _single_uri_tests($count, $name); } =head2 has_object_uri Check if the string URI passed as first argument is a object in any of the statements given in the model given as second argument. =cut sub has_object_uri { my ($uri, $model, $name) = @_; confess 'No valid model given in test' unless (blessed($model) && $model->isa('RDF::Trine::Model')); my $resource = _resource_uri_checked($uri, $name); return $resource unless ($resource); my $count = $model->count_statements(undef, undef, $resource); return _single_uri_tests($count, $name); } =head2 has_type Check if the string URI passed as first argument is an RDF class instance in any of the statements given in the model given as second argument. =cut sub has_type { my ($uri, $model, $name) = @_; confess 'No valid model given in test' unless (blessed($model) && $model->isa('RDF::Trine::Model')); my $resource = _resource_uri_checked($uri, $name); return $resource unless ($resource); my $count = $model->count_statements(undef, RDF::Trine::Node::Resource->new('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), $resource); return _single_uri_tests($count, $name); } =head2 has_literal Check if the string passed as first argument, with corresponding optional language and datatype as second and third respectively, is a literal in any of the statements given in the model given as fourth argument. language and datatype may not occur in the same statement, so the test fails if they are both set. If none are used, use C, like e.g. has_literal('A test', undef, undef, $model, 'Simple literal'); A test for a typed literal may be done like has_literal('42', undef, 'http://www.w3.org/2001/XMLSchema#integer', $model, 'Just an integer'); and a language literal like has_literal('This is a Another test', 'en', undef, $model, 'Language literal'); =cut sub has_literal { my ($string, $lang, $datatype, $model, $name) = @_; confess 'No valid model given in test' unless (blessed($model) && $model->isa('RDF::Trine::Model')); my $literal; my $test = __PACKAGE__->builder; eval { $literal = RDF::Trine::Node::Literal->new($string, $lang, $datatype); }; if ( my $error = $@ ) { $test->ok( 0, $name ); $test->diag("Invalid literal:\n\n\t$error"); return; } if ($model->count_statements(undef, undef, $literal) > 0) { $test->ok( 1, $name ); return 1; } else { $test->ok( 0, $name ); $test->diag('No matching literals found in model'); return 0; } } =head2 hasnt_literal This is like the above, only the opposite: It checks if a literal doesn't exist. Like the above, the test will fail if the literal is invalid, however. =cut sub hasnt_literal { my ($string, $lang, $datatype, $model, $name) = @_; confess 'No valid model given in test' unless (blessed($model) && $model->isa('RDF::Trine::Model')); my $literal; my $test = __PACKAGE__->builder; eval { $literal = RDF::Trine::Node::Literal->new($string, $lang, $datatype); }; if ( my $error = $@ ) { $test->ok( 0, $name ); $test->diag("Invalid literal:\n\n\t$error"); return; } if ($model->count_statements(undef, undef, $literal) > 0) { $test->ok( 0, $name ); $test->diag('Matching literals found in model'); return 0; } else { $test->ok( 1, $name ); return 1; } } =head2 has_uri Check if the string URI passed as first argument is present in any of the statements given in the model given as second argument. =cut sub has_uri { my ($uri, $model, $name) = @_; confess 'No valid model given in test' unless (blessed($model) && $model->isa('RDF::Trine::Model')); my $test = __PACKAGE__->builder; my $resource = _resource_uri_checked($uri, $name); return $resource unless ($resource); if ($model->count_statements(undef, undef, $resource) > 0 || $model->count_statements(undef, $resource, undef) > 0 || $model->count_statements($resource, undef, undef) > 0) { $test->ok( 1, $name ); return 1; } else { $test->ok( 0, $name ); $test->diag('No matching URIs found in model'); return 0; } } =head2 hasnt_uri Check if the string URI passed as first argument is not present in any of the statements given in the model given as second argument. =cut sub hasnt_uri { my ($uri, $model, $name) = @_; confess 'No valid model given in test' unless (blessed($model) && $model->isa('RDF::Trine::Model')); my $test = __PACKAGE__->builder; my $resource; eval { $resource = RDF::Trine::Node::Resource->new($uri); }; if (($resource) && ($model->count_statements(undef, undef, $resource) > 0 || $model->count_statements(undef, $resource, undef) > 0 || $model->count_statements($resource, undef, undef)) > 0) { $test->ok( 0, $name ); $test->diag('Matching URIs found in model'); return 0; } else { $test->ok( 1, $name ); return 1; } } sub _single_uri_tests { my ($count, $name) = @_; my $test = __PACKAGE__->builder; local $Test::Builder::Level = $Test::Builder::Level + 1; if ($count > 0) { $test->ok( 1, $name ); return 1; } else { $test->ok( 0, $name ); $test->diag('No matching URIs found in model'); return 0; } } sub _resource_uri_checked { my ($uri, $name) = @_; my $resource; eval { $resource = RDF::Trine::Node::Resource->new($uri); }; if ( my $error = $@ ) { my $test = __PACKAGE__->builder; local $Test::Builder::Level = $Test::Builder::Level + 1; $test->ok( 0, $name ); $test->diag("No matching URIs found in model"); return 0; } return $resource; } =head2 pattern_target Tests that the object passed as its parameter is an RDF::Trine::Model or RDF::Trine::Store. That is, tests that it is a valid thing to match basic graph patterns against. Additionally, this test establishes the target for future C tests. =head2 pattern_ok Tests that the pattern passed matches against the target established by C. The pattern may be passed as an RDF::Trine::Pattern, or a list of RDF::Trine::Statement objects. use Test::RDF; use RDF::Trine qw[iri literal blank variable statement]; use My::Module; my $foaf = RDF::Trine::Namespace->new('http://xmlns.com/foaf/0.1/'); pattern_target(My::Module->get_model); # check isa RDF::Trine::Model pattern_ok( statement( variable('who'), $foaf->name, literal('Kjetil Kjernsmo') ), statement( variable('who'), $foaf->page, iri('http://search.cpan.org/~kjetilk/') ), "Data contains Kjetil's details." ); B C must have been tested before any C tests. =head2 pattern_fail The same as above, but tests if the pattern returns no results instead. =cut { # scope for $target my $target; sub pattern_target { my $t = shift; my $test = __PACKAGE__->builder; if (blessed($t) && $t->isa('RDF::Trine::Model')) { $target = $t; $test->ok(1, 'Data is an RDF::Trine::Model.'); return 1; } elsif (blessed($t) && $t->isa('RDF::Trine::Store')) { $target = $t; $test->ok(1, 'Data is an RDF::Trine::Store.'); return 1; } else { $test->ok(0, 'Data is not an RDF::Trine::Model or RDF::Trine::Store.'); return 0; } } sub pattern_ok { my $message = undef; $message = pop @_ if !ref $_[-1]; unless (defined $message and length $message) { $message = "Pattern match"; } my $test = __PACKAGE__->builder; unless (blessed($target)) { $test->ok(0, $message); $test->diag("No target defined for pattern match. Call pattern_target test first."); return 0; } my $pattern = (blessed($_[0]) and $_[0]->isa('RDF::Trine::Pattern')) ? $_[0] : RDF::Trine::Pattern->new(@_); my $s = RDF::Trine::Serializer::Turtle->new(); my $iter = $target->get_pattern($pattern); if ($iter->materialize->length > 0) { $test->ok(1, $message); return 1; } # The test result is now known, return diagnostics my $noreturns; foreach my $triple ($pattern->triples) { my @triple; foreach my $node ($triple->nodes) { if ($node->is_variable) { push(@triple, undef); } else { push(@triple, $node); } } next if ($target->count_statements(@triple)); $noreturns .= $triple->as_string . "\n"; } $test->ok(0, $message); if ($noreturns) { $test->diag("Triples that had no results:\n$noreturns"); } else { $test->diag('Pattern as a whole did not match'); } return 0; } sub pattern_fail { my $message = undef; $message = pop @_ if !ref $_[-1]; unless (defined $message and length $message) { $message = "Pattern doesn't match"; } my $test = __PACKAGE__->builder; unless (blessed($target)) { $test->ok(0, $message); $test->diag("No target defined for pattern match. Call pattern_target test first."); return 0; } my $pattern = (blessed($_[0]) and $_[0]->isa('RDF::Trine::Pattern')) ? $_[0] : RDF::Trine::Pattern->new(@_); my $iter = $target->get_pattern($pattern)->materialize; if ($iter->length == 0) { $test->ok(1, $message); return 1; } # The test result is now known, return diagnostics $test->ok(0, $message); $test->diag("These triples had results:\n" . $iter->as_string); return 0; } } # /scope for $target =head1 NOTE Graph isomorphism is a complex problem, so do not attempt to run the isomorphism tests on large datasets. For more information see L. =head1 AUTHOR Kjetil Kjernsmo, C<< >> =head1 BUGS Please report any bugs using L =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Test::RDF You may find the Perl and RDF community L useful. You can also look for information at: =over 4 =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * Search CPAN L =item * MetaCPAN L =back =head1 ACKNOWLEDGEMENTS Michael Hendricks wrote the first Test::RDF. The present module is a complete rewrite from scratch using Gregory Todd William's L to do the heavy lifting. Toby Inkster has submitted the pattern_* functions. =head1 LICENSE AND COPYRIGHT Copyright 2010 ABC Startsiden AS. Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2017 Kjetil Kjernsmo. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Test::RDF