Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/perigrin/uri-namespacemap


https://github.com/perigrin/uri-namespacemap

Last synced: 23 days ago
JSON representation

Awesome Lists containing this project

README

        

NAME
URI::NamespaceMap - Class holding a collection of namespaces

VERSION
Version 0.01

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' )

DESCRIPTION
This module provides an object to manage multiple namespaces for
creating URI::Namespace objects and for serializing.

METHODS
"new ( [ \%namespaces ] )"
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.

"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 namespace object (if any) associated with the given
prefix.

"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'.

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, ""

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 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.