| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# RDF::Trine::Namespace |
|
2
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
RDF::Trine::Namespace - Abbreviated syntax for constructing RDF node objects |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 VERSION |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
This document describes RDF::Trine::Namespace version 1.017 |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use RDF::Trine::Namespace qw(rdf); |
|
16
|
|
|
|
|
|
|
my $foaf = RDF::Trine::Namespace->new( 'http://xmlns.com/foaf/0.1/' ); |
|
17
|
|
|
|
|
|
|
my $pred = $foaf->name; |
|
18
|
|
|
|
|
|
|
my $type = $rdf->type; |
|
19
|
|
|
|
|
|
|
print $pred->as_string; # '[http://xmlns.com/foaf/0.1/name]' |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This module provides an abbreviated syntax for creating RDF::Trine::Node objects |
|
24
|
|
|
|
|
|
|
for URIs sharing common namespaces. The module provides a constructor for creating |
|
25
|
|
|
|
|
|
|
namespace objects which may be used for constructing Node objects. Calling any |
|
26
|
|
|
|
|
|
|
method (other than 'import', 'new', 'uri' or 'AUTOLOAD') on the namespace object |
|
27
|
|
|
|
|
|
|
will return a RDF::Trine::Node object representing the URI of the method name |
|
28
|
|
|
|
|
|
|
appended to the namespace. |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 METHODS |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=over 4 |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
package RDF::Trine::Namespace; |
|
37
|
|
|
|
|
|
|
|
|
38
|
68
|
|
|
68
|
|
416
|
use strict; |
|
|
68
|
|
|
|
|
416
|
|
|
|
68
|
|
|
|
|
1623
|
|
|
39
|
68
|
|
|
68
|
|
317
|
use warnings; |
|
|
68
|
|
|
|
|
156
|
|
|
|
68
|
|
|
|
|
1493
|
|
|
40
|
68
|
|
|
68
|
|
304
|
no warnings 'redefine'; |
|
|
68
|
|
|
|
|
144
|
|
|
|
68
|
|
|
|
|
2235
|
|
|
41
|
68
|
|
|
68
|
|
424
|
use base qw(XML::Namespace); |
|
|
68
|
|
|
|
|
146
|
|
|
|
68
|
|
|
|
|
29175
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
###################################################################### |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
our ($VERSION); |
|
46
|
|
|
|
|
|
|
BEGIN { |
|
47
|
68
|
|
|
68
|
|
40265
|
$VERSION = '1.017'; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
###################################################################### |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
68
|
|
|
68
|
|
419
|
use Carp; |
|
|
68
|
|
|
|
|
154
|
|
|
|
68
|
|
|
|
|
3265
|
|
|
54
|
68
|
|
|
68
|
|
414
|
use RDF::Trine::Node::Resource; |
|
|
68
|
|
|
|
|
5317
|
|
|
|
68
|
|
|
|
|
3005
|
|
|
55
|
68
|
|
|
68
|
|
25355
|
use XML::CommonNS 0.04 (); |
|
|
68
|
|
|
|
|
98976
|
|
|
|
68
|
|
|
|
|
7455
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub import { |
|
58
|
300
|
|
|
300
|
|
3835
|
my $class = shift; |
|
59
|
300
|
100
|
|
|
|
13983
|
if (@_) { |
|
60
|
156
|
|
|
|
|
4199
|
$class->_install_namespaces( 1, @_ ); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _install_namespaces { |
|
65
|
156
|
|
|
156
|
|
455
|
my $class = shift; |
|
66
|
156
|
|
|
|
|
331
|
my $level = shift; |
|
67
|
156
|
|
|
|
|
550
|
my $pkg = caller( $level ); |
|
68
|
156
|
|
|
|
|
2000
|
foreach my $name (@_) { |
|
69
|
166
|
100
|
|
|
|
1490
|
my $uri = (uc($name) eq 'XSD') |
|
70
|
|
|
|
|
|
|
? XML::NamespaceFactory->new('http://www.w3.org/2001/XMLSchema#') |
|
71
|
|
|
|
|
|
|
: XML::CommonNS->uri( uc($name) ); |
|
72
|
166
|
|
|
|
|
5538
|
my $ns = $class->new( "$uri" ); |
|
73
|
68
|
|
|
68
|
|
493
|
no strict 'refs'; ## no critic (ProhibitNoStrict) |
|
|
68
|
|
|
|
|
151
|
|
|
|
68
|
|
|
|
|
8150
|
|
|
74
|
166
|
|
|
|
|
2731
|
*{ "${pkg}::${name}" } = \$ns; |
|
|
166
|
|
|
|
|
19754
|
|
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item C<uri> |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Returns the URI node object for the namespace, with an optional path argument |
|
81
|
|
|
|
|
|
|
added to the end of it. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub uri { |
|
86
|
8600
|
|
|
8600
|
1
|
221542
|
my $self = shift; |
|
87
|
8600
|
|
|
|
|
16518
|
my $local = shift; |
|
88
|
8600
|
100
|
|
|
|
22289
|
unless (defined($local)) { |
|
89
|
31
|
|
|
|
|
65
|
$local = ''; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# we should just call $self->SUPER::uri($local) here, but there's a bug in |
|
93
|
|
|
|
|
|
|
# XML::Namespace 0.2 that assumes $local eq '' if $local is defined but false (e.g. '0') |
|
94
|
8600
|
|
|
|
|
27928
|
my $uri = $self->SUPER::uri() . $local; |
|
95
|
8600
|
|
|
|
|
88295
|
return RDF::Trine::Node::Resource->new( $uri ); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item C<< uri_value >> |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Returns the URI/IRI value of this namespace. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub uri_value { |
|
105
|
9
|
|
|
9
|
1
|
498
|
my $self = shift; |
|
106
|
9
|
|
|
|
|
22
|
return $self->uri(); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
|
110
|
|
|
|
|
|
|
__END__ |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=back |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
L<XML::Namespace> |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 BUGS |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Please report any bugs or feature requests to through the GitHub web interface |
|
121
|
|
|
|
|
|
|
at L<https://github.com/kasei/perlrdf/issues>. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 AUTHOR |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Gregory Todd Williams C<< <gwilliams@cpan.org> >> |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Copyright (c) 2006-2012 Gregory Todd Williams. This |
|
130
|
|
|
|
|
|
|
program is free software; you can redistribute it and/or modify it under |
|
131
|
|
|
|
|
|
|
the same terms as Perl itself. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |