line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Catmandu::FedoraCommons::Model::listDatastreams - Perl model for the Fedora 'listDatastreams' REST call |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Catmandu::FedoraCommons; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $fedora = Catmandu::FedoraCommons->new('http://localhost:8080/fedora','fedoraAdmin','fedoraAdmin'); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $obj = $fedora->listDatastreams(pid => 'demo:29')->parse_content; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
{ |
14
|
|
|
|
|
|
|
'pid' => 'demo:29' , |
15
|
|
|
|
|
|
|
'baseURL' => 'http://localhost:8080/fedora/' , |
16
|
|
|
|
|
|
|
'datastream' => [ |
17
|
|
|
|
|
|
|
{ |
18
|
|
|
|
|
|
|
'dsid' => 'DC' , |
19
|
|
|
|
|
|
|
'label' => 'Dublin Core Record for this object' , |
20
|
|
|
|
|
|
|
'mimeType' => 'text/xml' , |
21
|
|
|
|
|
|
|
}, |
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
'dsid' => 'RELS-EXT' , |
24
|
|
|
|
|
|
|
'label' => 'RDF Statements about this object' , |
25
|
|
|
|
|
|
|
'mimeType' => 'application/rdf+xml' , |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
{ |
28
|
|
|
|
|
|
|
'dsid' => 'url' , |
29
|
|
|
|
|
|
|
'label' => 'Thorny\'s Coliseum high jpg image' , |
30
|
|
|
|
|
|
|
'mimeType' => 'text/xml' , |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
] , |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SEE ALSO |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
L<Catmandu::FedoraCommons> |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
package Catmandu::FedoraCommons::Model::listDatastreams; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
1
|
|
76478
|
use XML::LibXML; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub parse { |
45
|
|
|
|
|
|
|
my ($class,$xml) = @_; |
46
|
|
|
|
|
|
|
my $dom = XML::LibXML->load_xml(string => $xml); |
47
|
|
|
|
|
|
|
$dom->getDocumentElement()->setNamespace('http://www.fedora.info/definitions/1/0/access/','a'); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my @nodes = $dom->findnodes("/a:objectDatastreams/*"); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $result; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
foreach my $node (@nodes) { |
54
|
|
|
|
|
|
|
my @attributes = $node->attributes(); |
55
|
|
|
|
|
|
|
my %values = map { $_->getName() , $_->getValue() } @attributes; |
56
|
|
|
|
|
|
|
push @{ $result->{datastream} }, \%values; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $pid = $dom->firstChild()->getAttribute('pid'); |
60
|
|
|
|
|
|
|
$result->{pid} = $pid; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $baseURL = $dom->firstChild()->getAttribute('baseURL'); |
63
|
|
|
|
|
|
|
$result->{baseURL} = $baseURL; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
return $result; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |