File Coverage

blib/lib/RDF/Query/Algebra/Move.pm
Criterion Covered Total %
statement 34 73 46.5
branch 0 8 0.0
condition 0 2 0.0
subroutine 12 21 57.1
pod 9 9 100.0
total 55 113 48.6


line stmt bran cond sub pod time code
1             # RDF::Query::Algebra::Move
2             # -----------------------------------------------------------------------------
3              
4             =head1 NAME
5              
6             RDF::Query::Algebra::Move - Algebra class for MOVE operations
7              
8             =head1 VERSION
9              
10             This document describes RDF::Query::Algebra::Move version 2.918.
11              
12             =cut
13              
14             package RDF::Query::Algebra::Move;
15              
16 36     36   129 use strict;
  36         46  
  36         862  
17 36     36   122 use warnings;
  36         42  
  36         760  
18 36     36   108 no warnings 'redefine';
  36         46  
  36         840  
19 36     36   115 use base qw(RDF::Query::Algebra);
  36         41  
  36         2024  
20              
21 36     36   145 use Data::Dumper;
  36         54  
  36         1271  
22 36     36   132 use Log::Log4perl;
  36         46  
  36         195  
23 36     36   1204 use Scalar::Util qw(refaddr);
  36         50  
  36         1349  
24 36     36   125 use Carp qw(carp croak confess);
  36         55  
  36         1412  
25 36     36   124 use Scalar::Util qw(blessed reftype refaddr);
  36         55  
  36         1288  
26 36     36   144 use Time::HiRes qw(gettimeofday tv_interval);
  36         47  
  36         178  
27 36     36   2983 use RDF::Trine::Iterator qw(smap sgrep swatch);
  36         51  
  36         2387  
28              
29             ######################################################################
30              
31             our ($VERSION);
32             my %TRIPLE_LABELS;
33             my @node_methods = qw(subject predicate object);
34             BEGIN {
35 36     36   11457 $VERSION = '2.918';
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 ( $from, $to, $silent )>
50              
51             Returns a new MOVE structure.
52              
53             =cut
54              
55             sub new {
56 0     0 1   my $class = shift;
57 0           my $from = shift;
58 0           my $to = shift;
59 0   0       my $silent = shift || 0;
60 0           return bless([$from, $to, $silent], $class);
61             }
62              
63             =item C<< construct_args >>
64              
65             Returns a list of arguments that, passed to this class' constructor,
66             will produce a clone of this algebra pattern.
67              
68             =cut
69              
70             sub construct_args {
71 0     0 1   my $self = shift;
72 0           return ($self->from, $self->to, $self->silent);
73             }
74              
75             =item C<< as_sparql >>
76              
77             Returns the SPARQL string for this algebra expression.
78              
79             =cut
80              
81             sub as_sparql {
82 0     0 1   my $self = shift;
83 0           my $context = shift;
84 0           my $indent = shift;
85            
86 0           my $from = $self->from;
87 0           my $to = $self->to;
88 0           for ($from, $to) {
89 0 0         if ($_->isa('RDF::Trine::Node::Nil')) {
90 0           $_ = 'DEFAULT';
91             } else {
92 0           $_ = '<' . $_->uri_value . '>';
93             }
94             }
95            
96 0 0         my $string = sprintf( "MOVE %s%s TO %s", ($self->silent ? 'SILENT ' : ''), $from, $to );
97 0           return $string;
98             }
99              
100             =item C<< sse >>
101              
102             Returns the SSE string for this algebra expression.
103              
104             =cut
105              
106             sub sse {
107 0     0 1   my $self = shift;
108 0           my $context = shift;
109 0           my $indent = shift;
110            
111 0           my $from = $self->from;
112 0           my $to = $self->to;
113 0           for ($from, $to) {
114 0 0         if ($_->isa('RDF::Trine::Node::Nil')) {
115 0           $_ = 'DEFAULT';
116             } else {
117 0           $_ = '<' . $_->uri_value . '>';
118             }
119             }
120 0 0         my $string = sprintf( "(move%s %s %s)", ($self->silent ? '-silent' : ''), $from, $to );
121 0           return $string;
122             }
123              
124             =item C<< referenced_blanks >>
125              
126             Returns a list of the blank node names used in this algebra expression.
127              
128             =cut
129              
130             sub referenced_blanks {
131 0     0 1   my $self = shift;
132 0           return;
133             }
134              
135             =item C<< referenced_variables >>
136              
137             =cut
138              
139             sub referenced_variables {
140 0     0 1   my $self = shift;
141 0           return;
142             }
143              
144             =item C<< from >>
145              
146             =cut
147              
148             sub from {
149 0     0 1   my $self = shift;
150 0           return $self->[0];
151             }
152              
153             =item C<< to >>
154              
155             =cut
156              
157             sub to {
158 0     0 1   my $self = shift;
159 0           return $self->[1];
160             }
161              
162             =item C<< silent >>
163              
164             =cut
165              
166             sub silent {
167 0     0 1   my $self = shift;
168 0           return $self->[2];
169             }
170              
171             1;
172              
173             __END__
174              
175             =back
176              
177             =head1 AUTHOR
178              
179             Gregory Todd Williams <gwilliams@cpan.org>
180              
181             =cut