Query/Algebra/Minus.pm

filter: Statementstmt 44.4% 24 / 54 Branchbran n/a Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 42.1% 8 / 19 Podpod 100% 11 / 11 totaltotal 47.7% 43 / 90 CC 3 SCAR 11.1
CC
3
Cov
41%
sse
12.0
new
2.0
construct_args
2.0
CRAP 3.0
« Query/Plan/Offset.pm ↑ Summary Query/Plan/Constant.pm »
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.919.
11  
12 =cut
13  
14 package RDF::Query::Algebra::Minus;
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 ▶no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 36 ▶use base qw(RDF::Query::Algebra);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 36 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 36 ▶use Carp qw(carp croak confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
23 36 ▶use RDF::Trine::Iterator qw(smap sgrep swatch);
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 ######################################################################
26  
27 36 our ($VERSION);
28 36 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
29 36 $VERSION = '2.919';
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 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
50 0 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 0 ▶sub construct_args {
Subroutine construct_args: not called CC=1 SCAR=6.9
Pod documented
64 0 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 0 ▶sub pattern {
Subroutine pattern: not called CC=1 SCAR=6.9
Pod documented
75 0 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 0 ▶sub minus {
Subroutine minus: not called CC=1 SCAR=6.9
Pod documented
86 0 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 0 ▶sub sse {
Subroutine sse: not called CC=3 SCAR=24.8
Pod documented
97 0 my $self = shift;
98 0 my $context = shift;
99 0 ▶ my $prefix = shift || '';
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
100 0 ▶ my $indent = $context->{indent} || "\t";
Condition0%0/2
$context->{'indent'} || "\t"
l!l
00
MC/DC0%0/1
$context->{'indent'} || "\t"
$context->{'indent'}
Truth table0%0/2
A
A= $context->{'indent'}
Aresult
11
00
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 0 ▶sub as_sparql {
Subroutine as_sparql: not called CC=1 SCAR=6.9
Pod documented
116 0 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 0 ▶sub as_hash {
Subroutine as_hash: not called CC=1 SCAR=6.9
Pod documented
134 0 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 0 ▶sub type {
Subroutine type: not called CC=1 SCAR=6.9
Pod documented
150 0 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 0 ▶sub referenced_variables {
Subroutine referenced_variables: not called CC=1 SCAR=6.9
Pod documented
160 0 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 0 ▶sub potentially_bound {
Subroutine potentially_bound: not called CC=1 SCAR=6.9
Pod documented
172 0 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 0 ▶sub definite_variables {
Subroutine definite_variables: not called CC=1 SCAR=6.9
Pod documented
183 0 my $self = shift;
184 0 return $self->pattern->definite_variables;
185 }
186  
187 36 1;
188  
189 __END__
« Query/Plan/Offset.pm ↑ Summary Query/Plan/Constant.pm »