blib/lib/Lingua/Ogmios/Annotations/SyntacticRelation.pm

filter: Statementstmt 14.4% 11 / 76 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 27.2% 3 / 11 Podpod 0.0% 0 / 8 totaltotal 10.8% 14 / 129 CC 17 SCAR 38.1
CC
17
Cov
10%
new
110.0
refid_head
12.0
refid_modifier
12.0
CRAP 45.0
« blib/lib/Lingua/Ogmios/NLPWrappers/Faster.pm ↑ Summary blib/lib/Lingua/Ogmios/Annotations/SemanticUnit.pm »
1 package Lingua::Ogmios::Annotations::SyntacticRelation;
2  
3 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 16 ▶use Lingua::Ogmios::Annotations::Element;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 16 our @ISA = qw(Lingua::Ogmios::Annotations::Element);
8  
9 # <!-- =================================================== -->
10 # <!-- SYNTACTIC_RELATION_LEVEL -->
11 # <!-- =================================================== -->
12 # <!ELEMENT syntactic_relation_level
13 # (log_id?, comments*,
14 # syntactic_relation+) >
15
16 # <!-- syntactic_relation -->
17 # <!ELEMENT syntactic_relation
18 # (id, log_id?,
19 # syntactic_relation_type,
20 # refid_head, refid_modifier) >
21
22 # <!-- refid_head phrase or word -->
23 # <!ELEMENT refid_head
24 # (refid_word | refid_phrase) >
25
26 # <!-- refid_modifier phrase or word -->
27 # <!ELEMENT refid_modifier
28 # (refid_word | refid_phrase) >
29
30 # <!-- syntactic_relation_type -->
31 # <!ELEMENT syntactic_relation_type
32 # (#PCDATA) >
33  
34 0 ▶sub new {
Subroutine new: not called CC=10 SCAR=47.0
Pod undocumented
35 0 my ($class, $fields) = @_;
36  
37 0 ▶ if (!defined $fields->{'id'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $fields->{"id"}) 0 0 0
38 0 $fields->{'id'} = -1;
39 }
40 0 ▶ if (!defined $fields->{'syntactic_relation_type'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $fields->{"syntactic_relation_type"}) 0 0 0
41 0 die("syntactic_relation_type is not defined");
42 }
43 # if (!defined $fields->{'refid_head'}) {
44 # die("refid_head is not defined");
45 # }
46 # if (!defined $fields->{'refid_modifier'}) {
47 # die("refid_modifier is not defined");
48 # }
49 my $syntacticrelation = $class->SUPER::new({
50 0 'id' => $fields->{'id'},
51 # 'form' => $fields->{'form'},
52 }
53 );
54 0 bless ($syntacticrelation,$class);
55  
56 0 my $i = 0;
57 0 my $reference_name;
58 my $ref;
59 0 foreach $ref ('refid_phrase', 'refid_word') {
60 0 ▶ if (defined $fields->{$ref . "_head"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $$fields{$ref . '_head'}) 0 0 0
61 0 $reference_name = $ref;
62 0 last;
63 }
64 0 $i++;
65 }
66 0 ▶ if ($i == 2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i == 2) 0 0 0
67 0 die("reference (list) is not defined");
68 }
69 0 $syntacticrelation->refid_head($reference_name, $fields->{$reference_name . "_head"});
70  
71 0 $i = 0;
72 0 $reference_name = "";
73 0 $ref = "";
74 0 foreach $ref ('refid_phrase', 'refid_word') {
75 0 ▶ if (defined $fields->{$ref . "_modifier"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $$fields{$ref . '_modifier'}) 0 0 0
76 0 $reference_name = $ref;
77 0 last;
78 }
79 0 $i++;
80 }
81 0 ▶ if ($i == 2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i == 2) 0 0 0
82 0 die("reference (list) is not defined");
83 }
84 0 $syntacticrelation->refid_modifier($reference_name, $fields->{$reference_name . "_modifier"});
85  
86 0 $syntacticrelation->syntactic_relation_type($fields->{'syntactic_relation_type'});
87 # $syntacticrelation->refid_head($fields->{'refid_head'});
88 # $syntacticrelation->refid_modifier($fields->{'refid_modifier'});
89  
90 0 ▶ if (defined $fields->{'log_id'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $fields->{"log_id"}) 0 0 0
91 0 $syntacticrelation->setLogId($fields->{'log_id'});
92 }
93 0 return($syntacticrelation);
94 }
95  
96  
97 0 ▶sub syntactic_relation_type {
Subroutine syntactic_relation_type: not called CC=2 SCAR=17.9
Pod undocumented
98 0 my $self = shift;
99  
100 0 ▶ $self->{'syntactic_relation_type'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
101 0 return($self->{'syntactic_relation_type'});
102 }
103 0 ▶sub refid_head {
Subroutine refid_head: not called CC=3 SCAR=24.8
Pod undocumented
104 0 my $self = shift;
105 0 my $refid_head;
106  
107 0 ▶ if ((@_) && (scalar @_ == 2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and scalar @_ == 2) 0 0 0
Condition0%0/3
@_ and scalar @_ == 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and scalar @_ == 2
@_ scalar @_ == 2
Truth table0%0/3
A and B
A= @_B= scalar @_ == 2
ABresult
0X0
100
111
108 0 $self->{'refid_head'} = {};
109 0 $self->{'refid_head'}->{'reference'} = shift;
110 0 $self->{'refid_head'}->{$self->{'refid_head'}->{'reference'}} = [];
111 0 $refid_head = shift;
112 0 push @{$self->{'refid_head'}->{$self->{'refid_head'}->{'reference'}}}, $refid_head;
113 }
114 0 return($self->{'refid_head'}->{$self->{'refid_head'}->{'reference'}});
115  
116 }
117 0 ▶sub refid_modifier {
Subroutine refid_modifier: not called CC=3 SCAR=24.8
Pod undocumented
118 0 my $self = shift;
119 0 my $refid_modifier;
120  
121 0 ▶ if ((@_) && (scalar @_ == 2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and scalar @_ == 2) 0 0 0
Condition0%0/3
@_ and scalar @_ == 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and scalar @_ == 2
@_ scalar @_ == 2
Truth table0%0/3
A and B
A= @_B= scalar @_ == 2
ABresult
0X0
100
111
122 0 $self->{'refid_modifier'} = {};
123 0 $self->{'refid_modifier'}->{'reference'} = shift;
124 0 $self->{'refid_modifier'}->{$self->{'refid_modifier'}->{'reference'}} = [];
125 0 $refid_modifier = shift;
126 0 push @{$self->{'refid_modifier'}->{$self->{'refid_modifier'}->{'reference'}}}, $refid_modifier;
127 }
128 0 return($self->{'refid_modifier'}->{$self->{'refid_modifier'}->{'reference'}});
129
130 # $self->{'refid_modifier'} = shift if @_;
131 # return($self->{'refid_modifier'});
132 }
133  
134 0 ▶sub XMLout {
Subroutine XMLout: not called CC=1 SCAR=6.9
Pod undocumented
135 0 my ($self, $order) = @_;
136
137 0 return($self->SUPER::XMLout("syntactic_relation", $order));
138 }
139  
140 0 ▶sub reference_name_head {
Subroutine reference_name_head: not called CC=2 SCAR=17.9
Pod undocumented
141 0 my $self = shift;
142  
143 0 ▶ $self->{'refid_head'}->{'reference'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
144 0 return $self->{'refid_head'}->{'reference'};
145 }
146  
147 0 ▶sub reference_name_modifier {
Subroutine reference_name_modifier: not called CC=2 SCAR=17.9
Pod undocumented
148 0 my $self = shift;
149  
150 0 ▶ $self->{'refid_modifier'}->{'reference'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
151 0 return $self->{'refid_modifier'}->{'reference'};
152 }
153  
154  
155 0 ▶sub reference {
Subroutine reference: not called CC=1 SCAR=6.9
Pod undocumented
156 0 my ($self) = @_;
157  
158 0 return($self->refid_head, $self->refid_modifier);
159  
160 }
161  
162 16 1;
163  
164  
165 __END__
« blib/lib/Lingua/Ogmios/NLPWrappers/Faster.pm ↑ Summary blib/lib/Lingua/Ogmios/Annotations/SemanticUnit.pm »