line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::Ogmios::Annotations::SemanticFeatures; |
2
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
71
|
use strict; |
|
16
|
|
|
|
|
26
|
|
|
16
|
|
|
|
|
365
|
|
4
|
16
|
|
|
16
|
|
67
|
use warnings; |
|
16
|
|
|
|
|
30
|
|
|
16
|
|
|
|
|
339
|
|
5
|
|
|
|
|
|
|
|
6
|
16
|
|
|
16
|
|
73
|
use Lingua::Ogmios::Annotations::Element; |
|
16
|
|
|
|
|
26
|
|
|
16
|
|
|
|
|
10467
|
|
7
|
|
|
|
|
|
|
our @ISA = qw(Lingua::Ogmios::Annotations::Element); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
#
|
14
|
|
|
|
|
|
|
# (log_id?, comments*, |
15
|
|
|
|
|
|
|
# semantic_features+) > |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
#
|
19
|
|
|
|
|
|
|
# (id, log_id?, semantic_category, |
20
|
|
|
|
|
|
|
# refid_semantic_unit) > |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#
|
25
|
|
|
|
|
|
|
# (list_refid_ontology_node)+ > |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
#
|
29
|
|
|
|
|
|
|
# (refid_ontology_node)+ > |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# |
32
|
|
|
|
|
|
|
#
|
33
|
|
|
|
|
|
|
# (#PCDATA) > |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new { |
36
|
0
|
|
|
0
|
0
|
|
my ($class, $fields) = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
if (!defined $fields->{'id'}) { |
39
|
0
|
|
|
|
|
|
$fields->{'id'} = -1; |
40
|
|
|
|
|
|
|
} |
41
|
0
|
0
|
0
|
|
|
|
if ((!defined $fields->{'semantic_category'}) || |
|
|
|
0
|
|
|
|
|
42
|
|
|
|
|
|
|
(ref($fields->{'semantic_category'} ne "ARRAY")) || |
43
|
|
|
|
|
|
|
(ref($fields->{'semantic_category'}->[0] ne "ARRAY"))) { # semantic_category |
44
|
0
|
|
|
|
|
|
die("semantic_category is not defined"); |
45
|
|
|
|
|
|
|
} |
46
|
0
|
0
|
|
|
|
|
if (!defined $fields->{'refid_semantic_unit'}) { # refid_semantic_unit |
47
|
0
|
|
|
|
|
|
die("refid_semantic_unit is not defined"); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $semanticfeatures = $class->SUPER::new({ |
51
|
0
|
|
|
|
|
|
'id' => $fields->{'id'}, |
52
|
|
|
|
|
|
|
# 'form' => $fields->{'form'}, |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
); |
55
|
0
|
|
|
|
|
|
bless ($semanticfeatures,$class); |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
$semanticfeatures->refid_semantic_unit($fields->{'refid_semantic_unit'}); |
58
|
0
|
|
|
|
|
|
$semanticfeatures->semantic_category('list_refid_ontology_node', $fields->{'semantic_category'}); |
59
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
if (defined $fields->{'log_id'}) { |
61
|
0
|
|
|
|
|
|
$semanticfeatures->setLogId($fields->{'log_id'}); |
62
|
|
|
|
|
|
|
} |
63
|
0
|
|
|
|
|
|
return($semanticfeatures); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub semantic_category { |
67
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
68
|
0
|
|
|
|
|
|
my $ref; |
69
|
|
|
|
|
|
|
my $elt; |
70
|
0
|
|
|
|
|
|
my $node; |
71
|
0
|
|
|
|
|
|
my $position; |
72
|
0
|
|
|
|
|
|
my $internal_field; |
73
|
|
|
|
|
|
|
|
74
|
0
|
0
|
0
|
|
|
|
if ((@_) && (scalar @_ == 2)) { |
75
|
0
|
|
|
|
|
|
$self->{'semantic_category'} = {}; |
76
|
0
|
|
|
|
|
|
$self->{'semantic_category'}->{'reference'} = shift; |
77
|
|
|
|
|
|
|
# warn "reference: " . $self->{'semantic_category'}->{'reference'} . "\n"; |
78
|
0
|
|
|
|
|
|
$self->{'semantic_category'}->{$self->{'semantic_category'}->{'reference'}} = []; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# $position = index($self->{'semantic_category'}->{'reference'}, "list_"); |
81
|
|
|
|
|
|
|
# if ($position == 0) { |
82
|
|
|
|
|
|
|
# $internal_field = substr($self->{'semantic_category'}->{'reference'}, $position + 5); |
83
|
|
|
|
|
|
|
# } else { |
84
|
|
|
|
|
|
|
# $internal_field = shift; |
85
|
|
|
|
|
|
|
# } |
86
|
0
|
|
|
|
|
|
$ref = shift; |
87
|
0
|
|
|
|
|
|
foreach $elt (@$ref) { |
88
|
0
|
|
|
|
|
|
my @tmp; |
89
|
0
|
|
|
|
|
|
foreach $node (@$elt) { |
90
|
0
|
|
|
|
|
|
push @tmp, $node; |
91
|
|
|
|
|
|
|
# warn "node: $node (" . join(":", @tmp) . ")\n"; |
92
|
|
|
|
|
|
|
} |
93
|
0
|
|
|
|
|
|
push @{$self->{'semantic_category'}->{$self->{'semantic_category'}->{'reference'}}}, \@tmp; |
|
0
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
# foreach $elt (@$ref) { |
96
|
|
|
|
|
|
|
# foreach $node (@$elt) { |
97
|
|
|
|
|
|
|
# push @{$self->{$self->{'reference'}}}, $node; |
98
|
|
|
|
|
|
|
# } |
99
|
|
|
|
|
|
|
# } |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
} |
102
|
0
|
|
|
|
|
|
return($self->{'semantic_category'}->{$self->{'semantic_category'}->{'reference'}}); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub first_node_first_semantic_category { |
106
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
return($self->{'semantic_category'}->{$self->{'semantic_category'}->{'reference'}}->[0]->[0]); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub refid_semantic_unit { |
112
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
113
|
|
|
|
|
|
|
|
114
|
0
|
0
|
|
|
|
|
if (@_) { |
115
|
|
|
|
|
|
|
# my $old_refid = $self->{'refid_semantic_unit'}; |
116
|
0
|
|
|
|
|
|
$self->{'refid_semantic_unit'} = shift; |
117
|
|
|
|
|
|
|
# if (defined $old_refid) { |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# } |
120
|
|
|
|
|
|
|
} |
121
|
0
|
|
|
|
|
|
return($self->{'refid_semantic_unit'}); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub reference { |
125
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
return($self->refid_semantic_unit); |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub XMLout { |
131
|
0
|
|
|
0
|
0
|
|
my ($self, $order) = @_; |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
return($self->SUPER::XMLout("semantic_features", $order)); |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub toString { |
137
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
my $semf; |
140
|
0
|
|
|
|
|
|
my $semfString = ""; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
# foreach $semf (@{$self->{'semantic_category'}->{$self->{'semantic_category'}->{'reference'}}}) { |
144
|
0
|
|
|
|
|
|
foreach $semf (@{$self->semantic_category}) { |
|
0
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
$semfString .= join('/', @$semf) . ":"; |
146
|
|
|
|
|
|
|
} |
147
|
0
|
|
|
|
|
|
chop $semfString; |
148
|
0
|
|
|
|
|
|
return($semfString); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub semantic_categorySize { |
152
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
153
|
|
|
|
|
|
|
|
154
|
0
|
|
|
|
|
|
return(scalar(@{$self->semantic_category})) |
|
0
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
1; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
__END__ |