1RDF::Trine::NamespaceMaUps(e3r)Contributed Perl DocumentRaDtFi:o:nTrine::NamespaceMap(3)
2
3
4

NAME

6       RDF::Trine::NamespaceMap - Collection of Namespaces
7

VERSION

9       This document describes RDF::Trine::NamespaceMap version 1.019
10

SYNOPSIS

12           use RDF::Trine::NamespaceMap;
13           my $map = RDF::Trine::NamespaceMap->new( \%namespaces );
14           $serializer->serialize_model_to_string( $model, namespaces => $map );
15
16           $map->add_mapping( foaf => 'http://xmlns.com/foaf/0.1/' );
17           my $foaf_namespace = $map->foaf;
18           my $foaf_person    = $map->foaf('Person');
19

DESCRIPTION

21       This module provides an object to manage multiple namespaces for
22       creating RDF::Trine::Node::Resource objects and for serializing.
23

METHODS

25       "new ( [ \%namespaces ] )"
26           Returns a new namespace map object. You can pass a hash reference
27           with mappings from local names to namespace URIs (given as string
28           or RDF::Trine::Node::Resource).
29
30       "add_mapping ( $name => $uri )"
31           Adds a new namespace to the map. The namespace URI can be passed as
32           string or some object, that provides an uri_value method.
33
34       "remove_mapping ( $name )"
35           Removes a namespace from the map.
36
37       "namespace_uri ( $name )"
38           Returns the namespace object (if any) associated with the given
39           name.
40
41       "list_namespaces"
42           Returns an array of RDF::Trine::Namespace objects with all the
43           namespaces.
44
45       "list_prefixes"
46           Returns an array of prefixes.
47
48       "uri ( $prefixed_name )"
49           Returns a URI (as RDF::Trine::Node::Resource) for an abbreviated
50           string such as 'foaf:Person'.
51
52       prefix_for "uri ($uri)"
53           Returns the associated prefix (or potentially multiple prefixes, in
54           list context) for the given URI.
55
56       abbreviate "uri ($uri)"
57           Complement to "namespace_uri". Returns the given URI in "foo:bar"
58           format or "undef" if it wasn't matched, therefore the idiom
59
60               my $str = $nsmap->abbreviate($uri_node) || $uri_node->uri_value;
61
62           may be useful for certain serialization tasks.
63

WARNING

65       Avoid using the names 'can', 'isa', 'VERSION', and 'DOES' as namespace
66       prefix, because these names are defined as method for every Perl object
67       by default.  The method names 'new' and 'uri' are also forbidden.
68

BUGS

70       Please report any bugs or feature requests to through the GitHub web
71       interface at <https://github.com/kasei/perlrdf/issues>.
72

AUTHOR

74       Gregory Todd Williams  "<gwilliams@cpan.org>"
75
77       Copyright (c) 2006-2012 Gregory Todd Williams. This program is free
78       software; you can redistribute it and/or modify it under the same terms
79       as Perl itself.
80
81
82
83perl v5.34.0                      2022-01-21       RDF::Trine::NamespaceMap(3)
Impressum