line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::OAI::Metadata::OAI_DC; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
@ISA = qw( HTTP::OAI::MemberMixin HTTP::OAI::SAX::Base ); |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
2049
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
856
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '4.12'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $OAI_DC_SCHEMA = 'http://www.openarchives.org/OAI/2.0/oai_dc/'; |
10
|
|
|
|
|
|
|
our $DC_SCHEMA = 'http://purl.org/dc/elements/1.1/'; |
11
|
|
|
|
|
|
|
our @DC_TERMS = qw( contributor coverage creator date description format identifier language publisher relation rights source subject title type ); |
12
|
|
|
|
|
|
|
our %VALID_TERM = map { $_ => 1 } @DC_TERMS; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
0
|
6
|
sub metadata { shift->dom(@_) } |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
3
|
0
|
32
|
sub dc { shift->_elem('dc',@_) } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub generate |
19
|
|
|
|
|
|
|
{ |
20
|
1
|
|
|
1
|
0
|
4
|
my( $self, $driver ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
3
|
$driver->start_element( 'metadata' ); |
23
|
1
|
|
|
|
|
138
|
$driver->start_element( 'oai_dc:dc', |
24
|
|
|
|
|
|
|
'xmlns:oai_dc' => 'http://www.openarchives.org/OAI/2.0/oai_dc/', |
25
|
|
|
|
|
|
|
'xmlns:dc' => 'http://purl.org/dc/elements/1.1/', |
26
|
|
|
|
|
|
|
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', |
27
|
|
|
|
|
|
|
'xsi:schemaLocation' => 'http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd', |
28
|
|
|
|
|
|
|
); |
29
|
1
|
|
|
|
|
223
|
foreach my $term (@DC_TERMS) |
30
|
|
|
|
|
|
|
{ |
31
|
15
|
100
|
|
|
|
52
|
foreach my $value (@{$self->{dc}{$term} || []}) |
|
15
|
|
|
|
|
41
|
|
32
|
|
|
|
|
|
|
{ |
33
|
8
|
|
|
|
|
36
|
$driver->data_element( "dc:$term", $value ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
1
|
|
|
|
|
10
|
$driver->end_element( 'oai_dc:dc' ); |
37
|
1
|
|
|
|
|
9
|
$driver->end_element( 'metadata' ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _toString { |
41
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
42
|
0
|
|
|
|
|
0
|
my $str = "Open Archives Initiative Dublin Core (".ref($self).")\n"; |
43
|
0
|
|
|
|
|
0
|
foreach my $term ( @DC_TERMS ) |
44
|
|
|
|
|
|
|
{ |
45
|
0
|
|
|
|
|
0
|
for(@{$self->{dc}->{$term}}) |
|
0
|
|
|
|
|
0
|
|
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
0
|
|
|
0
|
$str .= sprintf("%s:\t%s\n", $term, $_||''); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
0
|
|
|
|
|
0
|
$str; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub end_element { |
54
|
31
|
|
|
31
|
1
|
214
|
my ($self,$hash) = @_; |
55
|
31
|
|
|
|
|
54
|
my $elem = lc($hash->{LocalName}); |
56
|
31
|
100
|
|
|
|
77
|
if( $VALID_TERM{$elem} ) |
57
|
|
|
|
|
|
|
{ |
58
|
25
|
|
|
|
|
30
|
push @{$self->{dc}->{$elem}}, $hash->{Text}; |
|
25
|
|
|
|
|
85
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |