Query/Algebra/SubSelect.pm

filter: Statementstmt 84.7% 61 / 72 Branchbran 50.0% 1 / 2 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 82.6% 19 / 23 Podpod 100% 10 / 10 totaltotal 85.4% 94 / 110 CC 3 SCAR 2.9
CC
3
Cov
84%
query
2.2
sse
2.0
as_hash
2.0
CRAP 1.3
« Query/Algebra/Offset.pm ↑ Summary Query/Algebra/Union.pm »
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.919.
11  
12 =cut
13  
14 package RDF::Query::Algebra::SubSelect;
15  
16 36 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 36 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 36 ▶use base qw(RDF::Query::Algebra);
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 36 ▶use Log::Log4perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 36 ▶use URI::Escape;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 36 ▶use MIME::Base64;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 36 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 36 ▶use RDF::Query::Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 36 ▶use Carp qw(carp croak confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
26 36 ▶use Scalar::Util qw(blessed reftype);
Subroutine BEGIN: called CC=1 SCAR=0.0
27 36 ▶use Storable qw(store_fd fd_retrieve);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 36 ▶use RDF::Trine::Iterator qw(sgrep smap swatch);
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 ######################################################################
31  
32 36 our ($VERSION, $BLOOM_FILTER_ERROR_RATE);
33 36 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
34 36 $BLOOM_FILTER_ERROR_RATE = 0.1;
35 36 $VERSION = '2.919';
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 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
56 1 my $class = shift;
57 1 my $query = shift;
58 1 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 7 ▶sub construct_args {
Subroutine construct_args: called CC=1 SCAR=0.0
Pod documented
69 7 my $self = shift;
70 7 return ($self->query);
71 }
72  
73 =item C<< query >>
74  
75 Returns the sub-select query.
76  
77 =cut
78  
79 14 ▶sub query {
Subroutine query: called CC=2 SCAR=7.9
Pod documented
80 14 my $self = shift;
81 14 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 14 14
82 0 my $query = shift;
83 0 $self->[0] = $query;
84 }
85 14 my $query = $self->[0];
86 14 return $query;
87 }
88  
89 =item C<< sse >>
90  
91 Returns the SSE string for this algebra expression.
92  
93 =cut
94  
95 3 ▶sub sse {
Subroutine sse: called CC=2 SCAR=6.9
Pod documented
96 3 my $self = shift;
97 3 my $context = shift;
98 3 ▶ my $prefix = shift || '';
Condition100%2/2
shift() || ''
l!l
21
MC/DC100%1/1
shift() || ''
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
99 3 my $indent = $context->{indent};
100
101 3 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 2 ▶sub as_sparql {
Subroutine as_sparql: called CC=1 SCAR=0.0
Pod documented
111 2 my $self = shift;
112 2 my $context = shift;
113 2 my $indent = shift;
114 2 my $string = sprintf(
115 "{ %s }",
116 $self->query->as_sparql( $context, $indent ),
117 );
118 2 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 0 ▶sub as_hash {
Subroutine as_hash: not called CC=1 SCAR=6.9
Pod documented
128 0 my $self = shift;
129 0 my $context = shift;
130 return {
131 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 0 ▶sub type {
Subroutine type: not called CC=1 SCAR=6.9
Pod documented
143 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 0 ▶sub referenced_variables {
Subroutine referenced_variables: not called CC=1 SCAR=6.9
Pod documented
153 0 my $self = shift;
154 0 my @list = $self->query->pattern->referenced_variables;
155 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 1 ▶sub potentially_bound {
Subroutine potentially_bound: called CC=1 SCAR=0.0
Pod documented
166 1 my $self = shift;
167 1 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 0 ▶sub definite_variables {
Subroutine definite_variables: not called CC=1 SCAR=6.9
Pod documented
177 0 my $self = shift;
178 0 return $self->query->pattern->definite_variables;
179 }
180  
181  
182 36 1;
183  
184 __END__
« Query/Algebra/Offset.pm ↑ Summary Query/Algebra/Union.pm »