File Coverage

blib/lib/RDF/Query/Algebra/SubSelect.pm
Criterion Covered Total %
statement 59 70 84.2
branch 1 2 50.0
condition 2 2 100.0
subroutine 19 23 82.6
pod 10 10 100.0
total 91 107 85.0


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