RDF::T...aceMap(3pm)

πŸ“¦
version 1.019 Β· 7 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

RDF::Trine::NamespaceMap πŸ’–

okay so bestie, this is the User Contributed Perl Documentation page for RDF::Trine::NamespaceMap β€” the header abbreviates it as RDF::T...aceMap(3pm), but we're not doing abbreviations in this group chat. It's a whole vibe for managing namespaces in RDF::Trine. ✨


✨ NAME ✨

RDF::Trine::NamespaceMap β€” Collection of Namespaces. (Yes queen, that's the name.)

✨ VERSION ✨

This document describes RDF::Trine::NamespaceMap version 1.019. πŸ’…

✨ SYNOPSIS ✨

use RDF::Trine::NamespaceMap;
my $map = RDF::Trine::NamespaceMap->new( \%namespaces );
$serializer->serialize_model_to_string( $model, namespaces => $map );

$map->add_mapping( foaf => 'http://xmlns.com/foaf/0.1/' );
my $foaf_namespace = $map->foaf;
my $foaf_person    = $map->foaf('Person');

✨ DESCRIPTION ✨

This module hands you an object to manage multiple namespaces, so you can create RDF::Trine::Node::Resource objects and serialize like the main character you are. πŸ¦‹

✨ METHODS ✨

new ( [ \%namespaces ] ) πŸ’–

Returns a brand-new namespace map object. You can pass a hash reference with mappings from local names to namespace URIs β€” and those URIs can be given as a string or as an RDF::Trine::Node::Resource. Slay.

add_mapping ( $name => $uri ) ✨

Adds a new namespace to the map. The namespace URI can be passed as a string or as some object that provides an uri_value method. No cap.

remove_mapping ( $name ) πŸŽ€

Removes a namespace from the map. Bye bestie.

namespace_uri ( $name ) 🌸

Returns the namespace object (if any) associated with the given name.

list_namespaces 🫢

Returns an array of RDF::Trine::Namespace objects with all the namespaces.

list_prefixes πŸ’…

Returns an array of prefixes.

uri ( $prefixed_name ) πŸ”₯

Returns a URI (as RDF::Trine::Node::Resource) for an abbreviated string such as 'foaf:Person'.

prefix_for "uri ($uri)" πŸ‘‘

Returns the associated prefix (or potentially multiple prefixes, in list context) for the given URI. It's giving lookup energy.

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_node->uri_value;

may be useful for certain serialization tasks. Periodt.

⚠️ 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. 🚫

Not me warning you because I care: those names are defined as methods for every Perl object by default, so avoid them as namespace prefixes. πŸ’€

πŸ› BUGS πŸ›

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

πŸ‘‘ AUTHOR πŸ‘‘

Gregory Todd Williams "<gwilliams@cpan.org>"

Copyright (c) 2006-2012 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay that's the whole manual, bestie. this page was served by perl v5.38.2 on 2024-01-13, and the man page is RDF::T...aceMap(3pm). stay iconic, keep your namespaces mapped, and don't use forbidden prefixes. mwah πŸ’‹

πŸ“¦ where this page comes from