| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Wikibase::Datatype::Form; |
|
2
|
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
1102769
|
use strict; |
|
|
26
|
|
|
|
|
60
|
|
|
|
26
|
|
|
|
|
1121
|
|
|
4
|
26
|
|
|
26
|
|
140
|
use warnings; |
|
|
26
|
|
|
|
|
56
|
|
|
|
26
|
|
|
|
|
1609
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
26
|
|
|
26
|
|
5356
|
use Mo qw(build default is); |
|
|
26
|
|
|
|
|
6884
|
|
|
|
26
|
|
|
|
|
228
|
|
|
7
|
26
|
|
|
26
|
|
41836
|
use Mo::utils::Array qw(check_array_object); |
|
|
26
|
|
|
|
|
176715
|
|
|
|
26
|
|
|
|
|
4285
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.39; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has grammatical_features => ( |
|
12
|
|
|
|
|
|
|
default => [], |
|
13
|
|
|
|
|
|
|
is => 'ro', |
|
14
|
|
|
|
|
|
|
); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has id => ( |
|
17
|
|
|
|
|
|
|
is => 'ro', |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has representations => ( |
|
21
|
|
|
|
|
|
|
default => [], |
|
22
|
|
|
|
|
|
|
is => 'ro', |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has statements => ( |
|
26
|
|
|
|
|
|
|
default => [], |
|
27
|
|
|
|
|
|
|
is => 'ro', |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub BUILD { |
|
31
|
34
|
|
|
34
|
0
|
1457579
|
my $self = shift; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Check grammatical features. |
|
34
|
34
|
|
|
|
|
195
|
check_array_object($self, 'grammatical_features', 'Wikibase::Datatype::Value::Item'); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Check representations. |
|
37
|
32
|
|
|
|
|
1335
|
check_array_object($self, 'representations', 'Wikibase::Datatype::Value::Monolingual'); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Check statements. |
|
40
|
30
|
|
|
|
|
709
|
check_array_object($self, 'statements', 'Wikibase::Datatype::Statement'); |
|
41
|
|
|
|
|
|
|
|
|
42
|
28
|
|
|
|
|
653
|
return; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=pod |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=encoding utf8 |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Wikibase::Datatype::Form - Wikibase form datatype. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
use Wikibase::Datatype::Form; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Form->new(%params); |
|
62
|
|
|
|
|
|
|
my $grammatical_features_ar = $obj->grammatical_features; |
|
63
|
|
|
|
|
|
|
my $id = $obj->id; |
|
64
|
|
|
|
|
|
|
my $representations_ar = $obj->representations; |
|
65
|
|
|
|
|
|
|
my $statements_ar = $obj->statements; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 METHODS |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 C<new> |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Form->new(%params); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Constructor. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Returns instance of object. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=over 8 |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * C<grammatical_features> |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Grammatical features. |
|
82
|
|
|
|
|
|
|
Items of array are Q items. |
|
83
|
|
|
|
|
|
|
Parameter is optional. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * C<id> |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Identifier of form. |
|
88
|
|
|
|
|
|
|
Parameter is optional. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * C<representations> |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Representations. |
|
93
|
|
|
|
|
|
|
Items of array are Wikibase::Datatype::Value::Monolingual items. |
|
94
|
|
|
|
|
|
|
Parameter is optional. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * C<statements> |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Statements. |
|
99
|
|
|
|
|
|
|
Items of array are Wikibase:Datatype::Statement items. |
|
100
|
|
|
|
|
|
|
Parameter is optional. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=back |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 C<grammatical_features> |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
my $grammatical_features_ar = $obj->grammatical_features; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Get grammatical features. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Returns reference to array of Q items. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 C<id> |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
my $id = $obj->id; |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Get form identifier. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Returns string. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 C<representations> |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
my $representations_ar = $obj->representations; |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Get representations. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Returns reference to array with Wikibase::Datatype::Value::Monolingual items. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 C<statements> |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
my $statements_ar = $obj->statements; |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Get statements. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Returns reference to array of Wikibase::Datatype::Statement items. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 ERRORS |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
new(): |
|
139
|
|
|
|
|
|
|
From Mo::utils::Array::check_array_object(): |
|
140
|
|
|
|
|
|
|
Parameter 'grammatical_features' must be a array. |
|
141
|
|
|
|
|
|
|
Value: %s |
|
142
|
|
|
|
|
|
|
Reference: %s |
|
143
|
|
|
|
|
|
|
Parameter 'grammatical_features' with array must contain 'Wikibase::Datatype::Value::Item' objects. |
|
144
|
|
|
|
|
|
|
Value: %s |
|
145
|
|
|
|
|
|
|
Reference: %s |
|
146
|
|
|
|
|
|
|
Parameter 'representations' must be a array. |
|
147
|
|
|
|
|
|
|
Value: %s |
|
148
|
|
|
|
|
|
|
Reference: %s |
|
149
|
|
|
|
|
|
|
Parameter 'representations' with array must contain 'Wikibase::Datatype::Value::Monolingual' objects. |
|
150
|
|
|
|
|
|
|
Value: %s |
|
151
|
|
|
|
|
|
|
Reference: %s |
|
152
|
|
|
|
|
|
|
Parameter 'statements' must be a array. |
|
153
|
|
|
|
|
|
|
Value: %s |
|
154
|
|
|
|
|
|
|
Reference: %s |
|
155
|
|
|
|
|
|
|
Parameter 'statements' with array must contain 'Wikibase::Datatype::Statement' objects. |
|
156
|
|
|
|
|
|
|
Value: %s |
|
157
|
|
|
|
|
|
|
Reference: %s |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 EXAMPLE |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=for comment filename=create_and_print_form.pl |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
use strict; |
|
164
|
|
|
|
|
|
|
use warnings; |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
use Unicode::UTF8 qw(decode_utf8); |
|
167
|
|
|
|
|
|
|
use Wikibase::Datatype::Form; |
|
168
|
|
|
|
|
|
|
use Wikibase::Datatype::Snak; |
|
169
|
|
|
|
|
|
|
use Wikibase::Datatype::Statement; |
|
170
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Item; |
|
171
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::String; |
|
172
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Monolingual; |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
# Object. |
|
175
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Form->new( |
|
176
|
|
|
|
|
|
|
'grammatical_features' => [ |
|
177
|
|
|
|
|
|
|
# singular |
|
178
|
|
|
|
|
|
|
Wikibase::Datatype::Value::Item->new( |
|
179
|
|
|
|
|
|
|
'value' => 'Q110786', |
|
180
|
|
|
|
|
|
|
), |
|
181
|
|
|
|
|
|
|
# nominative case |
|
182
|
|
|
|
|
|
|
Wikibase::Datatype::Value::Item->new( |
|
183
|
|
|
|
|
|
|
'value' => 'Q131105', |
|
184
|
|
|
|
|
|
|
), |
|
185
|
|
|
|
|
|
|
], |
|
186
|
|
|
|
|
|
|
'id' => 'L469-F1', |
|
187
|
|
|
|
|
|
|
'representations' => [ |
|
188
|
|
|
|
|
|
|
Wikibase::Datatype::Value::Monolingual->new( |
|
189
|
|
|
|
|
|
|
'language' => 'cs', |
|
190
|
|
|
|
|
|
|
'value' => 'pes', |
|
191
|
|
|
|
|
|
|
), |
|
192
|
|
|
|
|
|
|
], |
|
193
|
|
|
|
|
|
|
'statements' => [ |
|
194
|
|
|
|
|
|
|
Wikibase::Datatype::Statement->new( |
|
195
|
|
|
|
|
|
|
'snak' => Wikibase::Datatype::Snak->new( |
|
196
|
|
|
|
|
|
|
'datatype' => 'string', |
|
197
|
|
|
|
|
|
|
'datavalue' => Wikibase::Datatype::Value::String->new( |
|
198
|
|
|
|
|
|
|
'value' => decode_utf8('pɛs'), |
|
199
|
|
|
|
|
|
|
), |
|
200
|
|
|
|
|
|
|
'property' => 'P898', |
|
201
|
|
|
|
|
|
|
), |
|
202
|
|
|
|
|
|
|
), |
|
203
|
|
|
|
|
|
|
], |
|
204
|
|
|
|
|
|
|
); |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
# Get id. |
|
207
|
|
|
|
|
|
|
my $id = $obj->id; |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
# Get counts. |
|
210
|
|
|
|
|
|
|
my $gr_count = @{$obj->grammatical_features}; |
|
211
|
|
|
|
|
|
|
my $re_count = @{$obj->representations}; |
|
212
|
|
|
|
|
|
|
my $st_count = @{$obj->statements}; |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
# Print out. |
|
215
|
|
|
|
|
|
|
print "Id: $id\n"; |
|
216
|
|
|
|
|
|
|
print "Number of grammatical features: $gr_count\n"; |
|
217
|
|
|
|
|
|
|
print "Number of representations: $re_count\n"; |
|
218
|
|
|
|
|
|
|
print "Number of statements: $st_count\n"; |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
# Output: |
|
221
|
|
|
|
|
|
|
# Id: L469-F1 |
|
222
|
|
|
|
|
|
|
# Number of grammatical features: 2 |
|
223
|
|
|
|
|
|
|
# Number of representations: 1 |
|
224
|
|
|
|
|
|
|
# Number of statements: 1 |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
L<Mo>, |
|
229
|
|
|
|
|
|
|
L<Mo::utils::Array>. |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=over |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=item L<Wikibase::Datatype> |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
Wikibase datatypes. |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=back |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=head1 REPOSITORY |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
L<https://github.com/michal-josef-spacek/Wikibase-Datatype> |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=head1 AUTHOR |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
Michal Josef Špaček L<mailto:skim@cpan.org> |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
L<http://skim.cz> |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
© 2020-2025 Michal Josef Špaček |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
BSD 2-Clause License |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=head1 VERSION |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
0.39 |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=cut |