COPYRIGHT000644001750001750 312112657214351 15730 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: URI-NamespaceMap Upstream-Contact: Chris Prather (PERIGRIN) , Gregory Todd Williams , and Kjetil Kjernsmo Source: https://metacpan.org/module/URI::NamespaceMap Files: Changes META.json META.yml doap.ttl lib/Types/Namespace.pm lib/URI/Namespace.pm t/prefixguess.t Copyright: Copyright 2016 Chris Prather, Gregory Todd Williams, and Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: dist.ini t/iri.t t/justuri.t t/namespacemap.t Copyright: Copyright 2014 Chris Prather, Gregory Todd Williams, and Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: COPYRIGHT CREDITS SIGNATURE Copyright: None License: public-domain Files: README lib/URI/NamespaceMap.pm Copyright: Copyright 2012,2013,2014,2015,2016 Gregory Todd Williams, Chris Prather and Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: INSTALL LICENSE Copyright: Unknown License: Unknown Files: t/prefixguess-none.t Copyright: Copyright 2015 Chris Prather, Gregory Todd Williams, and 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) 2016 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) 2016 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 CREDITS000644001750001750 35212657214350 15437 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30Maintainer: - Chris Prather (PERIGRIN) - Gregory Todd Williams - Kjetil Kjernsmo Contributor: - Dorian Taylor - Toby Inkster (TOBYINK) Changes000644001750001750 430712657214350 15736 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30URI-NamespaceMap ================ Created: 2012-08-27 Home page: Bug tracker: Maintainer: Kjetil Kjernsmo Maintainer: Gregory Todd Williams Maintainer: Chris Prather (PERIGRIN) 0.30 2016-02-12 Test bugfix. [ Bug Fixes ] - Remove a test because toolchain makes it hard to get the correct version. 0.28 2015-09-23 Bugfix release. [ Bug Fixes ] - Had forgotten to update error messages. 0.26 2015-09-01 Support for RDF::NS::Curated. - Support for RDF::NS::Curated. 0.24 2014-12-10 Improve documentation. [ Bug Fixes ] - Use a string comparison in failing test. [ Other ] - Improve documentation, autoloader. - Reindent using Emacs smart-tabs. - Some code cleanup. 0.22 2014-10-15 Clean up source tree. - Clean up source tree. 0.21 2014-10-05 Fix missing Changes. [ Bug Fixes ] - Fix missing Changes. 0.20 2014-10-05 Moo refactoring. - Added: Warn the user when they have too old RDF::NS but not in automated tests. - Convert packaging to Dist::Inkt. Toby Inkster++ - Port to Moo. Toby Inkster++ 0.12 2014-09-29 Support IRI module. [ Bug Fixes ] - Silence warnings when URI doesn't have local part. [ Other ] - Added: Link Debian packages in metadata. - Added: Support the new IRI module. Gregory Todd Williams++ - Added: Use Types::URI. - Added: Warn the user in test when they have too old RDF::NS. 0.10 2014-05-21 Compatibility with RDF::Trine::NamespaceMap. - Added: Make it possible to send local part to the uri method of URI::Namespace. Chris Prather++ 0.08 2014-05-19 Prefix guessing. [ Bug Fixes ] - Fix breakage in terms with hyphens. Dorian Taylor++ [ Other ] - Added: Prefix guessing using RDF::NS, RDF::Prefixes or XML::CommonNS. 0.06 2012-11-28 Bugfix release. [ Bug Fixes ] - URI::Namespace must be used from URI::NamespaceMap. 0.04 2012-10-23 Reverse lookups. - Added: Adding reverse lookups, i.e. abbreviation and prefix_for. Dorian Taylor++ - Stop using blank node in makefile.ttl to fix version_from. 0.02 2012-08-30 Minor bugfixes. 0.01 2012-08-28 Initial release. INSTALL000644001750001750 171612657214350 15475 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30 Installing URI-NamespaceMap should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm URI::NamespaceMap 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 URI::NamespaceMap INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan URI::NamespaceMap 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 URI-NamespaceMap: % 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 4406212657214350 15472 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30This software is copyright (c) 2016 by Chris Prather, Gregory Todd Williams, and 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) 2016 by Chris Prather, Gregory Todd Williams, and 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) 2016 by Chris Prather, Gregory Todd Williams, and 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 40312657214351 15546 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE dist.ini doap.ttl lib/Types/Namespace.pm lib/URI/Namespace.pm lib/URI/NamespaceMap.pm t/iri.t t/justuri.t t/namespacemap.t t/prefixguess-none.t t/prefixguess.t META.json000644001750001750 514612657214351 16067 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30{ "abstract" : "Namespace manipulation and prefix mapping for XML, RDF, etc.", "author" : [ "Kjetil Kjernsmo ", "Gregory Todd Williams ", "Chris Prather (PERIGRIN) " ], "dynamic_config" : 0, "generated_by" : "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.150005", "keywords" : [], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "URI-NamespaceMap", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : {}, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "runtime" : { "recommends" : { "RDF::NS" : "20130802", "RDF::NS::Curated" : "0", "RDF::Prefixes" : "0", "XML::CommonNS" : "0" }, "requires" : { "Carp" : "0", "IRI" : "0.004", "Module::Load::Conditional" : "0", "Moo" : "1.006000", "Try::Tiny" : "0", "Type::Library" : "1.000000", "Types::URI" : "0.004", "URI" : "1.52", "namespace::autoclean" : "0.20", "perl" : "5.008001" } }, "test" : { "requires" : { "Test::Exception" : "0", "Test::More" : "0.88" } } }, "provides" : { "Types::Namespace" : { "file" : "lib/Types/Namespace.pm", "version" : "0.30" }, "URI::Namespace" : { "file" : "lib/URI/Namespace.pm", "version" : "0.30" }, "URI::NamespaceMap" : { "file" : "lib/URI/NamespaceMap.pm", "version" : "0.30" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/kjetilk/URI-NamespaceMap/issues" }, "homepage" : "https://metacpan.org/module/URI::NamespaceMap", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "web" : "https://github.com/kjetilk/URI-NamespaceMap/" }, "x_identifier" : "http://purl.org/NET/cpan-uri/dist/URI-NamespaceMap/project" }, "version" : "0.30", "x_contributors" : [ "Dorian Taylor ", "Toby Inkster (TOBYINK) " ], "x_serialization_backend" : "JSON::PP version 2.27202" } META.yml000644001750001750 326712657214351 15721 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30--- abstract: 'Namespace manipulation and prefix mapping for XML, RDF, etc.' author: - 'Kjetil Kjernsmo ' - 'Gregory Todd Williams ' - 'Chris Prather (PERIGRIN) ' build_requires: Test::Exception: '0' Test::More: '0.88' configure_requires: ExtUtils::MakeMaker: '6.17' dynamic_config: 0 generated_by: 'Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.150005' keywords: [] license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: URI-NamespaceMap no_index: directory: - eg - examples - inc - t - xt optional_features: {} provides: Types::Namespace: file: lib/Types/Namespace.pm version: '0.30' URI::Namespace: file: lib/URI/Namespace.pm version: '0.30' URI::NamespaceMap: file: lib/URI/NamespaceMap.pm version: '0.30' recommends: RDF::NS: '20130802' RDF::NS::Curated: '0' RDF::Prefixes: '0' XML::CommonNS: '0' requires: Carp: '0' IRI: '0.004' Module::Load::Conditional: '0' Moo: '1.006000' Try::Tiny: '0' Type::Library: '1.000000' Types::URI: '0.004' URI: '1.52' namespace::autoclean: '0.20' perl: '5.008001' resources: Identifier: http://purl.org/NET/cpan-uri/dist/URI-NamespaceMap/project bugtracker: https://github.com/kjetilk/URI-NamespaceMap/issues homepage: https://metacpan.org/module/URI::NamespaceMap license: http://dev.perl.org/licenses/ repository: https://github.com/kjetilk/URI-NamespaceMap/ version: '0.30' x_contributors: - 'Dorian Taylor ' - 'Toby Inkster (TOBYINK) ' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Makefile.PL000644001750001750 1422112657214351 16432 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "Namespace manipulation and prefix mapping for XML, RDF, etc.", "author" => [ "Kjetil Kjernsmo ", "Gregory Todd Williams ", "Chris Prather (PERIGRIN) ", ], "dynamic_config" => 0, "generated_by" => "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.150005", "keywords" => [], "license" => ["perl_5"], "meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => 2, }, "name" => "URI-NamespaceMap", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "prereqs" => { configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } }, runtime => { recommends => { "RDF::NS" => 20130802, "RDF::NS::Curated" => 0, "RDF::Prefixes" => 0, "XML::CommonNS" => 0, }, requires => { "Carp" => 0, "IRI" => 0.004, "Module::Load::Conditional" => 0, "Moo" => "1.006000", "namespace::autoclean" => "0.20", "perl" => 5.008001, "Try::Tiny" => 0, "Type::Library" => "1.000000", "Types::URI" => 0.004, "URI" => 1.52, }, }, test => { requires => { "Test::Exception" => 0, "Test::More" => 0.88 } }, }, "provides" => { "Types::Namespace" => { file => "lib/Types/Namespace.pm", version => "0.30" }, "URI::Namespace" => { file => "lib/URI/Namespace.pm", version => "0.30" }, "URI::NamespaceMap" => { file => "lib/URI/NamespaceMap.pm", version => "0.30" }, }, "release_status" => "stable", "resources" => { bugtracker => { web => "https://github.com/kjetilk/URI-NamespaceMap/issues" }, homepage => "https://metacpan.org/module/URI::NamespaceMap", license => ["http://dev.perl.org/licenses/"], repository => { type => "git", web => "https://github.com/kjetilk/URI-NamespaceMap/", }, x_identifier => "http://purl.org/NET/cpan-uri/dist/URI-NamespaceMap/project", }, "version" => "0.30", "x_contributors" => [ "Dorian Taylor ", "Toby Inkster (TOBYINK) ", ], }; 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 704612657214350 15326 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30NAME URI::NamespaceMap - Class holding a collection of namespaces VERSION Version 0.30 SYNOPSIS use URI::NamespaceMap; my $map = URI::NamespaceMap->new( { xsd => 'http://www.w3.org/2001/XMLSchema#' } ); $map->namespace_uri('xsd')->as_string; my $foaf = URI::Namespace->new( 'http://xmlns.com/foaf/0.1/' ); $map->add_mapping(foaf => $foaf); $map->add_mapping(rdf => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' ); $map->list_prefixes; # ( 'foaf', 'rdf', 'xsd' ) $map->foaf; # Returns URI::Namespace object DESCRIPTION This module provides an object to manage multiple namespaces for creating URI::Namespace objects and for serializing. METHODS `new ( [ \%namespaces | @prefixes | @uris ] )` Returns a new namespace map object. You can pass a hash reference with mappings from local names to namespace URIs (given as string or RDF::Trine::Node::Resource) or namespaces_map with a hashref. You may also pass an arrayref containing just prefixes and/or namespace URIs, and the module will try to guess the missing part. To use this feature, you need RDF::NS::Curated, RDF::NS, XML::CommonNS or RDF::Prefixes, or preferably all of them. `add_mapping ( $name => $uri )` Adds a new namespace to the map. The namespace URI can be passed as string or a URI::Namespace object. `remove_mapping ( $name )` Removes a namespace from the map given a prefix. `namespace_uri ( $name )` Returns the URI::Namespace object (if any) associated with the given prefix. $name This module creates a method for all the prefixes, so you can say e.g. $map->foaf and get a URI::Namespace object for the FOAF namespace. Since URI::Namespace does the same for local names, you can then say e.g. $map->foaf->name to get a full URI. `list_namespaces` Returns an array of URI::Namespace objects with all the namespaces. `list_prefixes` Returns an array of prefixes. `uri ( $prefixed_name )` Returns a URI for an abbreviated string such as 'foaf:Person'. prefix_for `uri ($uri)` Returns the associated prefix (or potentially multiple prefixes, when called in list context) for the given URI. abbreviate `uri ($uri)` Complement to "namespace_uri". Returns the given URI in `foo:bar` format or `undef` if it wasn't matched, therefore the idiom my $str = $nsmap->abbreviate($uri_node) || $uri->as_string; may be useful for certain serialization tasks. WARNING Avoid using the names 'can', 'isa', 'VERSION', and 'DOES' as namespace prefix, because these names are defined as method for every Perl object by default. The method names 'new' and 'uri' are also forbidden. Names of methods of Moose::Object must also be avoided. AUTHORS Chris Prather, `` Kjetil Kjernsmo, `` Gregory Todd Williams, `` Toby Inkster, `` CONTRIBUTORS Dorian Taylor BUGS Please report any bugs using github SUPPORT You can find documentation for this module with the perldoc command. perldoc URI::NamespaceMap COPYRIGHT & LICENSE Copyright 2012,2013,2014,2015,2016 Gregory Todd Williams, Chris Prather and Kjetil Kjernsmo This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SIGNATURE000644001750001750 472412657214375 15741 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30This 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 22fc664ea9739003f0723b50b9974c3e9426806e COPYRIGHT SHA1 a19c504201f716cc92214e2d0c5a5407ea6b4d82 CREDITS SHA1 19a73110e5080fbf8c9d7212b4b6b6aaa07c119f Changes SHA1 4b8a6a0f8d6104c8caa9e1891bd519465a414024 INSTALL SHA1 28a09f9dce9b7bca1581d64ebd6848129de3b2e0 LICENSE SHA1 4d649c299b509f83c6888b1137898a89de926443 MANIFEST SHA1 5deef5265e33054d364c670eccebce5ce915dfa5 META.json SHA1 7c6bfadef7909aa6f32ec76ec95476e49bfb262d META.yml SHA1 f59e39201549f107c3f264c4e49ccbc1bb215ff2 Makefile.PL SHA1 147cc2e958fc50632d17813f269dcfbaa5886594 README SHA1 b8fcd666818a749533048c9306750cd79d55c5fa dist.ini SHA1 72652afe1d877199be28599d92dd4549ba782ea1 doap.ttl SHA1 57ab1cadce9c7b3ef339e7c8593b9dc73d1de272 lib/Types/Namespace.pm SHA1 4b80793717170fc65f9f72b927fae01a0d296e8c lib/URI/Namespace.pm SHA1 fa14ae4afba14edbe68d1cead1debe481303825c lib/URI/NamespaceMap.pm SHA1 d9543d38cdc9a5cc7f701ac671532f9311a2da8c t/iri.t SHA1 71d3969896e88359c6f28c83140f40007c47d82e t/justuri.t SHA1 6e701b80bdebf208f96e364092d2796ac3bd04ae t/namespacemap.t SHA1 220f29770edc5bdc3be99083700136a43c1e7f83 t/prefixguess-none.t SHA1 595c70d2de6db5e9b5e0fba720fe53b067e80550 t/prefixguess.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUBVr0Y6X++6N86nkqlAQiHjBAAgv/iJSFDAAmO0mzSZm1Y20x4P5FxbFei vkg4bYFgosQrR8f1+wwOryQNkZK0P33cELde9oACVpj1GFBAX9cVSDQMvz9IaSnh NfHYjFZ4ufaHVDY2uLmsf+HuraowiHJWUMiUJxzt1RBBHvmaugJptd69+Cnvmytw iKmGidgNvBF1AW/0pP7crD8osNQxXO4+StLJXdWmccQ76kmcg0BjS0t0uMLoB5XG NL5pG5Dg4Zy6FHOtCO1QYpy5e2KEtxPirQ6Q6HMAGYodq+RM3kyP+YtCglGsTqKG wLfp5yI8dW60QkmUIBd1oCeFcYdrS6XSzEuBy14J8mz+nkef5cFge6jiekt61AZ2 GTY0CEbGfEJYD4wwIFJBmqUiyfuQqyfemlJleXrhq3QkR5seznXaHK36w4c0Ax4+ syHWA28hdFZL3tlFi2VgPUcLQTUMJYkjMgJhREgfQ/SjrLkAqs6upJha2SHV0kWq la7HTVPeVQ+uAycTQNder+Wr8X8YZm/eJ6afUEpE52Li08Wzcp8Y0tkooadQVpQj RJwsWLplV86JDGXEKBDirZIuyM4e9w4KykESpEpYwd7QH5kPVs3Ex5P+lUvDr873 62Jd7/ppqhCCOtEba9rFx4f3upEnYyt5eXhv4wM9G30R+vIyTUJmQO3MFoXIwqfu FB3lyafwpsM= =mL9r -----END PGP SIGNATURE----- dist.ini000644001750001750 17012657214350 16061 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30;;class='Dist::Inkt::Profile::TOBYINK' ;;name='URI-NamespaceMap' ;;skip_whitespace_test=1 ;;also_skip = [qr/README.pod/]doap.ttl000644001750001750 3112012657214351 16125 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30@prefix dc: . @prefix doap: . @prefix doap-changeset: . @prefix doap-deps: . @prefix foaf: . @prefix owl: . @prefix prov: . @prefix rdfs: . @prefix xsd: . dc:creator ; dc:subject ; dc:title "DOAP for URI-NamespaceMap"@en. a foaf:Person; foaf:mbox ; foaf:name "Dorian Taylor"; owl:sameAs , . a foaf:Person; foaf:mbox ; foaf:name "Gregory Todd Williams"; owl:sameAs , . a doap:Project; dc:identifier "URI::NamespaceMap"^^doap-deps:CpanId; dc:relation ; doap-deps:runtime-recommendation [ doap-deps:on "RDF::NS::Curated"^^doap-deps:CpanId ], [ doap-deps:on "RDF::NS 20130802"^^doap-deps:CpanId ], [ doap-deps:on "RDF::Prefixes"^^doap-deps:CpanId ], [ doap-deps:on "XML::CommonNS"^^doap-deps:CpanId ]; doap-deps:runtime-requirement [ doap-deps:on "Module::Load::Conditional"^^doap-deps:CpanId; ], [ doap-deps:on "Carp"^^doap-deps:CpanId ], [ doap-deps:on "namespace::autoclean 0.20"^^doap-deps:CpanId; ], [ doap-deps:on "perl 5.008001"^^doap-deps:CpanId ], [ doap-deps:on "Moo 1.006000"^^doap-deps:CpanId ], [ doap-deps:on "URI 1.52"^^doap-deps:CpanId ], [ doap-deps:on "IRI 0.004"^^doap-deps:CpanId ], [ doap-deps:on "Types::URI 0.004"^^doap-deps:CpanId ], [ doap-deps:on "Type::Library 1.000000"^^doap-deps:CpanId; ], [ doap-deps:on "Try::Tiny"^^doap-deps:CpanId ]; doap-deps:test-requirement [ doap-deps:on "Test::More 0.88"^^doap-deps:CpanId ], [ doap-deps:on "Test::Exception"^^doap-deps:CpanId ]; doap:bug-database ; doap:created "2012-08-27"^^xsd:date; doap:developer , ; doap:homepage ; doap:license ; doap:maintainer , , ; doap:name "URI-NamespaceMap"; doap:programming-language "Perl"; doap:release , , , , , , , , , , , , , ; doap:repository [ a doap:GitRepository; doap:browse ; prov:has_provenance ; ]; doap:shortdesc "Namespace manipulation and prefix mapping for XML, RDF, etc."@en; owl:sameAs ; rdfs:seeAlso . a doap:Version; rdfs:label "Initial release."@en; dc:issued "2012-08-28"^^xsd:date; doap:revision "0.01"^^xsd:string. a doap:Version; rdfs:label "Minor bugfixes."@en; dc:issued "2012-08-30"^^xsd:date; doap:revision "0.02"^^xsd:string. a doap:Version; rdfs:label "Reverse lookups."@en; dc:issued "2012-10-23"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Stop using blank node in makefile.ttl to fix version_from."@en; ], [ a doap-changeset:Addition; rdfs:label "Adding reverse lookups, i.e. abbreviation and prefix_for."@en; doap-changeset:blame ; ]; ]; doap:revision "0.04"^^xsd:string. a doap:Version; rdfs:label "Bugfix release."@en; dc:issued "2012-11-28"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "URI::Namespace must be used from URI::NamespaceMap."@en; ]; ]; doap:revision "0.06"^^xsd:string. a doap:Version; rdfs:label "Prefix guessing."@en; dc:issued "2014-05-19"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Prefix guessing using RDF::NS, RDF::Prefixes or XML::CommonNS."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Fix breakage in terms with hyphens."@en; doap-changeset:blame ; ]; ]; doap:revision "0.08"^^xsd:string. a doap:Version; rdfs:label "Compatibility with RDF::Trine::NamespaceMap."@en; dc:issued "2014-05-21"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Make it possible to send local part to the uri method of URI::Namespace."@en; doap-changeset:thanks ; ]; ]; doap:revision "0.10"^^xsd:string. a doap:Version; rdfs:label "Support IRI module."@en; dc:issued "2014-09-29"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Support the new IRI module."@en; doap-changeset:blame ; ], [ a doap-changeset:Bugfix; rdfs:label "Silence warnings when URI doesn't have local part."@en; ], [ a doap-changeset:Addition; rdfs:label "Warn the user in test when they have too old RDF::NS."@en; ], [ a doap-changeset:Addition; rdfs:label "Use Types::URI."@en; ], [ a doap-changeset:Addition; rdfs:label "Link Debian packages in metadata."@en; ]; ]; doap:revision "0.12"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Moo refactoring."@en; dc:issued "2014-10-05"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Port to Moo."@en; doap-changeset:blame ; ], [ a doap-changeset:Change; rdfs:label "Convert packaging to Dist::Inkt."@en; doap-changeset:blame ; ], [ a doap-changeset:Addition; rdfs:label "Warn the user when they have too old RDF::NS but not in automated tests."@en; ]; ]; doap:revision "0.20"^^xsd:string. a doap:Version; rdfs:label "Fix missing Changes."@en; dc:issued "2014-10-05"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix missing Changes."@en; ]; ]; doap:revision "0.21"^^xsd:string. a doap:Version; rdfs:label "Clean up source tree."@en; dc:issued "2014-10-15"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Clean up source tree."@en; ]; ]; doap:revision "0.22"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Improve documentation."@en; dc:issued "2014-12-10"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Reindent using Emacs smart-tabs."@en; ], [ a doap-changeset:Change; rdfs:label "Improve documentation, autoloader."@en; ], [ a doap-changeset:Change; rdfs:label "Some code cleanup."@en; ], [ a doap-changeset:Bugfix; rdfs:label "Use a string comparison in failing test."@en; ]; ]; doap:revision "0.24"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Support for RDF::NS::Curated."@en; dc:issued "2015-09-01"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Support for RDF::NS::Curated."@en; ]; ]; doap:revision "0.26"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Bugfix release."@en; dc:issued "2015-09-23"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Had forgotten to update error messages."@en; ]; ]; doap:revision "0.28"^^xsd:string; owl:sameAs . a doap:Version; rdfs:label "Test bugfix."@en; dc:issued "2016-02-12"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Remove a test because toolchain makes it hard to get the correct version."@en; ]; ]; doap:revision "0.30"^^xsd:string; owl:sameAs . a foaf:Person; foaf:mbox ; foaf:name "Chris Prather"; owl:sameAs . a foaf:Person; foaf:mbox ; foaf:name "Toby Inkster"; owl:sameAs , . a foaf:Person; foaf:mbox ; foaf:name "Kjetil Kjernsmo"; owl:sameAs , . iri.t000644001750001750 200712657214350 15651 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30/tuse Test::More; use strict; use URI; use utf8; use_ok('URI::Namespace'); use_ok('URI::NamespaceMap'); my $ns = URI::Namespace->new( 'http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/kanji.ttl#' ); isa_ok( $ns, 'URI::Namespace' ); my $uri = $ns->as_string; is( $uri, 'http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/kanji.ttl#', 'expected IRI string for namespace' ); my $iri = $ns->iri("納豆"); is($iri->as_string, "http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/kanji.ttl#納豆", 'expected IRI string'); my $uri = $ns->uri("納豆"); is($uri->as_string, "http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/kanji.ttl#%E7%B4%8D%E8%B1%86", 'expected URI encoding of IRI string'); my $map = URI::NamespaceMap->new(); $map->add_mapping( "食" => $ns ); is_deeply([$map->list_prefixes], ["食"], 'expected unicode namespace prefix in map'); is($map->namespace_uri('食')->as_string, 'http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/kanji.ttl#', 'expected namespacemap prefix URI string'); done_testing; justuri.t000644001750001750 132712657214350 16577 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30/tuse Test::More; use strict; use URI; use_ok('URI::Namespace'); my $foaf = URI::Namespace->new( 'http://xmlns.com/foaf/0.1/' ); isa_ok( $foaf, 'URI::Namespace' ); my $uri = $foaf->as_string; is( $uri, 'http://xmlns.com/foaf/0.1/', 'expected resource object for namespace from namespace map' ); is($foaf->name->as_string, 'http://xmlns.com/foaf/0.1/name', 'expected resource object for namespace with name' ); is($foaf->uri('Person')->as_string, 'http://xmlns.com/foaf/0.1/Person', 'expected resource object for namespace with Person when set with uri method' ); is($foaf->uri('isa')->as_string, 'http://xmlns.com/foaf/0.1/isa', 'expected resource object for namespace with isa when set with uri method' ); done_testing; namespacemap.t000644001750001750 765312657214350 17534 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30/tuse Test::More; use Test::Exception; use strict; use URI; use_ok('URI::NamespaceMap'); use_ok('URI::Namespace'); my $foaf = URI::Namespace->new( 'http://xmlns.com/foaf/0.1/' ); isa_ok($foaf, 'URI::Namespace'); is($foaf->as_string, 'http://xmlns.com/foaf/0.1/', 'FOAF URI string OK'); my $rdf = URI::Namespace->new( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' ); { my $map = URI::NamespaceMap->new; isa_ok( $map, 'URI::NamespaceMap' ); } { my $map = URI::NamespaceMap->new( { foaf => $foaf, rdf => $rdf } ); isa_ok( $map, 'URI::NamespaceMap' ); } { my $map = URI::NamespaceMap->new( { xsd => 'http://www.w3.org/2001/XMLSchema#' } ); isa_ok( $map, 'URI::NamespaceMap' ); } { my $map = URI::NamespaceMap->new( namespace_map => { xsd => 'http://www.w3.org/2001/XMLSchema#' } ); isa_ok( $map, 'URI::NamespaceMap' ); } { my $map = URI::NamespaceMap->new( namespace_map => { foaf => $foaf, rdf => $rdf } ); isa_ok( $map, 'URI::NamespaceMap' ); } TODO: { local $TODO = 'Need to throw a sensible error message if a method is used as local part'; throws_ok { my $map = URI::NamespaceMap->new( { isa => 'http://example.org/ns/isa#' } ); } qr/prohibited as local part/, "Throws if isa is used as local part."; } my $map = URI::NamespaceMap->new( { foaf => $foaf, rdf => $rdf, xsd => 'http://www.w3.org/2001/XMLSchema#' } ); isa_ok( $map, 'URI::NamespaceMap' ); is_deeply([sort $map->list_prefixes], ['foaf', 'rdf', 'xsd' ], 'Prefix listing OK'); is($map->namespace_uri('foaf')->as_string, 'http://xmlns.com/foaf/0.1/', 'FOAF URI string OK'); is($map->namespace_uri('xsd')->as_string, 'http://www.w3.org/2001/XMLSchema#', 'XSD URI string OK'); TODO: { local $TODO = 'need to stringify?'; is_deeply([$map->list_namespaces], [map { URI::Namespace->new($_) } 'http://xmlns.com/foaf/0.1/','http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'http://www.w3.org/2001/XMLSchema#' ]); } my $ns = $map->xsd; isa_ok( $ns, 'URI::Namespace' ); $map->remove_mapping( 'xsd' ); is( $map->xsd, undef, 'removed namespace' ); isa_ok($ns->uri, 'URI'); isa_ok($ns->iri, 'IRI'); # ensure that methods delegated to URI are working... is($ns->rel('http://www.w3.org/2001/'), 'XMLSchema#', 'namespace delegates rel method'); is($ns->abs('http://example.org/'), 'http://www.w3.org/2001/XMLSchema#', 'namespace delegates abs method'); ok($ns->eq(URI->new('http://www.w3.org/2001/XMLSchema#')), 'namespace delegates eq method'); is($map->foaf->canonical, 'http://xmlns.com/foaf/0.1/', 'namespace delegates canonical method'); $map = URI::NamespaceMap->new( { foaf => 'http://xmlns.com/foaf/0.1/', '' => 'http://example.org/' } ); isa_ok( $map, 'URI::NamespaceMap' ); is ( $map->uri(':foo')->as_string, 'http://example.org/foo', 'empty prefix' ); $map->add_mapping( rdf => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' ); my $type = $map->rdf('type'); isa_ok( $type, 'URI' ); is( $type->as_string, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'expected uri for namespace map qname' ); $ns = $map->foaf; isa_ok( $ns, 'URI::Namespace' ); my $uri = $ns->as_string; is( $uri, 'http://xmlns.com/foaf/0.1/', 'expected resource object for namespace from namespace map' ); $type = $map->uri('rdf:type'); isa_ok( $type, 'URI' ); is( $type->as_string, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'resolving via uri method' ); $uri = $map->uri('foaf:'); isa_ok( $uri, 'URI' ); is( $uri->as_string, 'http://xmlns.com/foaf/0.1/', 'resolving via uri method' ); # abbreviate implicitly checks prefix_for is($map->abbreviate($map->foaf('Person')), 'foaf:Person', 'abbrev with prefix'); is($map->abbreviate($map->uri(':foo')), ':foo', 'abbrev no prefix '); is($map->abbreviate('http://derp.net/foobar'), undef, 'abbrev no match'); TODO: { local $TODO = 'Need to throw a sensible error message if a method is used as local part'; throws_ok { $map->add_mapping( isa => 'http://example.org/ns/isa#' ); } qr/prohibited as local part/, "Throws if isa is used as local part."; } done_testing; prefixguess-none.t000644001750001750 136412657214350 20374 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30/tuse Test::More; use Test::Exception; use strict; use Module::Load::Conditional qw[check_install]; my $xmlns = check_install( module => 'XML::CommonNS'); my $rdfns = check_install( module => 'RDF::NS', version => 20130802); my $rnscu = check_install( module => 'RDF::NS::Curated'); my $rdfpr = check_install( module => 'RDF::Prefixes'); if (defined $xmlns || defined $rdfns || defined $rnscu || defined $rdfpr) { plan skip_all => 'One of the namespace modules is installed' } use_ok('URI::NamespaceMap'); throws_ok { my $map = URI::NamespaceMap->new( [ 'foaf', 'rdf' ] ); } qr/To resolve an array, you need at least one of RDF::NS::Curated, XML::CommonNS, RDF::NS or RDF::Prefixes/, 'Throws OK if no prefix module is installed.'; done_testing; prefixguess.t000644001750001750 731212657214350 17436 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30/tuse Test::More; use strict; use Module::Load::Conditional qw[check_install]; my $xmlns = check_install( module => 'XML::CommonNS'); my $rdfns = check_install( module => 'RDF::NS', version => 20130802); my $rnscu = check_install( module => 'RDF::NS::Curated'); my $rdfpr = check_install( module => 'RDF::Prefixes'); unless (defined $xmlns || defined $rdfns || defined $rnscu || defined $rdfpr) { plan skip_all => 'None of the namespace modules XML::CommonNS, RDF::NS::Curated, RDF::NS or RDF::Prefixes are installed' } my $diag = "Status for optional modules: "; $diag .= (defined $rnscu) ? " With " : " Without "; $diag .= "RDF::NS::Curated,"; $diag .= (defined $xmlns) ? " with " : " without "; $diag .= "XML::CommonNS,"; $diag .= (defined $rdfns) ? " with " : " without "; $diag .= "RDF::NS,"; $diag .= (defined $rdfpr) ? " with " : " without "; $diag .= "RDF::Prefixes."; note($diag); use_ok('URI::NamespaceMap') ; SKIP: { skip "XML::CommonNS, RDF::NS::Curated or RDF::NS needed", 5 unless(defined $xmlns || defined $rdfns || defined $rnscu); my $map = URI::NamespaceMap->new( [ 'foaf', 'rdf' ] ); isa_ok( $map, 'URI::NamespaceMap' ); ok($map->namespace_uri('foaf'), 'FOAF returns something'); ok($map->namespace_uri('rdf'), 'RDF returns something'); is($map->namespace_uri('foaf')->as_string, 'http://xmlns.com/foaf/0.1/', 'FOAF URI string OK'); is($map->namespace_uri('rdf')->as_string, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'RDF URI string OK'); } SKIP: { skip "RDF::NS or RDF::NS::Curated needed", 5 unless (defined $rdfns || defined $rnscu); my $map = URI::NamespaceMap->new( [ 'foaf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'xsd' ] ); isa_ok( $map, 'URI::NamespaceMap' ); is($map->namespace_uri('foaf')->as_string, 'http://xmlns.com/foaf/0.1/', 'FOAF URI string OK'); is($map->namespace_uri('rdf')->as_string, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'RDF URI string OK'); is_deeply([sort $map->list_prefixes], ['foaf', 'rdf', 'xsd' ], 'Prefix listing OK'); } SKIP: { skip "RDF::NS or RDF::NS::Curated needed", 5 unless(defined $rdfns || defined $rnscu); my $map = URI::NamespaceMap->new( [ 'foaf', 'skos' ] ); isa_ok( $map, 'URI::NamespaceMap' ); ok($map->namespace_uri('foaf'), 'FOAF returns something'); is($map->namespace_uri('foaf')->as_string, 'http://xmlns.com/foaf/0.1/', 'FOAF URI string OK'); } SKIP: { skip "RDF::NS needed", 2 unless(defined $rdfns); my $map = URI::NamespaceMap->new( [ 'osadm' ] ); isa_ok( $map, 'URI::NamespaceMap' ); ok($map->namespace_uri('osadm'), 'OSADM returns something'); } SKIP: { skip "RDF::Prefixes and RDF::NS or RDF::NS::Curated needed", 5 unless((defined $rdfns || defined $rnscu) && defined $rdfpr); my $map = URI::NamespaceMap->new( [ 'http://example.org/ns/sdfhkd4f#', 'http://www.w3.org/2004/02/skos/core#' ] ); isa_ok( $map, 'URI::NamespaceMap' ); ok($map->namespace_uri('sdfhkd4f'), 'Keyboard cat returns something'); ok($map->namespace_uri('skos'), 'SKOS returns something'); is($map->namespace_uri('sdfhkd4f')->as_string, 'http://example.org/ns/sdfhkd4f#', 'Keyboard cat URI string OK'); is($map->namespace_uri('skos')->as_string, 'http://www.w3.org/2004/02/skos/core#', 'SKOS URI string OK'); } SKIP: { skip "RDF::Prefixes", 5 unless(defined $rdfpr); my $map = URI::NamespaceMap->new( [ 'http://www.w3.org/2000/01/rdf-schema#', 'http://usefulinc.com/ns/doap#' ] ); isa_ok( $map, 'URI::NamespaceMap' ); ok($map->namespace_uri('rdfs'), 'RDFS returns something'); ok($map->namespace_uri('doap'), 'DOAP returns something'); is($map->namespace_uri('rdfs')->as_string, 'http://www.w3.org/2000/01/rdf-schema#', 'RDFS URI string OK'); is($map->namespace_uri('doap')->as_string, 'http://usefulinc.com/ns/doap#', 'DOAP URI string OK'); } done_testing; Namespace.pm000644001750001750 401612657214350 20544 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30/lib/Typespackage Types::Namespace; use strict; use warnings; use Type::Library -base, -declare => qw( Uri Iri Namespace NamespaceMap ); use Types::Standard qw( HashRef InstanceOf ); use Types::URI qw(); our $VERSION = '0.30'; =head1 NAME Types::Namespace - type constraints for dealing with namespaces =head1 SYNOPSIS package Namespace::Counter { use Moo; # or Moose use Types::Namespace qw( Namespace ); has ns => ( is => "ro", isa => Namespace, required => 1, ); sub count_uses_in_document { ... } } =head1 DESCRIPTION L is a type constraint library suitable for use with L/L attributes, L sub signatures, and so forth. =head1 TYPES =over =item C<< Namespace >> A class type for L. Can coerce from L, L, L, and strings. =item C<< NamespaceMap >> A class type for L. Can coerce from a hashref of C<< prefix => URI >> pairs. =item C<< Uri >>, C<< Iri >> These namespaces are re-exported from L, but with an additional coercion from the C<< Namespace >> type. =back =head1 FURTHER DETAILS See L for further details about authors, license, etc. =cut __PACKAGE__->add_type( name => Uri, parent => Types::URI::Uri, coercion => [ @{ Types::URI::Uri->coercion->type_coercion_map }, InstanceOf['URI::Namespace'] ,=> q{ $_->uri() }, ], ); __PACKAGE__->add_type( name => Iri, parent => Types::URI::Iri, coercion => [ @{ Types::URI::Iri->coercion->type_coercion_map }, InstanceOf['URI::Namespace'] ,=> q{ $_->iri() }, ], ); __PACKAGE__->add_type( name => Namespace, parent => InstanceOf['URI::Namespace'], coercion => [ Iri->coercibles ,=> q{ "URI::Namespace"->new($_) }, ], ); __PACKAGE__->add_type( name => NamespaceMap, parent => InstanceOf['URI::NamespaceMap'], coercion => [ HashRef ,=> q{ "URI::NamespaceMap"->new(namespace_map => $_) } ], ); require URI::Namespace; require URI::NamespaceMap; 1; Namespace.pm000644001750001750 517512657214350 20106 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30/lib/URIpackage URI::Namespace; use strict; use warnings; use Moo 1.006000; use URI; use IRI 0.003; use Types::Namespace 0.004 qw( Iri ); use namespace::autoclean; our $VERSION = '0.30'; =head1 NAME URI::Namespace - A namespace URI/IRI class with autoload methods =head1 SYNOPSIS use URI::Namespace; my $foaf = URI::Namespace->new( 'http://xmlns.com/foaf/0.1/' ); print $foaf->as_string; print $foaf->name; =head1 DESCRIPTION This module provides an object with a URI/IRI attribute, typically used prefix-namespace pairs, typically used in XML, RDF serializations, etc. The local part can be used as a method, these are autoloaded. =head1 METHODS =over =item C<< new ( $string | URI | IRI ) >> This is the constructor. You may pass a string with a URI or a URI object. =item C<< uri ( [ $local_part ] ) >> Returns a L object with the namespace IRI. Optionally, the method can take a local part as argument, in which case, it will return the namespace URI with the local part appended. =item C<< iri ( [ $local_part ] ) >> Returns a L object with the namespace IRI. Optionally, the method can take a local part as argument, in which case, it will return the namespace IRI with the local part appended. =back The following methods from L can be used on an URI::Namespace object: C, C, C, C, C, C. One important usage for this module is to enable you to create Ls for full URIs, e.g.: print $foaf->Person->as_string; will return http://xmlns.com/foaf/0.1/Person =head1 FURTHER DETAILS See L for further details about authors, license, etc. =cut around BUILDARGS => sub { my ($next, $self, @parameters) = @_; return $self->$next(@_) if ((@parameters > 1) || (ref($parameters[0]) eq 'HASH')); return { _uri => $parameters[0] }; }; has _uri => ( is => "ro", isa => Iri, coerce => 1, required => 1, handles => { 'as_string' => 'as_string', 'as_iri' => 'as_string', } ); sub iri { my ($self, $name) = @_; if (defined($name)) { return IRI->new($self->_uri->as_string . "$name"); } else { return $self->_uri; } } sub uri { my ($self, $name) = @_; my $iri = $self->_uri->as_string; if (defined($name)) { return URI->new($iri . "$name"); } else { return URI->new($iri); } } for my $method (qw/ abs rel eq canonical /) { eval qq[ sub $method { shift->uri->${method}(\@_) } ]; } our $AUTOLOAD; sub AUTOLOAD { my $self = shift; my ($name) = $AUTOLOAD =~ /::(\w+)$/; return $self->uri($name); } 1; __END__ NamespaceMap.pm000644001750001750 2155012657214350 20557 0ustar00kjetilkjetil000000000000URI-NamespaceMap-0.30/lib/URIpackage URI::NamespaceMap; use strict; use warnings; use Moo 1.006000; use Module::Load::Conditional qw[can_load]; use URI::Namespace; use Carp; use Scalar::Util qw( blessed ); use Sub::Quote qw( quote_sub ); use Try::Tiny; use Types::Standard qw(HashRef); use Types::Namespace 0.004 qw(Namespace); use namespace::autoclean; =head1 NAME URI::NamespaceMap - Class holding a collection of namespaces =head1 VERSION Version 0.30 =cut our $VERSION = '0.30'; =head1 SYNOPSIS use URI::NamespaceMap; my $map = URI::NamespaceMap->new( { xsd => 'http://www.w3.org/2001/XMLSchema#' } ); $map->namespace_uri('xsd')->as_string; my $foaf = URI::Namespace->new( 'http://xmlns.com/foaf/0.1/' ); $map->add_mapping(foaf => $foaf); $map->add_mapping(rdf => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' ); $map->list_prefixes; # ( 'foaf', 'rdf', 'xsd' ) $map->foaf; # Returns URI::Namespace object =head1 DESCRIPTION This module provides an object to manage multiple namespaces for creating L objects and for serializing. =head1 METHODS =over =item C<< new ( [ \%namespaces | @prefixes | @uris ] ) >> Returns a new namespace map object. You can pass a hash reference with mappings from local names to namespace URIs (given as string or L) or namespaces_map with a hashref. You may also pass an arrayref containing just prefixes and/or namespace URIs, and the module will try to guess the missing part. To use this feature, you need L, L, L or L, or preferably all of them. =item C<< add_mapping ( $name => $uri ) >> Adds a new namespace to the map. The namespace URI can be passed as string or a L object. =item C<< remove_mapping ( $name ) >> Removes a namespace from the map given a prefix. =item C<< namespace_uri ( $name ) >> Returns the L object (if any) associated with the given prefix. =item C<< $name >> This module creates a method for all the prefixes, so you can say e.g. $map->foaf and get a L object for the FOAF namespace. Since L does the same for local names, you can then say e.g. $map->foaf->name to get a full L. =item C<< list_namespaces >> Returns an array of L objects with all the namespaces. =item C<< list_prefixes >> Returns an array of prefixes. =cut around BUILDARGS => sub { my ($next, $self, @parameters) = @_; if (ref($parameters[0]) eq 'ARRAY') { return { namespace_map => $self->_guess(@{$parameters[0]}) }; } return $self->$next(@parameters) if (@parameters > 1); return $self->$next(@parameters) if (exists $parameters[0]->{namespace_map}); return { namespace_map => $parameters[0] }; }; has namespace_map => ( is => "ro", isa => HashRef[Namespace], coerce => 1, default => quote_sub q { {} }, ); sub add_mapping { $_[0]->namespace_map->{$_[1]} = Namespace->assert_coerce($_[2]) } sub remove_mapping { delete $_[0]->namespace_map->{$_[1]} } sub namespace_uri { $_[0]->namespace_map->{$_[1]} } sub list_namespaces { values %{ $_[0]->namespace_map } } sub list_prefixes { keys %{ $_[0]->namespace_map } } =item C<< uri ( $prefixed_name ) >> Returns a URI for an abbreviated string such as 'foaf:Person'. =cut sub uri { my $self = shift; my $abbr = shift; my $ns; my $local = ""; if ($abbr =~ m/^([^:]*):(.*)$/) { $ns = $self->namespace_uri( $1 ); $local = $2; } else { $ns = $self->{ $abbr }; } return unless (blessed($ns)); if ($local ne '') { return $ns->uri($local); } else { return URI->new($ns->as_string); } } =item prefix_for C<< uri ($uri) >> Returns the associated prefix (or potentially multiple prefixes, when called in list context) for the given URI. =cut # turn the URI back into a string to mitigate unexpected behaviour sub _scrub_uri { my $uri = shift; if (ref $uri) { if (blessed $uri) { if ($uri->isa('URI::Namespace')) { $uri = $uri->as_string; } elsif ($uri->isa('URI')) { # it's probably not necessary to do this, but whatever $uri = $uri->as_string; } elsif ($uri->isa('RDF::Trine::Node')) { # it is, on the other hand, necessary to do this. $uri = $uri->uri_value; } elsif ($uri->isa('RDF::Trine::Namespace')) { # and this $uri = $uri->uri->uri_value; } else { # let's hope whatever was passed in has a string overload $uri = "$uri"; } } else { Carp::croak(sprintf "You probably didn't mean to pass this " . "an unblessed %s reference", ref $uri); } } return $uri; } sub prefix_for { my ($self, $uri) = @_; $uri = _scrub_uri($uri); my @candidates; for my $k ($self->list_prefixes) { my $v = $self->namespace_uri($k); my $nsuri = $v->as_string; # the input should always be longer than the namespace next if length $nsuri > length $uri; # candidate namespace must match exactly my $cns = substr($uri, 0, length $nsuri); push @candidates, $k if $cns eq $nsuri; } # make sure this behaves correctly when empty return unless @candidates; # if this returns more than one prefix, take the # shortest/lexically lowest one. @candidates = sort @candidates; return wantarray ? @candidates : $candidates[0]; } =item abbreviate C<< uri ($uri) >> Complement to L. Returns the given URI in C format or C if it wasn't matched, therefore the idiom my $str = $nsmap->abbreviate($uri_node) || $uri->as_string; may be useful for certain serialization tasks. =cut sub abbreviate { my ($self, $uri) = @_; $uri = _scrub_uri($uri); my $prefix = $self->prefix_for($uri); # XXX is this actually the most desirable behaviour? return unless defined $prefix; my $nsuri = _scrub_uri($self->namespace_uri($prefix)); return sprintf('%s:%s', $prefix, substr($uri, length $nsuri)); } our $AUTOLOAD; sub AUTOLOAD { my ($self, $arg) = @_; my ($name) = ($AUTOLOAD =~ /::(\w+)$/); my $ns = $self->namespace_uri($name); return unless $ns; return $ns->$arg if $arg; return $ns; } sub _guess { my ($self, @data) = @_; my $rnscu = can_load( modules => { 'RDF::NS::Curated' => 0 } ); my $xmlns = can_load( modules => { 'XML::CommonNS' => 0 } ); my $rdfns = can_load( modules => { 'RDF::NS' => 20130802 } ); my $rdfpr = can_load( modules => { 'RDF::Prefixes' => 0 } ); confess 'To resolve an array, you need at least one of RDF::NS::Curated, XML::CommonNS, RDF::NS or RDF::Prefixes' unless ($rnscu || $xmlns || $rdfns || $rdfpr); my %namespaces; foreach my $entry (@data) { if ($entry =~ m/^[a-z]\w+$/i) { # This is a prefix warn "Cannot resolve '$entry' without RDF::NS::Curated, XML::CommonNS, RDF::NS" unless ($rnscu || $xmlns || $rdfns); if ($rnscu) { my $ns = RDF::NS::Curated->new; $namespaces{$entry} = $ns->uri($entry); } if ((! $namespaces{$entry}) && $xmlns) { require XML::CommonNS; XML::CommonNS->import(':all'); try { $namespaces{$entry} = XML::CommonNS->uri(uc($entry))->toString; }; # Then, XML::CommonNS doesn't have the prefix, which is OK, we just continue } if ((! $namespaces{$entry}) && $rdfns) { my $ns = RDF::NS->new; $namespaces{$entry} = $ns->SELECT($entry); } warn "Cannot resolve '$entry'" unless $namespaces{$entry}; } else { # Lets assume a URI string warn "Cannot resolve '$entry' without RDF::NS::Curated, RDF::NS or RDF::Prefixes" unless ($rnscu || $rdfns || $rdfpr); my $prefix; if ($rnscu) { my $ns = RDF::NS::Curated->new; $prefix = $ns->prefix($entry); } if ((! $prefix) && ($rdfns)) { my $ns = RDF::NS->new; $prefix = $ns->PREFIX($entry); } if ((! $prefix) && ($rdfpr)) { my $context = RDF::Prefixes->new; $prefix = $context->get_prefix($entry); } unless ($prefix) { warn "Cannot resolve '$entry'"; } else { $namespaces{$prefix} = $entry; } } } return \%namespaces; } =back =head1 WARNING Avoid using the names 'can', 'isa', 'VERSION', and 'DOES' as namespace prefix, because these names are defined as method for every Perl object by default. The method names 'new' and 'uri' are also forbidden. Names of methods of L must also be avoided. =head1 AUTHORS Chris Prather, C<< >> Kjetil Kjernsmo, C<< >> Gregory Todd Williams, C<< >> Toby Inkster, C<< >> =head1 CONTRIBUTORS Dorian Taylor =head1 BUGS Please report any bugs using L =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc URI::NamespaceMap =head1 COPYRIGHT & LICENSE Copyright 2012,2013,2014,2015,2016 Gregory Todd Williams, Chris Prather and Kjetil Kjernsmo This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; __END__