File Coverage

blib/lib/Lingua/Ogmios/Annotations/MorphosyntacticFeatures.pm
Criterion Covered Total %
statement 9 81 11.1
branch 0 40 0.0
condition 0 3 0.0
subroutine 3 18 16.6
pod 0 15 0.0
total 12 157 7.6


line stmt bran cond sub pod time code
1             package Lingua::Ogmios::Annotations::MorphosyntacticFeatures;
2              
3 16     16   66 use strict;
  16         21  
  16         551  
4 16     16   63 use warnings;
  16         22  
  16         398  
5              
6 16     16   67 use Lingua::Ogmios::Annotations::Element;
  16         21  
  16         10662  
7             our @ISA = qw(Lingua::Ogmios::Annotations::Element);
8              
9             #
10             #
11             #
12            
13             #
14             # (log_id?, comments*,
15             # morphosyntactic_features+) >
16            
17             #
18             #
19             # (id, log_id?, (refid_word |
20             # refid_phrase), syntactic_category,
21             # category?, type?, gender?, number?,
22             # case?, mood_vform?, tense?,
23             # person?, degree?, possessor?,
24             # formation?, form?) >
25              
26             #
27             #
31             #
32             # (#PCDATA) >
33              
34             #
35             #
38             #
39             # (#PCDATA) >
40              
41             #
42             #
45             #
46             # (#PCDATA) >
47              
48             #
49             #
51             #
52              
53             #
54             #
55             #
56              
57             #
58             #
59             #
60              
61             #
62             #
64             #
65              
66             #
67             #
69             #
70              
71             #
72             #
74             #
75              
76             #
77             #
78             #
79              
80             #
81             #
82              
83             #
84             #
85             #
90             #
91             # (#PCDATA) >
92            
93             sub new {
94 0     0 0   my ($class, $fields) = @_;
95              
96 0 0         if (!defined $fields->{'id'}) {
97 0           $fields->{'id'} = -1;
98             }
99              
100 0 0         if (!defined $fields->{'syntactic_category'}) { # syntactic_category
101 0           die("syntactic_category is not defined");
102             }
103              
104 0           my $morphosyntacticfeatures = $class->SUPER::new({
105             'id' => $fields->{'id'},
106             # 'form' => $fields->{'form'},
107             }
108             );
109 0           bless ($morphosyntacticfeatures, $class);
110              
111              
112 0           $morphosyntacticfeatures->syntactic_category($fields->{'syntactic_category'});
113              
114 0           my $i = 0;
115 0           my $reference_name;
116             my $ref;
117 0           foreach $ref ('refid_phrase', 'refid_word') {
118 0 0         if (defined $fields->{$ref}) {
119 0           $reference_name = $ref;
120 0           last;
121             }
122 0           $i++;
123             }
124 0 0         if ($i == 2) {
125 0           die("reference (list) is not defined");
126             }
127              
128 0           $morphosyntacticfeatures->reference($reference_name, $fields->{$reference_name});
129              
130 0           my $field;
131 0           foreach $field ('type', 'gender', 'number', 'case', 'mood_vfrom', 'tense', 'person', 'degree', 'possessor', 'formation') {
132 0 0         if (defined $fields->{$field}) {
133 0           $morphosyntacticfeatures->_setField($fields->{$field});
134             }
135             }
136              
137 0 0         if (defined $fields->{'form'}) {
138 0           $morphosyntacticfeatures->setForm($fields->{'form'});
139             }
140              
141 0 0         if (defined $fields->{'log_id'}) {
142 0           $morphosyntacticfeatures->setLogId($fields->{'log_id'});
143             }
144 0           return($morphosyntacticfeatures);
145             }
146              
147             sub type {
148 0     0 0   my $self = shift;
149              
150 0 0         $self->{'type'} = shift if @_;
151 0           return($self->{'type'});
152             }
153              
154             sub category {
155 0     0 0   my $self = shift;
156              
157 0 0         $self->{'category'} = shift if @_;
158 0           return($self->{'category'});
159             }
160              
161             sub syntactic_category {
162 0     0 0   my $self = shift;
163              
164 0 0         $self->{'syntactic_category'} = shift if @_;
165 0           return($self->{'syntactic_category'});
166             }
167              
168             sub gender {
169 0     0 0   my $self = shift;
170              
171 0 0         $self->{'gender'} = shift if @_;
172 0           return($self->{'gender'});
173             }
174              
175             sub number {
176 0     0 0   my $self = shift;
177              
178 0 0         $self->{'number'} = shift if @_;
179 0           return($self->{'number'});
180             }
181              
182             sub case {
183 0     0 0   my $self = shift;
184              
185 0 0         $self->{'case'} = shift if @_;
186 0           return($self->{'case'});
187             }
188              
189             sub mood_vform {
190 0     0 0   my $self = shift;
191              
192 0 0         $self->{'mood_vform'} = shift if @_;
193 0           return($self->{'mood_vform'});
194             }
195              
196             sub tense {
197 0     0 0   my $self = shift;
198              
199 0 0         $self->{'tense'} = shift if @_;
200 0           return($self->{'tense'});
201             }
202              
203             sub person {
204 0     0 0   my $self = shift;
205              
206 0 0         $self->{'person'} = shift if @_;
207 0           return($self->{'person'});
208             }
209              
210             sub degree {
211 0     0 0   my $self = shift;
212              
213 0 0         $self->{'degree'} = shift if @_;
214 0           return($self->{'degree'});
215             }
216              
217             sub possessor {
218 0     0 0   my $self = shift;
219              
220 0 0         $self->{'possessor'} = shift if @_;
221 0           return($self->{'possessor'});
222             }
223              
224             sub formation {
225 0     0 0   my $self = shift;
226              
227 0 0         $self->{'formation'} = shift if @_;
228 0           return($self->{'formation'});
229             }
230              
231             sub reference {
232 0     0 0   my $self = shift;
233 0           my $ref;
234             my $elt;
235              
236 0 0 0       if ((@_) && (scalar @_ == 2)) {
237 0           $self->{'reference'} = shift;
238             # $self->{$self->{'reference'}} = [];
239 0           $ref = shift;
240 0           $self->{$self->{'reference'}} = $ref;
241             # foreach $elt (@$ref) {
242             # push @{$self->{$self->{'reference'}}}, $elt;
243             # }
244             }
245 0           return($self->{$self->{'reference'}});
246             }
247              
248              
249             sub XMLout {
250 0     0 0   my ($self, $order) = @_;
251            
252 0           return($self->SUPER::XMLout("morphosyntactic_features", $order));
253             }
254              
255             1;
256              
257             __END__