COPYRIGHT000644001750001750 302213130007510 15712 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04Format: 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 lib/URI/NamespaceMap/ReservedLocalParts.pm t/justuri.t t/namespacemap.t t/prefixguess-none.t t/prefixguess.t t/reserved.t Copyright: Copyright 2017 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,2017 Gregory Todd Williams, Chris Prather and Kjetil Kjernsmo. License: GPL-1.0+ or Artistic-1.0 Files: INSTALL LICENSE Copyright: Unknown License: Unknown Files: dist.ini t/iri.t Copyright: Copyright 2014 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) 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 42513130007507 15431 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04Maintainer: - Chris Prather (PERIGRIN) - Gregory Todd Williams - Kjetil Kjernsmo Contributor: - Dorian Taylor - Paul Williams (KWAKWA) - Toby Inkster (TOBYINK) Changes000644001750001750 610213130007507 15722 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04URI-NamespaceMap ================ Created: 2012-08-27 Home page: Bug tracker: Maintainer: Kjetil Kjernsmo Maintainer: Gregory Todd Williams Maintainer: Chris Prather (PERIGRIN) 1.04 2017-07-08 Append a hash to only to XSD URIs. [ Bug Fixes ] - Partly revert fix in 1.02, now only append a hash to the XML Schema URI (closes issue #14). 1.02 2017-06-21 Append a hash to URIs needing it. [ Bug Fixes ] - When adding local names, check if namespace ends in hash or slash, and append hash if not. 1.00 2017-01-18 Check prefixes so they don't conflict with existing methods. - Added: Prefixes that will conflict with existing methods will throw an error. Paul Williams++ - Improve the BUILDARGS code. Chris Prather++ - Minor cleanups. - Removed: Remove strict/warnings pragmas where Moo is used. Paul Williams++ 0.32 2016-12-29 New guessing method and improved diagnostics. [ Bug Fixes ] - Rework some tests that fails in strange ways. [ Other ] - Added: Add method for adding guesses post-construction. - Use carp instead of warns. 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 171613130007507 15466 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04 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 4406213130007507 15463 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04This software is copyright (c) 2017 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) 2017 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) 2017 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 47313130007510 15537 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04COPYRIGHT 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 lib/URI/NamespaceMap/ReservedLocalParts.pm t/iri.t t/justuri.t t/namespacemap.t t/prefixguess-none.t t/prefixguess.t t/reserved.t META.json000644001750001750 551713130007510 16053 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04{ "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", "Sub::Quote" : "0", "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" : "1.04" }, "URI::Namespace" : { "file" : "lib/URI/Namespace.pm", "version" : "1.04" }, "URI::NamespaceMap" : { "file" : "lib/URI/NamespaceMap.pm", "version" : "1.04" }, "URI::NamespaceMap::ReservedLocalParts" : { "file" : "lib/URI/NamespaceMap/ReservedLocalParts.pm", "version" : "1.04" } }, "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" : "1.04", "x_contributors" : [ "Dorian Taylor ", "Toby Inkster (TOBYINK) ", "Paul Williams (KWAKWA) " ], "x_serialization_backend" : "JSON::PP version 2.27202" } META.yml000644001750001750 355213130007510 15700 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04--- 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: '1.04' URI::Namespace: file: lib/URI/Namespace.pm version: '1.04' URI::NamespaceMap: file: lib/URI/NamespaceMap.pm version: '1.04' URI::NamespaceMap::ReservedLocalParts: file: lib/URI/NamespaceMap/ReservedLocalParts.pm version: '1.04' 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' Sub::Quote: '0' 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: '1.04' x_contributors: - 'Dorian Taylor ' - 'Toby Inkster (TOBYINK) ' - 'Paul Williams (KWAKWA) ' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Makefile.PL000644001750001750 1474213130007510 16424 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04use 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, "Sub::Quote" => 0, "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 => 1.04 }, "URI::Namespace" => { file => "lib/URI/Namespace.pm", version => 1.04 }, "URI::NamespaceMap" => { file => "lib/URI/NamespaceMap.pm", version => 1.04 }, "URI::NamespaceMap::ReservedLocalParts" => { file => "lib/URI/NamespaceMap/ReservedLocalParts.pm", version => 1.04, }, }, "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" => 1.04, "x_contributors" => [ "Dorian Taylor ", "Toby Inkster (TOBYINK) ", "Paul Williams (KWAKWA) ", ], }; 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 746113130007507 15320 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04NAME URI::NamespaceMap - Class holding a collection of namespaces VERSION Version 1.04 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. `guess_and_add ( @string_or_uri )` Like in the constructor, an array of strings can be given, and the module will attempt to guess appropriate mappings, and add them to the map. `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. Using them will result in an error. AUTHORS Chris Prather, `` Kjetil Kjernsmo, `` Gregory Todd Williams, `` Toby Inkster, `` CONTRIBUTORS Dorian Taylor Paul Williams 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,2017 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 515013130007531 15712 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04This 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 11fff32a68406b0ca0bb538795165eec3aa59179 COPYRIGHT SHA1 7e18313ce87520608c9b6ac304c3e87a84029dcc CREDITS SHA1 29faa7d9d82f5e32a5bd566208ece544edd0cef6 Changes SHA1 4b8a6a0f8d6104c8caa9e1891bd519465a414024 INSTALL SHA1 f28bfc952aec7f29af1e813e1d8086cdbc0e39b8 LICENSE SHA1 9704cd843d9d244312c5a6eab482b1c8fbe5de01 MANIFEST SHA1 c1ee852f6e7832cd7730f820129558bb834bf2db META.json SHA1 3fa1393b24c1990b3b8c034224442ea9604fb1c1 META.yml SHA1 96e51701b284294bf9bda63891bf422cb83ed1f0 Makefile.PL SHA1 2c99a76238d29928e8354746a3d71e410699d46f README SHA1 b8fcd666818a749533048c9306750cd79d55c5fa dist.ini SHA1 3b60caeb5ee63a96e5772920697582199be7fd1c doap.ttl SHA1 72c0525ae5033de5bb2d786722e4709fbe5ed34a lib/Types/Namespace.pm SHA1 54c9f6c0dfbb316303313350160e515ee6ade16f lib/URI/Namespace.pm SHA1 b7c41647e3c717b063a68ff0021c166b16e5d2d7 lib/URI/NamespaceMap.pm SHA1 b02834e321a30cf870bd8118a5cc7ef078691c28 lib/URI/NamespaceMap/ReservedLocalParts.pm SHA1 d9543d38cdc9a5cc7f701ac671532f9311a2da8c t/iri.t SHA1 1cc4e22575dc1506cda86fd2cbb0cf9cf6ee75e7 t/justuri.t SHA1 823796654b2fc86135ddc7aa0713582744c261da t/namespacemap.t SHA1 9eca2c1b867f0760d91b754c4925542d8e41198b t/prefixguess-none.t SHA1 01c71b7cd5b9eaa92526122d88e8bf1beb113456 t/prefixguess.t SHA1 b3003e6da5312b91b54213c7ec24a1814e99ab23 t/reserved.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUBWWAPSH++6N86nkqlAQh4Lg//ZyKqrWu6MpQDZ5hckYANPQgU+ZOk7LI3 Oyk7QOztlq9RqYhpu3yymzI6aFC+8lS7f6f6kxKA2uNjgX0RznsbevPzsMEtNsU9 hiQWCxX8ZjofzyjSdHTHQIuQBR9dQQV0lsZgM2Mks+DaraM6Ts4TyNl8iXsuXYS7 Ex8llp9ioeRJqToeJuvFIvTYJGGY2bGnK0HQMyQiG+/FY/IS/LA7Wb1vEs8qKBTH bAzKyuVNN0lcXMVOJnXEw3cXy2Xj55hw8F1tX1K4P36Hw6XBnPM9kYtTjNtmWgej 6IrbYKxNKCou0c+LpDzcGEinmVGDurjlTImLU8cX2cREkIY9X99nkKbYn1zeciwt 1qPO5N+LC6B0m99EK40+e5GK1G3miiN+U77rQjcakoAv0uDr5hko6b8YEOthWmQZ zqt9/G+fmpGsRPuMu2XAxU+R3b7i/6ZvLcrM80CJFK/TIUXSQgPJCezrURA2lsip 9VcAPilUy08CQFgwdrjNsCzwcE1RjyZWt+JEYNSMTD36/W3cwNfWmWc9aBONC1RO 1dgW+ODWr0KFIA6KCckLEuvjVDLvhyikwsrIUkLC8kSphlr+wQP4te+RwjFBQBod +Rda/YHAYThO70LhkZal4U+AaicULH2Hxt011QNXPggp/ZXKwrGo67iOc9l9wmdW /rz0ATaLZqo= =90fJ -----END PGP SIGNATURE----- dist.ini000644001750001750 17013130007506 16051 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04;;class='Dist::Inkt::Profile::TOBYINK' ;;name='URI-NamespaceMap' ;;skip_whitespace_test=1 ;;also_skip = [qr/README.pod/]doap.ttl000644001750001750 3722713130007510 16125 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04@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 "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:on "Module::Load::Conditional"^^doap-deps:CpanId; ], [ doap-deps:on "Carp"^^doap-deps:CpanId ], [ doap-deps:on "Sub::Quote"^^doap-deps:CpanId ], [ doap-deps:on "namespace::autoclean 0.20"^^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 doap:Version; rdfs:label "New guessing method and improved diagnostics."@en; dc:issued "2016-12-29"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Rework some tests that fails in strange ways."@en; ], [ a doap-changeset:Addition; rdfs:label "Add method for adding guesses post-construction."@en; ], [ a doap-changeset:Change; rdfs:label "Use carp instead of warns."@en; ]; ]; doap:revision "0.32"^^xsd:string. a doap:Version; rdfs:label "Check prefixes so they don't conflict with existing methods."@en; dc:issued "2017-01-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Removal; rdfs:label "Remove strict/warnings pragmas where Moo is used."@en; doap-changeset:blame ; ], [ a doap-changeset:Addition; rdfs:label "Prefixes that will conflict with existing methods will throw an error."@en; doap-changeset:blame ; ], [ a doap-changeset:Change; rdfs:label "Minor cleanups."@en; ], [ a doap-changeset:Change; rdfs:label "Improve the BUILDARGS code."@en; doap-changeset:thanks ; ]; ]; doap:revision "1.00"^^xsd:string. a doap:Version; rdfs:label "Append a hash to URIs needing it."@en; dc:issued "2017-06-21"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "When adding local names, check if namespace ends in hash or slash, and append hash if not."@en; ]; ]; doap:revision "1.02"^^xsd:string. a doap:Version; rdfs:label "Append a hash to only to XSD URIs."@en; dc:issued "2017-07-08"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Partly revert fix in 1.02, now only append a hash to the XML Schema URI (closes issue #14)."@en; ]; ]; doap:revision "1.04"^^xsd:string; owl:sameAs . a foaf:Person; foaf:name "Paul Williams"; 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 200713130007507 15642 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04/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 476713130007507 16603 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04/tuse Test::More; use strict; use URI; use_ok('URI::Namespace'); subtest 'Straightforward appends' => sub { 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 namespace from FOAF namespace map' ); is($foaf->name->as_string, 'http://xmlns.com/foaf/0.1/name', 'expected resource object for FOAF namespace with name' ); is($foaf->uri('Person')->as_string, 'http://xmlns.com/foaf/0.1/Person', 'expected resource object for FOAF 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 FOAF namespace with isa when set with uri method' ); }; subtest 'Missing hash on XSD' => sub { my $xsd = URI::Namespace->new( 'http://www.w3.org/2001/XMLSchema' ); isa_ok( $xsd, 'URI::Namespace' ); my $uri = $xsd->as_string; is( $uri, 'http://www.w3.org/2001/XMLSchema', 'expected resource object for namespace from XSD namespace map' ); is($xsd->integer->as_string, 'http://www.w3.org/2001/XMLSchema#integer', 'expected resource object for XSD namespace with integer' ); is($xsd->uri('decimal')->as_string, 'http://www.w3.org/2001/XMLSchema#decimal', 'expected resource object for XSD namespace with decimal when set with uri method' ); }; subtest 'With hash on XSD' => sub { my $xsd = URI::Namespace->new( 'http://www.w3.org/2001/XMLSchema#' ); isa_ok( $xsd, 'URI::Namespace' ); my $uri = $xsd->as_string; is( $uri, 'http://www.w3.org/2001/XMLSchema#', 'expected resource object for namespace from XSD namespace map with hash' ); is($xsd->byte->as_string, 'http://www.w3.org/2001/XMLSchema#byte', 'expected resource object for XSD namespace with byte' ); is($xsd->uri('long')->as_string, 'http://www.w3.org/2001/XMLSchema#long', 'expected resource object for XSD namespace with long when set with uri method' ); }; subtest 'Example without hash or slash' => sub { my $ex = URI::Namespace->new( 'http://www.example.org' ); isa_ok( $ex, 'URI::Namespace' ); my $uri = $ex->as_string; is( $uri, 'http://www.example.org', 'expected resource object for namespace from EX namespace map without hash or slash' ); is($ex->Order->as_string, 'http://www.example.orgOrder', 'expected resource object for EX namespace with Order' ); is($ex->uri('Order')->as_string, 'http://www.example.orgOrder', 'expected resource object for EX namespace with Order when set with uri method' ); }; done_testing; namespacemap.t000644001750001750 733213130007507 17517 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04/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' ); } 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'); 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 136213130007507 20363 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04/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 1233213130007507 17445 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04/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'); 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' } if (defined $rdfns) { require RDF::NS; unless (defined($RDF::NS::VERSION)) { diag('RDF::NS appears to be installed, but no version was found. Not using'); $rdfns = undef; } elsif ($RDF::NS::VERSION < 20130802) { plan skip_all => 'RDF::NS is old, please upgrade. Skipping tests, other functionality is usually OK.'; } } 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", 7 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'); $map->guess_and_add('dc'); ok($map->namespace_uri('dc'), 'DC returns something'); note('DC prefix differs between different modules'); is($map->namespace_uri('dc')->as_string, (defined $rnscu) ? 'http://purl.org/dc/terms/' : 'http://purl.org/dc/elements/1.1/', 'DC 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', 'rdfs' ] ); 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'); ok($map->namespace_uri('rdfs'), 'RDFS returns something') || diag('RDF::NS is version ' . $RDF::NS::VERSION . ' and may need upgrading'); is($map->namespace_uri('rdfs')->as_string, 'http://www.w3.org/2000/01/rdf-schema#', 'RDFS URI string OK'); } SKIP: { skip "RDF::NS needed", 2 unless(defined $rdfns); my $map = URI::NamespaceMap->new( [ 'acl' ] ); isa_ok( $map, 'URI::NamespaceMap' ); ok($map->namespace_uri('acl'), 'acl returns something') || diag('RDF::NS is version ' . $RDF::NS::VERSION . ' and may need upgrading'); } 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/2000/01/rdf-schema#' ] ); isa_ok( $map, 'URI::NamespaceMap' ); ok($map->namespace_uri('sdfhkd4f'), 'Keyboard cat returns something'); ok($map->namespace_uri('rdfs'), 'RDFS returns something'); is($map->namespace_uri('sdfhkd4f')->as_string, 'http://example.org/ns/sdfhkd4f#', 'Keyboard cat URI string OK'); is($map->namespace_uri('rdfs')->as_string, 'http://www.w3.org/2000/01/rdf-schema#', 'RDFS URI string OK'); } SKIP: { skip "RDF::Prefixes", 11 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'); $map->guess_and_add('http://www.w3.org/2002/07/owl#'); ok($map->namespace_uri('owl'), 'owl returns something'); is($map->namespace_uri('owl')->as_string, 'http://www.w3.org/2002/07/owl#', 'owl URI string OK'); $map->guess_and_add('http://example.org/isa#'); ok($map->namespace_uri('isax'), 'isax returns something'); is($map->namespace_uri('isax')->as_string, 'http://example.org/isa#', 'isax URI string OK'); my $map2 = URI::NamespaceMap->new( [ 'http://example.org/does#' ] ); isa_ok( $map2, 'URI::NamespaceMap' ); ok($map2->namespace_uri('doesx'), 'doesx returns something'); } done_testing; reserved.t000644001750001750 124713130007507 16703 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04/tuse strict; use warnings; use Test::More; use URI::NamespaceMap::ReservedLocalParts; subtest 'allowed/disallowed namespaces by default' => sub { my $r = URI::NamespaceMap::ReservedLocalParts->new(); for my $ns (qw/can DOES isa VERSION/) { is $r->is_reserved($ns) => 1, "namespace $ns is reserved"; } for my $ns (qw/allowed disallowed is_reserved uri/) { is $r->is_reserved($ns) => 0, "namespace $ns is *not* reserved"; } }; subtest 'extending disallowed namespaces' => sub { my $r = URI::NamespaceMap::ReservedLocalParts->new(disallowed => [qw/uri/]); is $r->is_reserved('uri') => 1, 'namespace uri is reserved'; }; done_testing; Namespace.pm000644001750001750 400613130007507 20534 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04/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 = '1.04'; =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 551513130007507 20075 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04/lib/URIpackage URI::Namespace; use Moo 1.006000; use URI; use IRI 0.003; use Types::Namespace 0.004 qw( Iri ); use namespace::autoclean; our $VERSION = '1.04'; =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)) { my $str = $self->_uri->as_string; # XSD is given without hash in XML world, but hash should be added anyway (see issue #14) $str .= '#' if ($str eq 'http://www.w3.org/2001/XMLSchema'); return IRI->new($str . "$name"); } else { return $self->_uri; } } sub uri { my ($self, $name) = @_; my $iri = $self->_uri->as_string; if (defined($name)) { $iri .= '#' if ($iri eq 'http://www.w3.org/2001/XMLSchema'); 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 2422413130007507 20551 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04/lib/URIpackage URI::NamespaceMap; 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 URI::NamespaceMap::ReservedLocalParts; use namespace::autoclean; =head1 NAME URI::NamespaceMap - Class holding a collection of namespaces =head1 VERSION Version 1.04 =cut our $VERSION = '1.04'; =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]}) }; } if (@parameters == 1 && (! exists $parameters[0]->{namespace_map})) { return { namespace_map => $parameters[0] } } else { $self->$next(@parameters) } }; sub BUILD { my ($self, $args) = @_; my $r = URI::NamespaceMap::ReservedLocalParts->new(disallowed => [qw/uri/]); for my $local_part (keys %{$args->{namespace_map}}) { Carp::croak("$_[1] prohibited as local part") if $r->is_reserved($local_part); } } has namespace_map => ( is => "ro", isa => HashRef[Namespace], coerce => 1, default => quote_sub q { {} }, ); sub add_mapping { my $r = URI::NamespaceMap::ReservedLocalParts->new(disallowed => [qw/uri/]); Carp::croak("$_[1] prohibited as local part") if $r->is_reserved($_[1]); $_[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<< guess_and_add ( @string_or_uri ) >> Like in the constructor, an array of strings can be given, and the module will attempt to guess appropriate mappings, and add them to the map. =cut sub guess_and_add { my ($self, @data) = @_; my $guessed = $self->_guess(@data); while (my ($name, $uri) = each %{$guessed}) { $self->add_mapping($name => $uri); } } =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; my $r = URI::NamespaceMap::ReservedLocalParts->new(disallowed => [qw/uri/]); foreach my $entry (@data) { if ($entry =~ m/^[a-z]\w+$/i) { # This is a prefix carp "Cannot resolve '$entry' without RDF::NS::Curated, XML::CommonNS, RDF::NS" unless ($rnscu || $xmlns || $rdfns); my $i = 1; my $prefix = $entry; while ($r->is_reserved($prefix)) { $prefix .= 'x'; carp "Cannot resolve '$entry' as tried prefix '$prefix' conflicts with method names." if ($i > 5); $i++; } if ($rnscu) { my $ns = RDF::NS::Curated->new; $namespaces{$prefix} = $ns->uri($entry); } if ((! $namespaces{$prefix}) && $xmlns) { require XML::CommonNS; XML::CommonNS->import(':all'); try { $namespaces{$prefix} = XML::CommonNS->uri(uc($entry))->toString; }; # Then, XML::CommonNS doesn't have the prefix, which is OK, we just continue } if ((! $namespaces{$prefix}) && $rdfns) { my $ns = RDF::NS->new; $namespaces{$prefix} = $ns->SELECT($entry); } carp "Cannot resolve '$entry'" unless $namespaces{$prefix}; } else { # Lets assume a URI string carp "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) { carp "Cannot resolve '$entry'"; } else { my $i = 1; while ($r->is_reserved($prefix)) { $prefix .= 'x'; carp "Cannot resolve '$entry' as tried prefix '$prefix' conflicts with method names." if ($i > 5); $i++; } $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. Using them will result in an error. =head1 AUTHORS Chris Prather, C<< >> Kjetil Kjernsmo, C<< >> Gregory Todd Williams, C<< >> Toby Inkster, C<< >> =head1 CONTRIBUTORS Dorian Taylor Paul Williams =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,2017 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__ ReservedLocalParts.pm000644001750001750 452513130007507 24277 0ustar00kjetilkjetil000000000000URI-NamespaceMap-1.04/lib/URI/NamespaceMappackage URI::NamespaceMap::ReservedLocalParts; use Moo 1.006000; use Types::Standard qw/ArrayRef Str/; use List::Util qw/first/; has allowed => ( is => 'ro', isa => ArrayRef [Str], default => sub { [qw/allowed disallowed is_reserved/] } ); has disallowed => (is => 'ro', isa => ArrayRef [Str], default => sub { [] }); sub is_reserved { my ($self, $keyword) = @_; return 0 if first { $_ eq $keyword } @{$self->allowed}; return 1 if first { $_ eq $keyword } @{$self->disallowed}; return $self->can($keyword) ? 1 : 0; } =head1 NAME URI::NamespaceMap::ReservedLocalParts - Permissible local parts for NamespaceMap =head1 VERSION Version 1.04 =cut our $VERSION = '1.04'; =head1 SYNOPSIS my $r = URI::NamespaceMap::ReservedLocalParts->new(disallowed => [qw/uri/]); say $r->is_reserved('isa'); # 1 say $r->is_reserved('uri'); # 1 say $r->is_reserved('foo'); # 0 =head1 DESCRIPTION L is an accompanying distribution to L. It's goal is to check for forbidden names used for local parts. Rather than creating a blacklist that needs to be maintained, it instantiates a new L object, and calls C on the invocant. Using this technique, it means that every method on every Perl object (C), and Moo objects (C) will be automatically black listed. =head1 ATTRIBUTES L implements the following attributes. =head2 allowed A whitelist of local part names. Defaults to C, C and C so that when C is called on the instance, it doesn't return a false positive for other method names associated with this package. =head2 disallowed A blacklist of local part names. Does not have a default set, but usually defaults to C when called from L. =head1 METHODS L implements the following methods. =head2 is_reserved my $r = URI::NamespaceMap::ReservedLocalParts->new(disallowed => [qw/uri/]); say $r->is_reserved('isa'); # 1 say $r->is_reserved('uri'); # 1 say $r->is_reserved('foo'); # 0 Checks if the first argument passed is reserved or not. Returns a C. =head1 FURTHER DETAILS See L for further details about authors, license, etc. =cut 1;