line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wikibase::Datatype::Lexeme; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
228820
|
use strict; |
|
18
|
|
|
|
|
57
|
|
|
18
|
|
|
|
|
502
|
|
4
|
18
|
|
|
18
|
|
99
|
use warnings; |
|
18
|
|
|
|
|
36
|
|
|
18
|
|
|
|
|
500
|
|
5
|
|
|
|
|
|
|
|
6
|
18
|
|
|
18
|
|
8052
|
use Error::Pure qw(err); |
|
18
|
|
|
|
|
209460
|
|
|
18
|
|
|
|
|
351
|
|
7
|
18
|
|
|
18
|
|
9090
|
use Mo qw(build default is); |
|
18
|
|
|
|
|
9312
|
|
|
18
|
|
|
|
|
98
|
|
8
|
18
|
|
|
18
|
|
49162
|
use Mo::utils qw(check_array_object check_number); |
|
18
|
|
|
|
|
26735
|
|
|
18
|
|
|
|
|
308
|
|
9
|
18
|
|
|
18
|
|
9358
|
use Wikibase::Datatype::Utils qw(check_entity); |
|
18
|
|
|
|
|
92
|
|
|
18
|
|
|
|
|
513
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.29; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has forms => ( |
14
|
|
|
|
|
|
|
default => [], |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has id => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has language => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has lastrevid => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has lemmas => ( |
31
|
|
|
|
|
|
|
default => [], |
32
|
|
|
|
|
|
|
is => 'ro', |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has lexical_category => ( |
36
|
|
|
|
|
|
|
is => 'ro', |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has modified => ( |
40
|
|
|
|
|
|
|
is => 'ro', |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has ns => ( |
44
|
|
|
|
|
|
|
default => 146, |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has page_id => ( |
49
|
|
|
|
|
|
|
is => 'ro', |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
has senses => ( |
53
|
|
|
|
|
|
|
default => [], |
54
|
|
|
|
|
|
|
is => 'ro', |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has statements => ( |
58
|
|
|
|
|
|
|
default => [], |
59
|
|
|
|
|
|
|
is => 'ro', |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
has title => ( |
63
|
|
|
|
|
|
|
is => 'ro', |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub BUILD { |
67
|
27
|
|
|
27
|
0
|
3253
|
my $self = shift; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# Check forms. |
70
|
27
|
|
|
|
|
128
|
check_array_object($self, 'forms', 'Wikibase::Datatype::Form', |
71
|
|
|
|
|
|
|
'Form'); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Check lemmas. |
74
|
27
|
|
|
|
|
702
|
check_array_object($self, 'lemmas', 'Wikibase::Datatype::Value::Monolingual', |
75
|
|
|
|
|
|
|
'Lemma'); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# Check lexical category. |
78
|
27
|
|
|
|
|
442
|
check_entity($self, 'lexical_category'); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Check language. |
81
|
27
|
|
|
|
|
98
|
check_entity($self, 'language'); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Check page id. |
84
|
27
|
|
|
|
|
138
|
check_number($self, 'page_id'); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Check senses. |
87
|
27
|
|
|
|
|
522
|
check_array_object($self, 'senses', 'Wikibase::Datatype::Sense', |
88
|
|
|
|
|
|
|
'Sense'); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# Check statements. |
91
|
27
|
|
|
|
|
476
|
check_array_object($self, 'statements', 'Wikibase::Datatype::Statement', |
92
|
|
|
|
|
|
|
'Statement'); |
93
|
|
|
|
|
|
|
|
94
|
27
|
|
|
|
|
411
|
return; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=pod |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=encoding utf8 |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 NAME |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Wikibase::Datatype::Lexeme - Wikibase lexeme datatype. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 SYNOPSIS |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
use Wikibase::Datatype::Lexeme; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Lexeme->new(%params); |
114
|
|
|
|
|
|
|
my $forms_ar = $obj->forms; |
115
|
|
|
|
|
|
|
my $id = $obj->id; |
116
|
|
|
|
|
|
|
my $language = $obj->language; |
117
|
|
|
|
|
|
|
my $lastrevid = $obj->lastrevid; |
118
|
|
|
|
|
|
|
my $lemmas_ar = $obj->lemmas; |
119
|
|
|
|
|
|
|
my $lexical_category = $obj->lexical_category; |
120
|
|
|
|
|
|
|
my $modified = $obj->modified; |
121
|
|
|
|
|
|
|
my $ns = $obj->ns; |
122
|
|
|
|
|
|
|
my $page_id = $obj->page_id; |
123
|
|
|
|
|
|
|
my $senses_ar = $obj->senses; |
124
|
|
|
|
|
|
|
my $statements_ar = $obj->statements; |
125
|
|
|
|
|
|
|
my $title = $obj->title; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 DESCRIPTION |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This datatype is item class for representing claim. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 METHODS |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 C<new> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Lexeme->new(%params); |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Constructor. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Returns instance of object. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=over 8 |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * C<forms> |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Forms. |
146
|
|
|
|
|
|
|
Reference to array with Wikibase::Datatype::Form instances. |
147
|
|
|
|
|
|
|
Parameter is optional. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item * C<id> |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Id. |
152
|
|
|
|
|
|
|
Parameter is optional. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item * C<language> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Language. Link to QID. |
157
|
|
|
|
|
|
|
Parameter is optional. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * C<lastrevid> |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Last revision ID. |
162
|
|
|
|
|
|
|
Parameter is optional. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * C<lemmas> |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Lemmas. |
167
|
|
|
|
|
|
|
Reference to array with Wikibase::Datatype::Value::Monolingual instances. |
168
|
|
|
|
|
|
|
Parameter is optional. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item * C<lexical_category> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Lexical category. Link to QID. |
173
|
|
|
|
|
|
|
Parameter is optional. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item * C<modified> |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Date of modification. |
178
|
|
|
|
|
|
|
Parameter is optional. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * C<ns> |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Namespace. |
183
|
|
|
|
|
|
|
Default value is 146. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=item * C<page_id> |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
Page id. Numeric value. |
188
|
|
|
|
|
|
|
Parameter is optional. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item * C<senses> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Senses. |
193
|
|
|
|
|
|
|
Reference to array with Wikibase::Datatype::Sense instances. |
194
|
|
|
|
|
|
|
Parameter is optional. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item * C<statements> |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Item statements. |
199
|
|
|
|
|
|
|
Reference to array with Wikibase::Datatype::Statement instances. |
200
|
|
|
|
|
|
|
Parameter is optional. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item * C<title> |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Lexeme title. |
205
|
|
|
|
|
|
|
Parameter is optional. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=back |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head2 C<forms> |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
my $forms_ar = $obj->forms; |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Get forms. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Returns reference to array with Wikibase::Datatype::Form instances. |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head2 C<id> |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
my $id = $obj->id; |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
Get id. |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Returns string. |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=head2 C<language> |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
my $language = $obj->language; |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
Get language. |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Returns string with QID. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head2 C<lastrevid> |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
my $lastrevid = $obj->lastrevid; |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
Get last revision ID. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Returns string. |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=head2 C<lemmas> |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
my $lemmas_ar = $obj->lemmas; |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
Get lemmas. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
Returns reference to array with Wikibase::Datatype::Value::Monolingual instances. |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=head2 C<lexical_category> |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
my $lexical_category = $obj->lexical_category; |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
Get lexical category. |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
Returns string with QID. |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=head2 C<modified> |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
my $modified = $obj->modified; |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
Get date of modification. |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
Returns string. |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=head2 C<ns> |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
my $ns = $obj->ns; |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
Get namespace. |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
Returns number. |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=head2 C<page_id> |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
my $page_id = $obj->page_id; |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
Get page id. |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
Returns number. |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=head2 C<senses> |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
my $senses_ar = $obj->senses; |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
Get senses. |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
Returns reference to array with Wikibase::Datatype::Sense instances. |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=head2 C<statements> |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
my $statements_ar = $obj->statements; |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
Get statements. |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
Returns reference to array with Wikibase::Datatype::Statement instances. |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=head2 C<title> |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
my $title = $obj->title; |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
Get title. |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
Returns string. |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=head1 ERRORS |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
new(): |
308
|
|
|
|
|
|
|
From Mo::utils::check_array_object(): |
309
|
|
|
|
|
|
|
Form isn't 'Wikibase::Datatype::Form' object. |
310
|
|
|
|
|
|
|
Lemma isn't 'Wikibase::Datatype::Value::Monolingual' object. |
311
|
|
|
|
|
|
|
Parameter 'forms' must be a array. |
312
|
|
|
|
|
|
|
Parameter 'lemmas' must be a array. |
313
|
|
|
|
|
|
|
Parameter 'senses' must be a array. |
314
|
|
|
|
|
|
|
Parameter 'statements' must be a array. |
315
|
|
|
|
|
|
|
Sense isn't 'Wikibase::Datatype::Sense' object. |
316
|
|
|
|
|
|
|
Statement isn't 'Wikibase::Datatype::Statement' object. |
317
|
|
|
|
|
|
|
From Wikibase::Datatype::Utils::check_entity(): |
318
|
|
|
|
|
|
|
Parameter 'language' must begin with 'Q' and number after it."; |
319
|
|
|
|
|
|
|
Parameter 'lexical_category' must begin with 'Q' and number after it."; |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=head1 EXAMPLE |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=for comment filename=create_and_print_lexeme.pl |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
use strict; |
326
|
|
|
|
|
|
|
use warnings; |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
use Wikibase::Datatype::Lexeme; |
329
|
|
|
|
|
|
|
use Wikibase::Datatype::Reference; |
330
|
|
|
|
|
|
|
use Wikibase::Datatype::Snak; |
331
|
|
|
|
|
|
|
use Wikibase::Datatype::Statement; |
332
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Item; |
333
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Monolingual; |
334
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::String; |
335
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Time; |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
# Statements. |
338
|
|
|
|
|
|
|
my $statement1 = Wikibase::Datatype::Statement->new( |
339
|
|
|
|
|
|
|
# instance of (P31) human (Q5) |
340
|
|
|
|
|
|
|
'snak' => Wikibase::Datatype::Snak->new( |
341
|
|
|
|
|
|
|
'datatype' => 'wikibase-item', |
342
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Item->new( |
343
|
|
|
|
|
|
|
'value' => 'Q5', |
344
|
|
|
|
|
|
|
), |
345
|
|
|
|
|
|
|
'property' => 'P31', |
346
|
|
|
|
|
|
|
), |
347
|
|
|
|
|
|
|
'property_snaks' => [ |
348
|
|
|
|
|
|
|
# of (P642) alien (Q474741) |
349
|
|
|
|
|
|
|
Wikibase::Datatype::Snak->new( |
350
|
|
|
|
|
|
|
'datatype' => 'wikibase-item', |
351
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Item->new( |
352
|
|
|
|
|
|
|
'value' => 'Q474741', |
353
|
|
|
|
|
|
|
), |
354
|
|
|
|
|
|
|
'property' => 'P642', |
355
|
|
|
|
|
|
|
), |
356
|
|
|
|
|
|
|
], |
357
|
|
|
|
|
|
|
'references' => [ |
358
|
|
|
|
|
|
|
Wikibase::Datatype::Reference->new( |
359
|
|
|
|
|
|
|
'snaks' => [ |
360
|
|
|
|
|
|
|
# stated in (P248) Virtual International Authority File (Q53919) |
361
|
|
|
|
|
|
|
Wikibase::Datatype::Snak->new( |
362
|
|
|
|
|
|
|
'datatype' => 'wikibase-item', |
363
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Item->new( |
364
|
|
|
|
|
|
|
'value' => 'Q53919', |
365
|
|
|
|
|
|
|
), |
366
|
|
|
|
|
|
|
'property' => 'P248', |
367
|
|
|
|
|
|
|
), |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
# VIAF ID (P214) 113230702 |
370
|
|
|
|
|
|
|
Wikibase::Datatype::Snak->new( |
371
|
|
|
|
|
|
|
'datatype' => 'external-id', |
372
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::String->new( |
373
|
|
|
|
|
|
|
'value' => '113230702', |
374
|
|
|
|
|
|
|
), |
375
|
|
|
|
|
|
|
'property' => 'P214', |
376
|
|
|
|
|
|
|
), |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
# retrieved (P813) 7 December 2013 |
379
|
|
|
|
|
|
|
Wikibase::Datatype::Snak->new( |
380
|
|
|
|
|
|
|
'datatype' => 'time', |
381
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Time->new( |
382
|
|
|
|
|
|
|
'value' => '+2013-12-07T00:00:00Z', |
383
|
|
|
|
|
|
|
), |
384
|
|
|
|
|
|
|
'property' => 'P813', |
385
|
|
|
|
|
|
|
), |
386
|
|
|
|
|
|
|
], |
387
|
|
|
|
|
|
|
), |
388
|
|
|
|
|
|
|
], |
389
|
|
|
|
|
|
|
); |
390
|
|
|
|
|
|
|
my $statement2 = Wikibase::Datatype::Statement->new( |
391
|
|
|
|
|
|
|
# sex or gender (P21) male (Q6581097) |
392
|
|
|
|
|
|
|
'snak' => Wikibase::Datatype::Snak->new( |
393
|
|
|
|
|
|
|
'datatype' => 'wikibase-item', |
394
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Item->new( |
395
|
|
|
|
|
|
|
'value' => 'Q6581097', |
396
|
|
|
|
|
|
|
), |
397
|
|
|
|
|
|
|
'property' => 'P21', |
398
|
|
|
|
|
|
|
), |
399
|
|
|
|
|
|
|
'references' => [ |
400
|
|
|
|
|
|
|
Wikibase::Datatype::Reference->new( |
401
|
|
|
|
|
|
|
'snaks' => [ |
402
|
|
|
|
|
|
|
# stated in (P248) Virtual International Authority File (Q53919) |
403
|
|
|
|
|
|
|
Wikibase::Datatype::Snak->new( |
404
|
|
|
|
|
|
|
'datatype' => 'wikibase-item', |
405
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Item->new( |
406
|
|
|
|
|
|
|
'value' => 'Q53919', |
407
|
|
|
|
|
|
|
), |
408
|
|
|
|
|
|
|
'property' => 'P248', |
409
|
|
|
|
|
|
|
), |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
# VIAF ID (P214) 113230702 |
412
|
|
|
|
|
|
|
Wikibase::Datatype::Snak->new( |
413
|
|
|
|
|
|
|
'datatype' => 'external-id', |
414
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::String->new( |
415
|
|
|
|
|
|
|
'value' => '113230702', |
416
|
|
|
|
|
|
|
), |
417
|
|
|
|
|
|
|
'property' => 'P214', |
418
|
|
|
|
|
|
|
), |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
# retrieved (P813) 7 December 2013 |
421
|
|
|
|
|
|
|
Wikibase::Datatype::Snak->new( |
422
|
|
|
|
|
|
|
'datatype' => 'time', |
423
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::Time->new( |
424
|
|
|
|
|
|
|
'value' => '+2013-12-07T00:00:00Z', |
425
|
|
|
|
|
|
|
), |
426
|
|
|
|
|
|
|
'property' => 'P813', |
427
|
|
|
|
|
|
|
), |
428
|
|
|
|
|
|
|
], |
429
|
|
|
|
|
|
|
), |
430
|
|
|
|
|
|
|
], |
431
|
|
|
|
|
|
|
); |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
# Object. |
434
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Lexeme->new( |
435
|
|
|
|
|
|
|
'id' => 'L469', |
436
|
|
|
|
|
|
|
'lemmas' => [ |
437
|
|
|
|
|
|
|
Wikibase::Datatype::Value::Monolingual->new( |
438
|
|
|
|
|
|
|
'language' => 'cs', |
439
|
|
|
|
|
|
|
'value' => 'pes', |
440
|
|
|
|
|
|
|
), |
441
|
|
|
|
|
|
|
], |
442
|
|
|
|
|
|
|
'statements' => [ |
443
|
|
|
|
|
|
|
$statement1, |
444
|
|
|
|
|
|
|
$statement2, |
445
|
|
|
|
|
|
|
], |
446
|
|
|
|
|
|
|
'title' => 'Lexeme:L469', |
447
|
|
|
|
|
|
|
); |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
# Print out. |
450
|
|
|
|
|
|
|
print "Title: ".$obj->title."\n"; |
451
|
|
|
|
|
|
|
print 'Id: '.$obj->id."\n"; |
452
|
|
|
|
|
|
|
print "Statements:\n"; |
453
|
|
|
|
|
|
|
foreach my $statement (@{$obj->statements}) { |
454
|
|
|
|
|
|
|
print "\tStatement:\n"; |
455
|
|
|
|
|
|
|
print "\t\t".$statement->snak->property.' -> '.$statement->snak->datavalue->value."\n"; |
456
|
|
|
|
|
|
|
print "\t\tQualifers:\n"; |
457
|
|
|
|
|
|
|
foreach my $property_snak (@{$statement->property_snaks}) { |
458
|
|
|
|
|
|
|
print "\t\t\t".$property_snak->property.' -> '. |
459
|
|
|
|
|
|
|
$property_snak->datavalue->value."\n"; |
460
|
|
|
|
|
|
|
} |
461
|
|
|
|
|
|
|
print "\t\tReferences:\n"; |
462
|
|
|
|
|
|
|
foreach my $reference (@{$statement->references}) { |
463
|
|
|
|
|
|
|
print "\t\t\tReference:\n"; |
464
|
|
|
|
|
|
|
foreach my $reference_snak (@{$reference->snaks}) { |
465
|
|
|
|
|
|
|
print "\t\t\t".$reference_snak->property.' -> '. |
466
|
|
|
|
|
|
|
$reference_snak->datavalue->value."\n"; |
467
|
|
|
|
|
|
|
} |
468
|
|
|
|
|
|
|
} |
469
|
|
|
|
|
|
|
} |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
# Output: |
472
|
|
|
|
|
|
|
# Title: Lexeme:L469 |
473
|
|
|
|
|
|
|
# Id: L469 |
474
|
|
|
|
|
|
|
# Statements: |
475
|
|
|
|
|
|
|
# Statement: |
476
|
|
|
|
|
|
|
# P31 -> Q5 |
477
|
|
|
|
|
|
|
# Qualifers: |
478
|
|
|
|
|
|
|
# P642 -> Q474741 |
479
|
|
|
|
|
|
|
# References: |
480
|
|
|
|
|
|
|
# Reference: |
481
|
|
|
|
|
|
|
# P248 -> Q53919 |
482
|
|
|
|
|
|
|
# P214 -> 113230702 |
483
|
|
|
|
|
|
|
# P813 -> +2013-12-07T00:00:00Z |
484
|
|
|
|
|
|
|
# Statement: |
485
|
|
|
|
|
|
|
# P21 -> Q6581097 |
486
|
|
|
|
|
|
|
# Qualifers: |
487
|
|
|
|
|
|
|
# References: |
488
|
|
|
|
|
|
|
# Reference: |
489
|
|
|
|
|
|
|
# P248 -> Q53919 |
490
|
|
|
|
|
|
|
# P214 -> 113230702 |
491
|
|
|
|
|
|
|
# P813 -> +2013-12-07T00:00:00Z |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
L<Error::Pure>, |
496
|
|
|
|
|
|
|
L<Mo>, |
497
|
|
|
|
|
|
|
L<Mo::utils>, |
498
|
|
|
|
|
|
|
L<Wikibase::Datatype::Utils>. |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
=head1 SEE ALSO |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
=over |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
=item L<Wikibase::Datatype> |
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
Wikibase datatypes. |
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
=back |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
=head1 REPOSITORY |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
L<https://github.com/michal-josef-spacek/Wikibase-Datatype> |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
=head1 AUTHOR |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
Michal Josef Špaček L<mailto:skim@cpan.org> |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
L<http://skim.cz> |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
© 2020-2023 Michal Josef Špaček |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
BSD 2-Clause License |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
=head1 VERSION |
527
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
0.29 |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
=cut |