line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# RDF::Query::Algebra::TimeGraph |
2
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
RDF::Query::Algebra::TimeGraph - Algebra class for temporal patterns |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
This document describes RDF::Query::Algebra::TimeGraph version 2.916. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
package RDF::Query::Algebra::TimeGraph; |
15
|
|
|
|
|
|
|
|
16
|
36
|
|
|
36
|
|
179
|
use strict; |
|
36
|
|
|
|
|
73
|
|
|
36
|
|
|
|
|
1033
|
|
17
|
36
|
|
|
36
|
|
255
|
use warnings; |
|
36
|
|
|
|
|
62
|
|
|
36
|
|
|
|
|
1001
|
|
18
|
36
|
|
|
36
|
|
175
|
no warnings 'redefine'; |
|
36
|
|
|
|
|
71
|
|
|
36
|
|
|
|
|
1246
|
|
19
|
36
|
|
|
36
|
|
184
|
use base qw(RDF::Query::Algebra); |
|
36
|
|
|
|
|
65
|
|
|
36
|
|
|
|
|
2715
|
|
20
|
|
|
|
|
|
|
|
21
|
36
|
|
|
36
|
|
217
|
use Data::Dumper; |
|
36
|
|
|
|
|
69
|
|
|
36
|
|
|
|
|
1886
|
|
22
|
36
|
|
|
36
|
|
188
|
use Carp qw(carp croak confess); |
|
36
|
|
|
|
|
66
|
|
|
36
|
|
|
|
|
2683
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
###################################################################### |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our ($VERSION); |
27
|
|
|
|
|
|
|
BEGIN { |
28
|
36
|
|
|
36
|
|
23397
|
$VERSION = '2.916'; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
###################################################################### |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Beyond the methods documented below, this class inherits methods from the |
36
|
|
|
|
|
|
|
L<RDF::Query::Algebra> class. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=over 4 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item C<new ( $interval, $pattern, $time_triples )> |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Returns a new TimeGraph structure. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new { |
49
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
50
|
0
|
|
|
|
|
|
my @data = @_; # $interval, $pattern, $triples |
51
|
0
|
|
|
|
|
|
return bless( [ 'TIME', @data ], $class ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item C<< construct_args >> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Returns a list of arguments that, passed to this class' constructor, |
57
|
|
|
|
|
|
|
will produce a clone of this algebra pattern. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub construct_args { |
62
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
63
|
0
|
|
|
|
|
|
return ($self->interval, $self->pattern, $self->time_triples); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item C<< interval >> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Returns the time interval node of the temporal graph expression. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub interval { |
73
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
74
|
0
|
0
|
|
|
|
|
if (@_) { |
75
|
0
|
|
|
|
|
|
my $interval = shift; |
76
|
0
|
|
|
|
|
|
$self->[1] = $interval; |
77
|
|
|
|
|
|
|
} |
78
|
0
|
|
|
|
|
|
return $self->[1]; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item C<< pattern >> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Returns the graph pattern of the temporal graph expression. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub pattern { |
88
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
89
|
0
|
|
|
|
|
|
return $self->[2]; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item C<< time_triples >> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Returns the triples describing the time interval of the temporal graph. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub time_triples { |
99
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
100
|
0
|
|
|
|
|
|
return $self->[3]; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item C<< sse >> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Returns the SSE string for this algebra expression. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub sse { |
110
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
111
|
0
|
|
|
|
|
|
my $context = shift; |
112
|
0
|
|
0
|
|
|
|
my $prefix = shift || ''; |
113
|
0
|
|
|
|
|
|
my $indent = $context->{indent}; |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
return sprintf( |
116
|
|
|
|
|
|
|
'(time\n${prefix}${indent}%s\n${prefix}${indent}%s\n${prefix}${indent}%s)', |
117
|
|
|
|
|
|
|
$self->interval->sse( $context, "${prefix}${indent}" ), |
118
|
|
|
|
|
|
|
$self->pattern->sse( $context, "${prefix}${indent}" ), |
119
|
|
|
|
|
|
|
$self->time_triples->sse( $context, "${prefix}${indent}" ), |
120
|
|
|
|
|
|
|
); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item C<< as_sparql >> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Returns the SPARQL string for this algebra expression. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub as_sparql { |
130
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
131
|
0
|
|
|
|
|
|
my $context = shift; |
132
|
0
|
|
|
|
|
|
my $indent = shift; |
133
|
0
|
|
|
|
|
|
my $nindent = $indent . "\t"; |
134
|
0
|
|
|
|
|
|
my $string = sprintf( |
135
|
|
|
|
|
|
|
"TIME %s %s", |
136
|
|
|
|
|
|
|
$self->interval->as_sparql( $context, $indent ), |
137
|
|
|
|
|
|
|
$self->pattern->as_sparql( $context, $indent ), |
138
|
|
|
|
|
|
|
); |
139
|
0
|
|
|
|
|
|
return $string; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item C<< type >> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Returns the type of this algebra expression. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub type { |
149
|
0
|
|
|
0
|
1
|
|
return 'TIME'; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item C<< referenced_variables >> |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Returns a list of the variable names used in this algebra expression. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=cut |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub referenced_variables { |
159
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
160
|
|
|
|
|
|
|
return RDF::Query::_uniq( |
161
|
0
|
|
|
|
|
|
map { $_->name } grep { $_->isa('RDF::Query::Node::Variable') } ($self->graph), |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
$self->pattern->referenced_variables, |
163
|
|
|
|
|
|
|
$self->time_triples->referenced_variables, |
164
|
|
|
|
|
|
|
); |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item C<< potentially_bound >> |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Returns a list of the variable names used in this algebra expression that will |
170
|
|
|
|
|
|
|
bind values during execution. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub potentially_bound { |
175
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
176
|
|
|
|
|
|
|
return RDF::Query::_uniq( |
177
|
0
|
|
|
|
|
|
map { $_->name } grep { $_->isa('RDF::Query::Node::Variable') } ($self->graph), |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
$self->pattern->potentially_bound, |
179
|
|
|
|
|
|
|
$self->time_triples->potentially_bound, |
180
|
|
|
|
|
|
|
); |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item C<< definite_variables >> |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Returns a list of the variable names that will be bound after evaluating this algebra expression. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=cut |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub definite_variables { |
190
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
191
|
|
|
|
|
|
|
return RDF::Query::_uniq( |
192
|
0
|
|
|
|
|
|
map { $_->name } grep { $_->isa('RDF::Query::Node::Variable') } ($self->graph), |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
$self->pattern->definite_variables, |
194
|
|
|
|
|
|
|
$self->time_triples->definite_variables, |
195
|
|
|
|
|
|
|
); |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
1; |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
__END__ |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=back |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head1 AUTHOR |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Gregory Todd Williams <gwilliams@cpan.org> |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=cut |