File Coverage

blib/lib/RDF/Query/Algebra/Copy.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::Copy
2             # -----------------------------------------------------------------------------
3              
4             =head1 NAME
5              
6             RDF::Query::Algebra::Copy - Algebra class for COPY operations
7              
8             =head1 VERSION
9              
10             This document describes RDF::Query::Algebra::Copy version 2.915_01.
11              
12             =cut
13              
14             package RDF::Query::Algebra::Copy;
15              
16 36     36   177 use strict;
  36         62  
  36         882  
17 36     36   179 use warnings;
  36         63  
  36         905  
18 36     36   168 no warnings 'redefine';
  36         69  
  36         1151  
19 36     36   217 use base qw(RDF::Query::Algebra);
  36         65  
  36         2517  
20              
21 36     36   200 use Data::Dumper;
  36         66  
  36         1705  
22 36     36   184 use Log::Log4perl;
  36         79  
  36         281  
23 36     36   1684 use Scalar::Util qw(refaddr);
  36         70  
  36         1695  
24 36     36   183 use Carp qw(carp croak confess);
  36         68  
  36         1974  
25 36     36   195 use Scalar::Util qw(blessed reftype refaddr);
  36         67  
  36         1833  
26 36     36   199 use Time::HiRes qw(gettimeofday tv_interval);
  36         62  
  36         233  
27 36     36   3831 use RDF::Trine::Iterator qw(smap sgrep swatch);
  36         68  
  36         3403  
28              
29             ######################################################################
30              
31             our ($VERSION);
32             my %TRIPLE_LABELS;
33             my @node_methods = qw(subject predicate object);
34             BEGIN {
35 36     36   17247 $VERSION = '2.915_01';
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 COPY 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( "COPY %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( "(copy%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