| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CQL::Node; |
|
2
|
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
139
|
use strict; |
|
|
11
|
|
|
|
|
20
|
|
|
|
11
|
|
|
|
|
508
|
|
|
4
|
11
|
|
|
11
|
|
60
|
use warnings; |
|
|
11
|
|
|
|
|
20
|
|
|
|
11
|
|
|
|
|
306
|
|
|
5
|
11
|
|
|
11
|
|
59
|
use base qw( Clone ); |
|
|
11
|
|
|
|
|
20
|
|
|
|
11
|
|
|
|
|
22373
|
|
|
6
|
11
|
|
|
11
|
|
96089
|
use Carp qw( croak ); |
|
|
11
|
|
|
|
|
28
|
|
|
|
11
|
|
|
|
|
5790
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
CQL::Node - base class for nodes in a CQL parse tree |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
n/a |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
All the CQL node classes inherit from CQL::Node. CQL::Node |
|
19
|
|
|
|
|
|
|
essentially gurantees that its children implements some methods. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 toCQL() |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub toCQL { |
|
26
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
27
|
|
|
|
|
|
|
## poor mans interface |
|
28
|
0
|
|
|
|
|
0
|
croak( ref($self) . " forgot to implement toCQL()!!!" ); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 toXCQL() |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub toXCQL { |
|
36
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
37
|
0
|
|
|
|
|
0
|
croak( ref($self) . " forgot to implement toXCQL()!!!" ); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 toSwish() |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub toSwish { |
|
45
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
46
|
|
|
|
|
|
|
## poor mans interface |
|
47
|
0
|
|
|
|
|
0
|
croak( ref($self) . " forgot to implement toSwish()!!!" ); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 toLucene() |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub toLucene { |
|
55
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
56
|
0
|
|
|
|
|
0
|
croak( ref($self) . " forgot to implement toLucene()!!!" ); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 clone() |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Creates a copy of a node, and it's children. Useful if you want to modify |
|
62
|
|
|
|
|
|
|
the tree but keep a copy of the original. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# internal method for adding namespace information to top level |
|
67
|
|
|
|
|
|
|
# elements in XCQL generated by children. |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub addNamespace { |
|
70
|
11
|
|
|
11
|
0
|
21
|
my ($self,$level,$xml) = @_; |
|
71
|
|
|
|
|
|
|
# only add namespace to top level element |
|
72
|
11
|
100
|
|
|
|
60
|
return $xml if $level != 0; |
|
73
|
|
|
|
|
|
|
# kind of hackish way of adding namespace to the first |
|
74
|
|
|
|
|
|
|
# open tag we see |
|
75
|
5
|
|
|
|
|
49
|
$xml =~ s{^<([^ ]*?)>}{<$1 xmlns="http://www.loc.gov/zing/cql/xcql/">}; |
|
76
|
5
|
|
|
|
|
24
|
return $xml; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |