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