line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wikibase::Datatype::Mediainfo; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
1350587
|
use strict; |
|
15
|
|
|
|
|
148
|
|
|
15
|
|
|
|
|
438
|
|
4
|
15
|
|
|
15
|
|
83
|
use warnings; |
|
15
|
|
|
|
|
31
|
|
|
15
|
|
|
|
|
415
|
|
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
6740
|
use Error::Pure qw(err); |
|
15
|
|
|
|
|
149984
|
|
|
15
|
|
|
|
|
298
|
|
7
|
15
|
|
|
15
|
|
7481
|
use Mo qw(build default is); |
|
15
|
|
|
|
|
7836
|
|
|
15
|
|
|
|
|
87
|
|
8
|
15
|
|
|
15
|
|
40151
|
use Mo::utils qw(check_array_object check_number check_number_of_items); |
|
15
|
|
|
|
|
21105
|
|
|
15
|
|
|
|
|
252
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = 0.29; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has descriptions => ( |
13
|
|
|
|
|
|
|
default => [], |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has id => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has labels => ( |
22
|
|
|
|
|
|
|
default => [], |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has lastrevid => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has modified => ( |
31
|
|
|
|
|
|
|
is => 'ro', |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has ns => ( |
35
|
|
|
|
|
|
|
default => 6, |
36
|
|
|
|
|
|
|
is => 'ro', |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has page_id => ( |
40
|
|
|
|
|
|
|
is => 'ro', |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has statements => ( |
44
|
|
|
|
|
|
|
default => [], |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has title => ( |
49
|
|
|
|
|
|
|
is => 'ro', |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub BUILD { |
53
|
21
|
|
|
21
|
0
|
8102
|
my $self = shift; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Check descriptions. |
56
|
21
|
|
|
|
|
92
|
check_array_object($self, 'descriptions', 'Wikibase::Datatype::Value::Monolingual', |
57
|
|
|
|
|
|
|
'Description'); |
58
|
20
|
|
|
|
|
460
|
check_number_of_items($self, 'descriptions', 'language', 'Description', 'language'); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Check labels. |
61
|
19
|
|
|
|
|
664
|
check_array_object($self, 'labels', 'Wikibase::Datatype::Value::Monolingual', |
62
|
|
|
|
|
|
|
'Label'); |
63
|
18
|
|
|
|
|
284
|
check_number_of_items($self, 'labels', 'language', 'Label', 'language'); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# Check page id. |
66
|
17
|
|
|
|
|
408
|
check_number($self, 'page_id'); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Check statements. |
69
|
16
|
|
|
|
|
233
|
check_array_object($self, 'statements', 'Wikibase::Datatype::MediainfoStatement', |
70
|
|
|
|
|
|
|
'MediainfoStatement'); |
71
|
|
|
|
|
|
|
|
72
|
15
|
|
|
|
|
188
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=pod |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=encoding utf8 |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 NAME |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Wikibase::Datatype::Mediainfo - Wikibase mediainfo datatype. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 SYNOPSIS |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
use Wikibase::Datatype::Mediainfo; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Mediainfo->new(%params); |
92
|
|
|
|
|
|
|
my $descriptions_ar = $obj->descriptions; |
93
|
|
|
|
|
|
|
my $id = $obj->id; |
94
|
|
|
|
|
|
|
my $labels_ar = $obj->labels; |
95
|
|
|
|
|
|
|
my $lastrevid = $obj->lastrevid; |
96
|
|
|
|
|
|
|
my $modified = $obj->modified; |
97
|
|
|
|
|
|
|
my $ns = $obj->ns; |
98
|
|
|
|
|
|
|
my $page_id = $obj->page_id; |
99
|
|
|
|
|
|
|
my $statements_ar = $obj->statements; |
100
|
|
|
|
|
|
|
my $title = $obj->title; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 DESCRIPTION |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This datatype is mediainfo class for representing commons structured data. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 METHODS |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 C<new> |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Mediainfo->new(%params); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Constructor. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Returns instance of object. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=over 8 |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item * C<descriptions> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Mediainfo descriptions. One per language. |
121
|
|
|
|
|
|
|
Reference to array with Wikibase::Datatype::Value::Monolingual instances. |
122
|
|
|
|
|
|
|
Parameter is optional. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * C<id> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Id. |
127
|
|
|
|
|
|
|
Parameter is optional. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item * C<labels> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Mediainfo descriptions. One per language. |
132
|
|
|
|
|
|
|
Reference to array with Wikibase::Datatype::Value::Monolingual instances. |
133
|
|
|
|
|
|
|
Parameter is optional. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item * C<lastrevid> |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Last revision ID. |
138
|
|
|
|
|
|
|
Parameter is optional. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item * C<modified> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Date of modification. |
143
|
|
|
|
|
|
|
Parameter is optional. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item * C<ns> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Namespace. |
148
|
|
|
|
|
|
|
Default value is 6. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item * C<page_id> |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Page id. Numeric value. |
153
|
|
|
|
|
|
|
Parameter is optional. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item * C<statements> |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Mediainfo statements. |
158
|
|
|
|
|
|
|
Reference to array with Wikibase::Datatype::MediainfoStatement instances. |
159
|
|
|
|
|
|
|
Parameter is optional. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item * C<title> |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Mediainfo title. |
164
|
|
|
|
|
|
|
Parameter is optional. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=back |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 C<descriptions> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
my $descriptions_ar = $obj->descriptions; |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Get descriptions. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Returns reference to array with Wikibase::Datatype::Value::Monolingual instances. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head2 C<id> |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
my $id = $obj->id; |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Get id. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Returns string. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 C<labels> |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
my $labels_ar = $obj->labels; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Get labels. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Returns reference to array with Wikibase::Datatype::Value::Monolingual instances. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 C<lastrevid> |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
my $lastrevid = $obj->lastrevid; |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Get last revision ID. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Returns string. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head2 C<modified> |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
my $modified = $obj->modified; |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Get date of modification. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Returns string. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 C<ns> |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
my $ns = $obj->ns; |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Get namespace. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Returns number. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head2 C<page_id> |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
my $page_id = $obj->page_id; |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Get page id. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
Returns number. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head2 C<statements> |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
my $statements_ar = $obj->statements; |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Get statements. |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
Returns reference to array with Wikibase::Datatype::MediainfoStatement instances. |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head2 C<title> |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
my $title = $obj->title; |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Get title. |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
Returns string. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head1 ERRORS |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
new(): |
243
|
|
|
|
|
|
|
From Mo::utils::check_array_object(): |
244
|
|
|
|
|
|
|
Description isn't 'Wikibase::Datatype::Value::Monolingual' object. |
245
|
|
|
|
|
|
|
Label isn't 'Wikibase::Datatype::Value::Monolingual' object. |
246
|
|
|
|
|
|
|
Parameter 'descriptions' must be a array. |
247
|
|
|
|
|
|
|
Parameter 'labels' must be a array. |
248
|
|
|
|
|
|
|
Parameter 'statements' must be a array. |
249
|
|
|
|
|
|
|
MediainfoStatement isn't 'Wikibase::Datatype::MediainfoStatement' object. |
250
|
|
|
|
|
|
|
From Mo::utils::check_page_id(): |
251
|
|
|
|
|
|
|
Parameter 'page_id' must a number. |
252
|
|
|
|
|
|
|
From Mo::utils::check_number_of_items(): |
253
|
|
|
|
|
|
|
Sitelink for site '%s' has multiple values. |
254
|
|
|
|
|
|
|
Description for language '%s' has multiple values. |
255
|
|
|
|
|
|
|
Label for language '%s' has multiple values. |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=head1 EXAMPLE |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=for comment filename=create_and_print_mediainfo.pl |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
use strict; |
262
|
|
|
|
|
|
|
use warnings; |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
use Unicode::UTF8 qw(decode_utf8 encode_utf8); |
265
|
|
|
|
|
|
|
use Wikibase::Datatype::Mediainfo; |
266
|
|
|
|
|
|
|
use Wikibase::Datatype::MediainfoSnak; |
267
|
|
|
|
|
|
|
use Wikibase::Datatype::MediainfoStatement; |
268
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Item; |
269
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Monolingual; |
270
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::String; |
271
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Time; |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
# Object. |
274
|
|
|
|
|
|
|
my $statement1 = Wikibase::Datatype::MediainfoStatement->new( |
275
|
|
|
|
|
|
|
# depicts (P180) beach (Q40080) |
276
|
|
|
|
|
|
|
'snak' => Wikibase::Datatype::MediainfoSnak->new( |
277
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Item->new( |
278
|
|
|
|
|
|
|
'value' => 'Q40080', |
279
|
|
|
|
|
|
|
), |
280
|
|
|
|
|
|
|
'property' => 'P180', |
281
|
|
|
|
|
|
|
), |
282
|
|
|
|
|
|
|
); |
283
|
|
|
|
|
|
|
my $statement2 = Wikibase::Datatype::MediainfoStatement->new( |
284
|
|
|
|
|
|
|
# creator (P170) |
285
|
|
|
|
|
|
|
'snak' => Wikibase::Datatype::MediainfoSnak->new( |
286
|
|
|
|
|
|
|
'property' => 'P170', |
287
|
|
|
|
|
|
|
'snaktype' => 'novalue', |
288
|
|
|
|
|
|
|
), |
289
|
|
|
|
|
|
|
'property_snaks' => [ |
290
|
|
|
|
|
|
|
# Wikimedia username (P4174): Lviatour |
291
|
|
|
|
|
|
|
Wikibase::Datatype::MediainfoSnak->new( |
292
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::String->new( |
293
|
|
|
|
|
|
|
'value' => 'Lviatour', |
294
|
|
|
|
|
|
|
), |
295
|
|
|
|
|
|
|
'property' => 'P4174', |
296
|
|
|
|
|
|
|
), |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
# URL (P2699): https://commons.wikimedia.org/wiki/user:Lviatour |
299
|
|
|
|
|
|
|
Wikibase::Datatype::MediainfoSnak->new( |
300
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::String->new( |
301
|
|
|
|
|
|
|
'value' => 'https://commons.wikimedia.org/wiki/user:Lviatour', |
302
|
|
|
|
|
|
|
), |
303
|
|
|
|
|
|
|
'property' => 'P2699', |
304
|
|
|
|
|
|
|
), |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
# author name string (P2093): Lviatour |
307
|
|
|
|
|
|
|
Wikibase::Datatype::MediainfoSnak->new( |
308
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::String->new( |
309
|
|
|
|
|
|
|
'value' => 'Lviatour', |
310
|
|
|
|
|
|
|
), |
311
|
|
|
|
|
|
|
'property' => 'P2093', |
312
|
|
|
|
|
|
|
), |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
# object has role (P3831): photographer (Q33231) |
315
|
|
|
|
|
|
|
Wikibase::Datatype::MediainfoSnak->new( |
316
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Item->new( |
317
|
|
|
|
|
|
|
'value' => 'Q33231', |
318
|
|
|
|
|
|
|
), |
319
|
|
|
|
|
|
|
'property' => 'P3831', |
320
|
|
|
|
|
|
|
), |
321
|
|
|
|
|
|
|
], |
322
|
|
|
|
|
|
|
); |
323
|
|
|
|
|
|
|
my $statement3 = Wikibase::Datatype::MediainfoStatement->new( |
324
|
|
|
|
|
|
|
# copyright status (P6216) copyrighted (Q50423863) |
325
|
|
|
|
|
|
|
'snak' => Wikibase::Datatype::MediainfoSnak->new( |
326
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Item->new( |
327
|
|
|
|
|
|
|
'value' => 'Q50423863', |
328
|
|
|
|
|
|
|
), |
329
|
|
|
|
|
|
|
'property' => 'P6216', |
330
|
|
|
|
|
|
|
), |
331
|
|
|
|
|
|
|
); |
332
|
|
|
|
|
|
|
my $statement4 = Wikibase::Datatype::MediainfoStatement->new( |
333
|
|
|
|
|
|
|
# copyright license (P275) Creative Commons Attribution-ShareAlike 3.0 Unported (Q14946043) |
334
|
|
|
|
|
|
|
'snak' => Wikibase::Datatype::MediainfoSnak->new( |
335
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Item->new( |
336
|
|
|
|
|
|
|
'value' => 'Q14946043', |
337
|
|
|
|
|
|
|
), |
338
|
|
|
|
|
|
|
'property' => 'P275', |
339
|
|
|
|
|
|
|
), |
340
|
|
|
|
|
|
|
); |
341
|
|
|
|
|
|
|
my $statement5 = Wikibase::Datatype::MediainfoStatement->new( |
342
|
|
|
|
|
|
|
# Commons quality assessment (P6731) Wikimedia Commons featured picture (Q63348049) |
343
|
|
|
|
|
|
|
'snak' => Wikibase::Datatype::MediainfoSnak->new( |
344
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Item->new( |
345
|
|
|
|
|
|
|
'value' => 'Q63348049', |
346
|
|
|
|
|
|
|
), |
347
|
|
|
|
|
|
|
'property' => 'P6731', |
348
|
|
|
|
|
|
|
), |
349
|
|
|
|
|
|
|
); |
350
|
|
|
|
|
|
|
my $statement6 = Wikibase::Datatype::MediainfoStatement->new( |
351
|
|
|
|
|
|
|
# inception (P571) 16. 7. 2011 |
352
|
|
|
|
|
|
|
'snak' => Wikibase::Datatype::MediainfoSnak->new( |
353
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Time->new( |
354
|
|
|
|
|
|
|
'value' => '+2011-07-16T00:00:00Z', |
355
|
|
|
|
|
|
|
), |
356
|
|
|
|
|
|
|
'property' => 'P571', |
357
|
|
|
|
|
|
|
), |
358
|
|
|
|
|
|
|
); |
359
|
|
|
|
|
|
|
my $statement7 = Wikibase::Datatype::MediainfoStatement->new( |
360
|
|
|
|
|
|
|
# source of file (P7482) original creation by uploader (Q66458942) |
361
|
|
|
|
|
|
|
'snak' => Wikibase::Datatype::MediainfoSnak->new( |
362
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Item->new( |
363
|
|
|
|
|
|
|
'value' => 'Q66458942', |
364
|
|
|
|
|
|
|
), |
365
|
|
|
|
|
|
|
'property' => 'P7482', |
366
|
|
|
|
|
|
|
), |
367
|
|
|
|
|
|
|
); |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
# Main mediainfo. |
370
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Mediainfo->new( |
371
|
|
|
|
|
|
|
'id' => 'M16041229', |
372
|
|
|
|
|
|
|
'labels' => [ |
373
|
|
|
|
|
|
|
Wikibase::Datatype::Value::Monolingual->new( |
374
|
|
|
|
|
|
|
'language' => 'cs', |
375
|
|
|
|
|
|
|
'value' => decode_utf8('Pláž Papagayo, ostrov Lanzarote, Kanárské ostrovy, Španělsko'), |
376
|
|
|
|
|
|
|
), |
377
|
|
|
|
|
|
|
], |
378
|
|
|
|
|
|
|
'lastrevid' => 528085091, |
379
|
|
|
|
|
|
|
'modified' => '2021-01-24T11:44:10Z', |
380
|
|
|
|
|
|
|
'page_id' => 16041229, |
381
|
|
|
|
|
|
|
'statements' => [ |
382
|
|
|
|
|
|
|
$statement1, |
383
|
|
|
|
|
|
|
$statement2, |
384
|
|
|
|
|
|
|
$statement3, |
385
|
|
|
|
|
|
|
$statement4, |
386
|
|
|
|
|
|
|
$statement5, |
387
|
|
|
|
|
|
|
$statement6, |
388
|
|
|
|
|
|
|
$statement7, |
389
|
|
|
|
|
|
|
], |
390
|
|
|
|
|
|
|
'title' => 'File:Lanzarote 1 Luc Viatour.jpg', |
391
|
|
|
|
|
|
|
); |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
# Print out. |
394
|
|
|
|
|
|
|
print "Title: ".$obj->title."\n"; |
395
|
|
|
|
|
|
|
print 'Id: '.$obj->id."\n"; |
396
|
|
|
|
|
|
|
print 'Page id: '.$obj->page_id."\n"; |
397
|
|
|
|
|
|
|
print 'Modified: '.$obj->modified."\n"; |
398
|
|
|
|
|
|
|
print 'Last revision id: '.$obj->lastrevid."\n"; |
399
|
|
|
|
|
|
|
print "Labels:\n"; |
400
|
|
|
|
|
|
|
foreach my $label (sort { $a->language cmp $b->language } @{$obj->labels}) { |
401
|
|
|
|
|
|
|
print "\t".encode_utf8($label->value).' ('.$label->language.")\n"; |
402
|
|
|
|
|
|
|
} |
403
|
|
|
|
|
|
|
print "Statements:\n"; |
404
|
|
|
|
|
|
|
foreach my $statement (@{$obj->statements}) { |
405
|
|
|
|
|
|
|
print "\t".$statement->snak->property.' -> '; |
406
|
|
|
|
|
|
|
if ($statement->snak->snaktype eq 'value') { |
407
|
|
|
|
|
|
|
print $statement->snak->datavalue->value."\n"; |
408
|
|
|
|
|
|
|
} elsif ($statement->snak->snaktype eq 'novalue') { |
409
|
|
|
|
|
|
|
print "-\n"; |
410
|
|
|
|
|
|
|
} elsif ($statement->snak->snaktype eq 'somevalue') { |
411
|
|
|
|
|
|
|
print "?\n"; |
412
|
|
|
|
|
|
|
} |
413
|
|
|
|
|
|
|
if (@{$statement->property_snaks}) { |
414
|
|
|
|
|
|
|
print "\t\tQualifers:\n"; |
415
|
|
|
|
|
|
|
foreach my $property_snak (@{$statement->property_snaks}) { |
416
|
|
|
|
|
|
|
print "\t\t\t".$property_snak->property.' -> '. |
417
|
|
|
|
|
|
|
$property_snak->datavalue->value."\n"; |
418
|
|
|
|
|
|
|
} |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
} |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
# Output: |
423
|
|
|
|
|
|
|
# Title: File:Lanzarote 1 Luc Viatour.jpg |
424
|
|
|
|
|
|
|
# Id: M16041229 |
425
|
|
|
|
|
|
|
# Page id: 16041229 |
426
|
|
|
|
|
|
|
# Modified: 2021-01-24T11:44:10Z |
427
|
|
|
|
|
|
|
# Last revision id: 528085091 |
428
|
|
|
|
|
|
|
# Labels: |
429
|
|
|
|
|
|
|
# Pláž Papagayo, ostrov Lanzarote, Kanárské ostrovy, Španělsko (cs) |
430
|
|
|
|
|
|
|
# Statements: |
431
|
|
|
|
|
|
|
# P180 -> Q40080 |
432
|
|
|
|
|
|
|
# P170 -> - |
433
|
|
|
|
|
|
|
# Qualifers: |
434
|
|
|
|
|
|
|
# P4174 -> Lviatour |
435
|
|
|
|
|
|
|
# P2699 -> https://commons.wikimedia.org/wiki/user:Lviatour |
436
|
|
|
|
|
|
|
# P2093 -> Lviatour |
437
|
|
|
|
|
|
|
# P3831 -> Q33231 |
438
|
|
|
|
|
|
|
# P6216 -> Q50423863 |
439
|
|
|
|
|
|
|
# P275 -> Q14946043 |
440
|
|
|
|
|
|
|
# P6731 -> Q63348049 |
441
|
|
|
|
|
|
|
# P571 -> +2011-07-16T00:00:00Z |
442
|
|
|
|
|
|
|
# P7482 -> Q66458942 |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
L<Error::Pure>, |
447
|
|
|
|
|
|
|
L<Mo>, |
448
|
|
|
|
|
|
|
L<Mo:utils>. |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
=head1 SEE ALSO |
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
=over |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=item L<Wikibase::Datatype> |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
Wikibase datatypes. |
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
=back |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
=head1 REPOSITORY |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
L<https://github.com/michal-josef-spacek/Wikibase-Datatype> |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
=head1 AUTHOR |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
Michal Josef Špaček L<mailto:skim@cpan.org> |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
L<http://skim.cz> |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
© 2020-2023 Michal Josef Špaček |
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
BSD 2-Clause License |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
=head1 VERSION |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
0.29 |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
=cut |