| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
### |
|
3
|
|
|
|
|
|
|
# XML::RDDL::Resource - RDDL Resource Interface |
|
4
|
|
|
|
|
|
|
# Robin Berjon |
|
5
|
|
|
|
|
|
|
# 17/10/2001 - v.0.01 |
|
6
|
|
|
|
|
|
|
### |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package XML::RDDL::Resource; |
|
9
|
2
|
|
|
2
|
|
11
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
72
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
11
|
use vars qw($VERSION); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
1162
|
|
|
12
|
|
|
|
|
|
|
$VERSION = $XML::RDDL::VERSION || '0.01'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#-------------------------------------------------------------------# |
|
16
|
|
|
|
|
|
|
# constructor |
|
17
|
|
|
|
|
|
|
#-------------------------------------------------------------------# |
|
18
|
|
|
|
|
|
|
sub new { |
|
19
|
5
|
50
|
|
5
|
1
|
59
|
my $class = ref($_[0]) ? ref(shift) : shift; |
|
20
|
5
|
|
|
|
|
51
|
my %opt = @_; |
|
21
|
5
|
|
|
|
|
30
|
return bless \%opt, $class; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
#-------------------------------------------------------------------# |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,# |
|
27
|
|
|
|
|
|
|
#`,`, Accessors `,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,# |
|
28
|
|
|
|
|
|
|
#```````````````````````````````````````````````````````````````````# |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#-------------------------------------------------------------------# |
|
31
|
|
|
|
|
|
|
# get and set |
|
32
|
|
|
|
|
|
|
#-------------------------------------------------------------------# |
|
33
|
10
|
|
|
10
|
0
|
191
|
sub get_id { return $_[0]->{id}; } |
|
34
|
6
|
|
|
6
|
0
|
66
|
sub get_base_uri { return $_[0]->{base_uri}; } |
|
35
|
6
|
|
|
6
|
0
|
2869
|
sub get_href { return $_[0]->{href}; } |
|
36
|
9
|
|
|
9
|
0
|
71
|
sub get_nature { return $_[0]->{nature}; } |
|
37
|
9
|
|
|
9
|
0
|
74
|
sub get_purpose { return $_[0]->{purpose}; } |
|
38
|
7
|
|
|
7
|
0
|
104
|
sub get_title { return $_[0]->{title}; } |
|
39
|
6
|
|
|
6
|
0
|
75
|
sub get_lang { return $_[0]->{lang}; } |
|
40
|
1
|
|
|
1
|
0
|
4
|
sub set_id { $_[0]->{id} = $_[1]; } |
|
41
|
1
|
|
|
1
|
0
|
4
|
sub set_base_uri { $_[0]->{base_uri} = $_[1]; } |
|
42
|
1
|
|
|
1
|
0
|
5
|
sub set_href { $_[0]->{href} = $_[1]; } |
|
43
|
1
|
|
|
1
|
0
|
4
|
sub set_nature { $_[0]->{nature} = $_[1]; } |
|
44
|
1
|
|
|
1
|
0
|
4
|
sub set_purpose { $_[0]->{purpose} = $_[1]; } |
|
45
|
1
|
|
|
1
|
0
|
3
|
sub set_title { $_[0]->{title} = $_[1]; } |
|
46
|
1
|
|
|
1
|
0
|
4
|
sub set_lang { $_[0]->{lang} = $_[1]; } |
|
47
|
|
|
|
|
|
|
#-------------------------------------------------------------------# |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
|
51
|
|
|
|
|
|
|
#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,# |
|
52
|
|
|
|
|
|
|
#`,`, Documentation `,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,# |
|
53
|
|
|
|
|
|
|
#```````````````````````````````````````````````````````````````````# |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
XML::RDDL::Resource - RDDL Resource Interface |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
use XML::RDDL::Resource; |
|
64
|
|
|
|
|
|
|
# create a new Resource |
|
65
|
|
|
|
|
|
|
my $res = XML::RDDL::Resource->new( |
|
66
|
|
|
|
|
|
|
id => $id, |
|
67
|
|
|
|
|
|
|
base_uri => $xbase, |
|
68
|
|
|
|
|
|
|
href => $href, |
|
69
|
|
|
|
|
|
|
nature => $role, |
|
70
|
|
|
|
|
|
|
purpose => $arcrole, |
|
71
|
|
|
|
|
|
|
title => $title, |
|
72
|
|
|
|
|
|
|
lang => $lang, |
|
73
|
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
# manipulate it in various ways |
|
75
|
|
|
|
|
|
|
$foo = $res->get_id; |
|
76
|
|
|
|
|
|
|
$foo = $res->get_base_uri; |
|
77
|
|
|
|
|
|
|
$foo = $res->get_href; |
|
78
|
|
|
|
|
|
|
$foo = $res->get_nature; |
|
79
|
|
|
|
|
|
|
$foo = $res->get_purpose; |
|
80
|
|
|
|
|
|
|
$foo = $res->get_title; |
|
81
|
|
|
|
|
|
|
$foo = $res->get_lang; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$res->set_id('foo'); |
|
84
|
|
|
|
|
|
|
$res->set_base_uri('foo'); |
|
85
|
|
|
|
|
|
|
$res->set_href('foo'); |
|
86
|
|
|
|
|
|
|
$res->set_nature('foo'); |
|
87
|
|
|
|
|
|
|
$res->set_purpose('foo'); |
|
88
|
|
|
|
|
|
|
$res->set_title('foo'); |
|
89
|
|
|
|
|
|
|
$res->set_lang('foo'); |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
XML::RDDL::Resource is an interface to a single RDDL Resouce |
|
94
|
|
|
|
|
|
|
description, as found inside an RDDL document. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 METHODS |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over 4 |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item XML::RDDL::Resource->new(%options) |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Creates a new Resource instance. None of the following options are |
|
103
|
|
|
|
|
|
|
mandatory, but it is recommended that all be set, and of course a |
|
104
|
|
|
|
|
|
|
Resource that doesn't have a nature, purpose, and href is moderately |
|
105
|
|
|
|
|
|
|
useful. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
- id |
|
108
|
|
|
|
|
|
|
the ID of the Resource (ought to be unique) |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
- base_uri |
|
111
|
|
|
|
|
|
|
the current base URI of the Resource, based on which the href is |
|
112
|
|
|
|
|
|
|
resolved. This doesn't have to be set by an xml:base attribute of |
|
113
|
|
|
|
|
|
|
the rddl:resource element but can also be the base URI of the |
|
114
|
|
|
|
|
|
|
document, or set by the last xml:base in scope. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
- href |
|
117
|
|
|
|
|
|
|
the xlink:href of the Resource which points to the actual resource |
|
118
|
|
|
|
|
|
|
entity. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
- nature |
|
121
|
|
|
|
|
|
|
the nature of the Resource (xlink:role) |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
- purpose |
|
124
|
|
|
|
|
|
|
the purpose of the Resource (xlink:arcrole) |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
- title |
|
127
|
|
|
|
|
|
|
the title of the Resource (xlink:title) |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
- lang |
|
130
|
|
|
|
|
|
|
the lang of the Resource. This doesn't have to be set by an |
|
131
|
|
|
|
|
|
|
xml:lang attribute of the rddl:resource element but can also be |
|
132
|
|
|
|
|
|
|
set by the last xml:lang in scope. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item Accessors |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
All the above options have corresponding get_* and set_* accessors. |
|
137
|
|
|
|
|
|
|
The get_* only return the value, and the set_* modify it without |
|
138
|
|
|
|
|
|
|
returning anything. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=back |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 TODO |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
- it may be that more accessors are needed depending on how RDDL |
|
145
|
|
|
|
|
|
|
evolves |
|
146
|
|
|
|
|
|
|
- URI resolution helpers may be wanted |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 AUTHOR |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Robin Berjon, robin@knowscape.com |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Copyright (c) 2001-2002 Robin Berjon. All rights reserved. This program is |
|
155
|
|
|
|
|
|
|
free software; you can redistribute it and/or modify it under the same |
|
156
|
|
|
|
|
|
|
terms as Perl itself. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
http://www.rddl.org/, XML::RDDL |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=cut |