| 1 | # RDF::Query::Plan::Path | ||||||||||||||||||||||
| 2 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||
| 3 | |||||||||||||||||||||||
| 4 | =head1 NAME | ||||||||||||||||||||||
| 5 | |||||||||||||||||||||||
| 6 | RDF::Query::Plan::Path - Executable query plan for Paths. | ||||||||||||||||||||||
| 7 | |||||||||||||||||||||||
| 8 | =head1 VERSION | ||||||||||||||||||||||
| 9 | |||||||||||||||||||||||
| 10 | This document describes RDF::Query::Plan::Path version 2.919. | ||||||||||||||||||||||
| 11 | |||||||||||||||||||||||
| 12 | =head1 METHODS | ||||||||||||||||||||||
| 13 | |||||||||||||||||||||||
| 14 | Beyond the methods documented below, this class inherits methods from the | ||||||||||||||||||||||
| 15 | L<RDF::Query::Plan> class. | ||||||||||||||||||||||
| 16 | |||||||||||||||||||||||
| 17 | =over 4 | ||||||||||||||||||||||
| 18 | |||||||||||||||||||||||
| 19 | =cut | ||||||||||||||||||||||
| 20 | |||||||||||||||||||||||
| 21 | package RDF::Query::Plan::Path; | ||||||||||||||||||||||
| 22 | |||||||||||||||||||||||
| 23 | 35 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 24 | 35 | ▶ | use warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 25 | 35 | ▶ | use base qw(RDF::Query::Plan); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 26 | |||||||||||||||||||||||
| 27 | 35 | ▶ | use Log::Log4perl; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 28 | 35 | ▶ | use Scalar::Util qw(blessed refaddr); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 29 | 35 | ▶ | use Time::HiRes qw(gettimeofday tv_interval); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 30 | |||||||||||||||||||||||
| 31 | 35 | ▶ | use RDF::Query::ExecutionContext; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 32 | 35 | ▶ | use RDF::Query::VariableBindings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 33 | |||||||||||||||||||||||
| 34 | ###################################################################### | ||||||||||||||||||||||
| 35 | |||||||||||||||||||||||
| 36 | 35 | our ($VERSION); | |||||||||||||||||||||
| 37 | 35 | ▶ | BEGIN { | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 38 | 35 | $VERSION = '2.919'; | |||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||
| 40 | |||||||||||||||||||||||
| 41 | ###################################################################### | ||||||||||||||||||||||
| 42 | |||||||||||||||||||||||
| 43 | =item C<< new ( $path_operator, $path, $start, $end, $graph, $distinct, %args ) >> | ||||||||||||||||||||||
| 44 | |||||||||||||||||||||||
| 45 | =cut | ||||||||||||||||||||||
| 46 | |||||||||||||||||||||||
| 47 | 2 | ▶ | sub new { | ||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||
| 48 | 2 | my $class = shift; | |||||||||||||||||||||
| 49 | 2 | my $op = shift; | |||||||||||||||||||||
| 50 | 2 | my $start = shift; | |||||||||||||||||||||
| 51 | 2 | my $path = shift; | |||||||||||||||||||||
| 52 | 2 | my $end = shift; | |||||||||||||||||||||
| 53 | 2 | my $graph = shift; | |||||||||||||||||||||
| 54 | 2 | my $distinct = shift; | |||||||||||||||||||||
| 55 | 2 | my %args = @_; | |||||||||||||||||||||
| 56 | 2 | my $self = $class->SUPER::new( $op, $path, $start, $end, $graph, $distinct, \%args ); | |||||||||||||||||||||
| 57 | 2 | my %vars; | |||||||||||||||||||||
| 58 | 2 | for ($start, $end) { | |||||||||||||||||||||
| 59 | 4 | ▶ | $vars{ $_->name }++ if ($_->isa('RDF::Query::Node::Variable')); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||
| 61 | 2 | $self->[0]{referenced_variables} = [keys %vars]; | |||||||||||||||||||||
| 62 | 2 | return $self; | |||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||
| 64 | |||||||||||||||||||||||
| 65 | =item C<< execute ( $execution_context ) >> | ||||||||||||||||||||||
| 66 | |||||||||||||||||||||||
| 67 | =cut | ||||||||||||||||||||||
| 68 | |||||||||||||||||||||||
| 69 | 2 | ▶ | sub execute ($) { | ||||||||||||||||||||
|
Subroutine
execute: called CC=12 SCAR=30.8
Pod
documented
| |||||||||||||||||||||||
| 70 | 2 | my $self = shift; | |||||||||||||||||||||
| 71 | 2 | my $context = shift; | |||||||||||||||||||||
| 72 | 2 | $self->[0]{delegate} = $context->delegate; | |||||||||||||||||||||
| 73 | 2 | ▶ | if ($self->state == $self->OPEN) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 74 | 0 | throw RDF::Query::Error::ExecutionError -text => "PATH plan can't be executed while already open"; | |||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||
| 76 | |||||||||||||||||||||||
| 77 | 2 | my $l = Log::Log4perl->get_logger("rdf.query.plan.path"); | |||||||||||||||||||||
| 78 | 2 | $l->trace( "executing RDF::Query::Plan::Path " . $self->sse ); | |||||||||||||||||||||
| 79 | |||||||||||||||||||||||
| 80 | 2 | my $start = $self->start; | |||||||||||||||||||||
| 81 | 2 | my $end = $self->end; | |||||||||||||||||||||
| 82 | 2 | my $graph = $self->graph; | |||||||||||||||||||||
| 83 | 2 | my $bound = $context->bound; | |||||||||||||||||||||
| 84 | 2 | ▶ | if (%$bound) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 85 | 0 | for ($start, $end, $graph) { | |||||||||||||||||||||
| 86 | 0 | ▶ | next unless (blessed($_)); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 87 | 0 | ▶ | next unless ($_->isa('RDF::Trine::Node::Variable')); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 88 | 0 | ▶ | next unless (blessed($bound->{ $_->name })); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 89 | 0 | $_ = $bound->{ $_->name }; | |||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||
| 92 | |||||||||||||||||||||||
| 93 | 2 | $self->[0]{results} = []; | |||||||||||||||||||||
| 94 | 2 | ▶ | my @vars = grep { blessed($_) and $_->isa('RDF::Trine::Node::Variable') } ($self->start, $self->end); | ||||||||||||||||||||
|
Condition33%1/3
builtin::blessed($_) && $_->isa('RDF::Trine::Node::Variable')
MC/DC0%0/2
builtin::blessed($_) && $_->isa('RDF::Trine::Node::Variable')
builtin::blessed($_)
$_->isa('RDF::Trine::Node::Variable')
Truth table33%1/3
A && B
A= builtin::blessed($_)B= $_->isa('RDF::Trine::Node::Variable')
| |||||||||||||||||||||||
| 95 | 2 | my $model = $context->model; | |||||||||||||||||||||
| 96 | |||||||||||||||||||||||
| 97 | 2 | $self->[0]{bound} = $bound; | |||||||||||||||||||||
| 98 | 2 | $self->[0]{graph} = $graph; | |||||||||||||||||||||
| 99 | 2 | $self->[0]{count} = 0; | |||||||||||||||||||||
| 100 | 2 | $self->[0]{context} = $context; | |||||||||||||||||||||
| 101 | 2 | $self->state( $self->OPEN ); | |||||||||||||||||||||
| 102 | |||||||||||||||||||||||
| 103 | 2 | my $op = $self->path_operator; | |||||||||||||||||||||
| 104 | 2 | ▶ | if ($op eq 'NegatedPropertySet') { | ||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||
| 105 | 0 | $self->_run_nps(); | |||||||||||||||||||||
| 106 | } elsif ($op eq 'ZeroOrMorePath') { | ||||||||||||||||||||||
| 107 | 1 | $self->_run_zeroormore(); | |||||||||||||||||||||
| 108 | } elsif ($op eq 'OneOrMorePath') { | ||||||||||||||||||||||
| 109 | 1 | $self->_run_oneormore(); | |||||||||||||||||||||
| 110 | } elsif ($op eq 'ZeroLengthPath') { | ||||||||||||||||||||||
| 111 | 0 | $self->_run_zerolength(); | |||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||
| 113 | |||||||||||||||||||||||
| 114 | 2 | $self; | |||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||
| 116 | |||||||||||||||||||||||
| 117 | |||||||||||||||||||||||
| 118 | 0 | ▶ | sub _run_nps { | ||||||||||||||||||||
|
Subroutine
_run_nps: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||
| 119 | 0 | my $self = shift; | |||||||||||||||||||||
| 120 | 0 | my $context = $self->[0]{context}; | |||||||||||||||||||||
| 121 | 0 | my $graph = $self->[0]{graph}; | |||||||||||||||||||||
| 122 | 0 | ▶ | $graph = RDF::Trine::Node::Nil->new() unless (defined($graph)); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 123 | 0 | my $model = $context->model; | |||||||||||||||||||||
| 124 | 0 | my $path = $self->path; | |||||||||||||||||||||
| 125 | |||||||||||||||||||||||
| 126 | 0 | my $var = RDF::Query::Node::Variable->new(); | |||||||||||||||||||||
| 127 | 0 | my $st = RDF::Query::Algebra::Quad->new( $self->start, $var, $self->end, $graph ); | |||||||||||||||||||||
| 128 | 0 | my @nodes = $st->nodes; | |||||||||||||||||||||
| 129 | 0 | my $plan = RDF::Query::Plan::Quad->new( @nodes[0..2], $graph ); | |||||||||||||||||||||
| 130 | 0 | my %not; | |||||||||||||||||||||
| 131 | 0 | foreach my $n (@$path) { | |||||||||||||||||||||
| 132 | 0 | $not{ $n->uri_value }++; | |||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||
| 134 | |||||||||||||||||||||||
| 135 | 0 | $plan->execute( $context ); | |||||||||||||||||||||
| 136 | 0 | ▶ | while (my $row = $plan->next) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 137 | 0 | ▶ | if (my $p = $row->{ $var->name }) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 138 | 0 | ▶ | next if (exists $not{ $p->uri_value }); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||
| 140 | 0 | push(@{ $self->[0]{results} }, $row); | |||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||
| 143 | |||||||||||||||||||||||
| 144 | 1 | ▶ | sub _run_zeroormore { | ||||||||||||||||||||
|
Subroutine
_run_zeroormore: called CC=12 SCAR=36.4
| |||||||||||||||||||||||
| 145 | 1 | my $self = shift; | |||||||||||||||||||||
| 146 | 1 | my $context = $self->[0]{context}; | |||||||||||||||||||||
| 147 | 1 | my $graph = $self->[0]{graph}; | |||||||||||||||||||||
| 148 | 1 | ▶ | $graph = RDF::Trine::Node::Nil->new() unless (defined($graph)); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 149 | 1 | my $model = $context->model; | |||||||||||||||||||||
| 150 | 1 | my $path = $self->path; | |||||||||||||||||||||
| 151 | 1 | ▶ | my @vars = grep { blessed($_) and $_->isa('RDF::Trine::Node::Variable') } ($self->start, $self->end); | ||||||||||||||||||||
|
Condition33%1/3
builtin::blessed($_) && $_->isa('RDF::Trine::Node::Variable')
MC/DC0%0/2
builtin::blessed($_) && $_->isa('RDF::Trine::Node::Variable')
builtin::blessed($_)
$_->isa('RDF::Trine::Node::Variable')
Truth table33%1/3
A && B
A= builtin::blessed($_)B= $_->isa('RDF::Trine::Node::Variable')
| |||||||||||||||||||||||
| 152 | 1 | ▶ | if (scalar(@vars) == 2) { | ||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||
| 153 | # var path+ var | ||||||||||||||||||||||
| 154 | 1 | my %nodes; | |||||||||||||||||||||
| 155 | 1 | foreach my $n ($model->subjects(undef, undef, $graph), $model->objects(undef, undef, $graph)) { | |||||||||||||||||||||
| 156 | 18 | $nodes{ $n->as_string } = $n; | |||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||
| 158 | 1 | my $end = $self->end; | |||||||||||||||||||||
| 159 | 1 | my $path = $self->path; | |||||||||||||||||||||
| 160 | 1 | my @names = map { $_->name } @vars; | |||||||||||||||||||||
| 161 | 1 | foreach my $start (values %nodes) { | |||||||||||||||||||||
| 162 | # warn "starting var path* var path at $start"; | ||||||||||||||||||||||
| 163 | 13 | my $r = []; | |||||||||||||||||||||
| 164 | 13 | $self->_alp( $start, $path, $r, {} ); | |||||||||||||||||||||
| 165 | 13 | foreach my $term (@$r) { | |||||||||||||||||||||
| 166 | 19 | my %data = ($names[0] => $start, $names[1] => $term); | |||||||||||||||||||||
| 167 | 19 | my $vb = RDF::Query::VariableBindings->new(\%data); | |||||||||||||||||||||
| 168 | 19 | push(@{ $self->[0]{results} }, $vb); | |||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||
| 171 | } elsif (scalar(@vars) == 1) { | ||||||||||||||||||||||
| 172 | 0 | my $start = $self->start; | |||||||||||||||||||||
| 173 | 0 | my $end = $self->end; | |||||||||||||||||||||
| 174 | 0 | my $path = $self->path; | |||||||||||||||||||||
| 175 | 0 | ▶ | if ($start->isa('RDF::Trine::Node::Variable')) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 176 | # var path+ term | ||||||||||||||||||||||
| 177 | 0 | ($start, $end) = ($end, $start); | |||||||||||||||||||||
| 178 | 0 | $path = ['^', $path]; | |||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||
| 180 | |||||||||||||||||||||||
| 181 | # term path+ var | ||||||||||||||||||||||
| 182 | 0 | my $r = []; | |||||||||||||||||||||
| 183 | 0 | $self->_alp( $start, $path, $r, {} ); | |||||||||||||||||||||
| 184 | |||||||||||||||||||||||
| 185 | 0 | my $name = $vars[0]->name; | |||||||||||||||||||||
| 186 | 0 | foreach my $term (@$r) { | |||||||||||||||||||||
| 187 | 0 | my $vb = RDF::Query::VariableBindings->new({ $name => $term }); | |||||||||||||||||||||
| 188 | 0 | push(@{ $self->[0]{results} }, $vb); | |||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||
| 190 | } else { | ||||||||||||||||||||||
| 191 | # term path+ term | ||||||||||||||||||||||
| 192 | 0 | my $var = RDF::Trine::Node::Variable->new(); | |||||||||||||||||||||
| 193 | 0 | my $start = $self->start; | |||||||||||||||||||||
| 194 | 0 | my $end = $self->end; | |||||||||||||||||||||
| 195 | 0 | my $path = $self->path; | |||||||||||||||||||||
| 196 | 0 | my $r = []; | |||||||||||||||||||||
| 197 | 0 | $self->_alp( $start, $path, $r, {} ); | |||||||||||||||||||||
| 198 | 0 | foreach my $term (@$r) { | |||||||||||||||||||||
| 199 | 0 | ▶ | if ($term->equal( $end )) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 200 | 0 | my $vb = RDF::Query::VariableBindings->new({}); | |||||||||||||||||||||
| 201 | 0 | push(@{ $self->[0]{results} }, $vb); | |||||||||||||||||||||
| 202 | 0 | return; | |||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||
| 207 | |||||||||||||||||||||||
| 208 | 1 | ▶ | sub _run_oneormore { | ||||||||||||||||||||
|
Subroutine
_run_oneormore: called CC=15 SCAR=41.2
| |||||||||||||||||||||||
| 209 | 1 | my $self = shift; | |||||||||||||||||||||
| 210 | 1 | my $context = $self->[0]{context}; | |||||||||||||||||||||
| 211 | 1 | my $graph = $self->[0]{graph}; | |||||||||||||||||||||
| 212 | 1 | ▶ | $graph = RDF::Trine::Node::Nil->new() unless (defined($graph)); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 213 | 1 | my $model = $context->model; | |||||||||||||||||||||
| 214 | 1 | my $path = $self->path; | |||||||||||||||||||||
| 215 | 1 | ▶ | my @vars = grep { blessed($_) and $_->isa('RDF::Trine::Node::Variable') } ($self->start, $self->end); | ||||||||||||||||||||
|
Condition33%1/3
builtin::blessed($_) && $_->isa('RDF::Trine::Node::Variable')
MC/DC0%0/2
builtin::blessed($_) && $_->isa('RDF::Trine::Node::Variable')
builtin::blessed($_)
$_->isa('RDF::Trine::Node::Variable')
Truth table33%1/3
A && B
A= builtin::blessed($_)B= $_->isa('RDF::Trine::Node::Variable')
| |||||||||||||||||||||||
| 216 | 1 | ▶ | if (scalar(@vars) == 2) { | ||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||
| 217 | # var path+ var | ||||||||||||||||||||||
| 218 | 1 | my %nodes; | |||||||||||||||||||||
| 219 | 1 | foreach my $n ($model->subjects(undef, undef, $graph), $model->objects(undef, undef, $graph)) { | |||||||||||||||||||||
| 220 | 18 | $nodes{ $n->as_string } = $n; | |||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||
| 222 | 1 | my $end = $self->end; | |||||||||||||||||||||
| 223 | 1 | my $path = $self->path; | |||||||||||||||||||||
| 224 | 1 | my @names = map { $_->name } @vars; | |||||||||||||||||||||
| 225 | 1 | foreach my $start (values %nodes) { | |||||||||||||||||||||
| 226 | # warn "starting var path+ var path at $start"; | ||||||||||||||||||||||
| 227 | 13 | my $x = $self->_path_eval($start, $path); | |||||||||||||||||||||
| 228 | 13 | my $r = []; | |||||||||||||||||||||
| 229 | 13 | ▶ | while (my $n = $x->next) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 230 | 3 | $self->_alp( $n, $path, $r, {} ); | |||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||
| 232 | 13 | foreach my $term (@$r) { | |||||||||||||||||||||
| 233 | 6 | my %data = ($names[0] => $start, $names[1] => $term); | |||||||||||||||||||||
| 234 | 6 | my $vb = RDF::Query::VariableBindings->new(\%data); | |||||||||||||||||||||
| 235 | 6 | push(@{ $self->[0]{results} }, $vb); | |||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||
| 238 | } elsif (scalar(@vars) == 1) { | ||||||||||||||||||||||
| 239 | 0 | my $start = $self->start; | |||||||||||||||||||||
| 240 | 0 | my $end = $self->end; | |||||||||||||||||||||
| 241 | 0 | my $path = $self->path; | |||||||||||||||||||||
| 242 | 0 | ▶ | if ($start->isa('RDF::Trine::Node::Variable')) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 243 | # var path+ term | ||||||||||||||||||||||
| 244 | 0 | ($start, $end) = ($end, $start); | |||||||||||||||||||||
| 245 | 0 | $path = ['^', $path]; | |||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||
| 247 | |||||||||||||||||||||||
| 248 | # term path+ var | ||||||||||||||||||||||
| 249 | 0 | my $x = $self->_path_eval($start, $path); | |||||||||||||||||||||
| 250 | 0 | my $r = []; | |||||||||||||||||||||
| 251 | 0 | my $V = {}; | |||||||||||||||||||||
| 252 | 0 | ▶ | while (my $n = $x->next) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 253 | 0 | $self->_alp( $n, $path, $r, $V ); | |||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||
| 255 | |||||||||||||||||||||||
| 256 | 0 | my $name = $vars[0]->name; | |||||||||||||||||||||
| 257 | 0 | foreach my $term (@$r) { | |||||||||||||||||||||
| 258 | 0 | my $vb = RDF::Query::VariableBindings->new({ $name => $term }); | |||||||||||||||||||||
| 259 | 0 | push(@{ $self->[0]{results} }, $vb); | |||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||
| 261 | } else { | ||||||||||||||||||||||
| 262 | # term path+ term | ||||||||||||||||||||||
| 263 | 0 | my $var = RDF::Trine::Node::Variable->new(); | |||||||||||||||||||||
| 264 | 0 | my $start = $self->start; | |||||||||||||||||||||
| 265 | 0 | my $end = $self->end; | |||||||||||||||||||||
| 266 | 0 | my $path = $self->path; | |||||||||||||||||||||
| 267 | 0 | my $x = $self->_path_eval($start, $path); | |||||||||||||||||||||
| 268 | 0 | my $V = {}; | |||||||||||||||||||||
| 269 | 0 | ▶ | while (my $n = $x->next) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 270 | 0 | my $r = []; | |||||||||||||||||||||
| 271 | 0 | $self->_alp( $n, $path, $r, $V ); | |||||||||||||||||||||
| 272 | 0 | foreach my $term (@$r) { | |||||||||||||||||||||
| 273 | 0 | ▶ | if ($term->equal( $end )) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 274 | 0 | my $vb = RDF::Query::VariableBindings->new({}); | |||||||||||||||||||||
| 275 | 0 | push(@{ $self->[0]{results} }, $vb); | |||||||||||||||||||||
| 276 | 0 | return; | |||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||
| 282 | |||||||||||||||||||||||
| 283 | # returns an iterator of terms | ||||||||||||||||||||||
| 284 | 38 | ▶ | sub _path_eval { | ||||||||||||||||||||
|
Subroutine
_path_eval: called CC=2 SCAR=6.9
| |||||||||||||||||||||||
| 285 | 38 | my $self = shift; | |||||||||||||||||||||
| 286 | 38 | my $start = shift; | |||||||||||||||||||||
| 287 | 38 | my $path = shift; | |||||||||||||||||||||
| 288 | 38 | my $context = $self->[0]{context}; | |||||||||||||||||||||
| 289 | 38 | my $graph = $self->[0]{graph}; | |||||||||||||||||||||
| 290 | 38 | ▶ | $graph = RDF::Trine::Node::Nil->new() unless (defined($graph)); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 291 | 38 | my $var = RDF::Query::Node::Variable->new(); | |||||||||||||||||||||
| 292 | 38 | my $plan = RDF::Query::Plan->__path_plan( $start, $path, $var, $graph, $context, prevent_distinguishing_bnodes => 1, distinct => $self->distinct ); | |||||||||||||||||||||
| 293 | 38 | $plan->execute( $context ); | |||||||||||||||||||||
| 294 | 50 | ▶ | my $iter = RDF::Trine::Iterator->new( sub { | ||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||
| 295 | 50 | my $r = $plan->next; | |||||||||||||||||||||
| 296 | 50 | ▶ | return unless ($r); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 297 | 12 | my $t = $r->{ $var->name }; | |||||||||||||||||||||
| 298 | 12 | return $t; | |||||||||||||||||||||
| 299 | 38 | } ); | |||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||
| 301 | |||||||||||||||||||||||
| 302 | 25 | ▶ | sub _alp { | ||||||||||||||||||||
|
Subroutine
_alp: called CC=4 SCAR=14.0
| |||||||||||||||||||||||
| 303 | 25 | my $self = shift; | |||||||||||||||||||||
| 304 | 25 | my $term = shift; | |||||||||||||||||||||
| 305 | 25 | my $path = shift; | |||||||||||||||||||||
| 306 | 25 | my $r = shift; | |||||||||||||||||||||
| 307 | 25 | my $v = shift; | |||||||||||||||||||||
| 308 | 25 | ▶ | return if (exists($v->{ $term->as_string })); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 309 | 25 | $v->{ $term->as_string } = $term; | |||||||||||||||||||||
| 310 | 25 | push(@$r, $term); | |||||||||||||||||||||
| 311 | |||||||||||||||||||||||
| 312 | 25 | my $x = $self->_path_eval($term, $path); | |||||||||||||||||||||
| 313 | 25 | ▶ | while (my $n = $x->next) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 314 | 9 | $self->_alp( $n, $path, $r, $v ); | |||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||
| 316 | |||||||||||||||||||||||
| 317 | 25 | ▶ | unless ($self->distinct) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 318 | 0 | delete $v->{ $term->as_string }; | |||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||
| 321 | |||||||||||||||||||||||
| 322 | 0 | ▶ | sub _run_zerolength { | ||||||||||||||||||||
|
Subroutine
_run_zerolength: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||
| 323 | 0 | my $self = shift; | |||||||||||||||||||||
| 324 | 0 | my $context = $self->[0]{context}; | |||||||||||||||||||||
| 325 | 0 | my $graph = $self->[0]{graph}; | |||||||||||||||||||||
| 326 | 0 | ▶ | $graph = RDF::Trine::Node::Nil->new() unless (defined($graph)); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 327 | 0 | my $model = $context->model; | |||||||||||||||||||||
| 328 | 0 | my $path = $self->path; | |||||||||||||||||||||
| 329 | 0 | ▶ | my @vars = grep { blessed($_) and $_->isa('RDF::Trine::Node::Variable') } ($self->start, $self->end); | ||||||||||||||||||||
|
Condition0%0/3
builtin::blessed($_) && $_->isa('RDF::Trine::Node::Variable')
MC/DC0%0/2
builtin::blessed($_) && $_->isa('RDF::Trine::Node::Variable')
builtin::blessed($_)
$_->isa('RDF::Trine::Node::Variable')
Truth table0%0/3
A && B
A= builtin::blessed($_)B= $_->isa('RDF::Trine::Node::Variable')
| |||||||||||||||||||||||
| 330 | 0 | ▶ | if (scalar(@vars) == 2) { | ||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||
| 331 | # -- bind VAR(s) to subjects and objects in the current active graph | ||||||||||||||||||||||
| 332 | 0 | my @names = map { $_->name } @vars; | |||||||||||||||||||||
| 333 | 0 | my %nodes; | |||||||||||||||||||||
| 334 | 0 | foreach my $n ($model->subjects(undef, undef, $graph), $model->objects(undef, undef, $graph)) { | |||||||||||||||||||||
| 335 | 0 | $nodes{ $n->as_string } = $n; | |||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||
| 337 | 0 | foreach my $n (values %nodes) { | |||||||||||||||||||||
| 338 | 0 | my %data; | |||||||||||||||||||||
| 339 | 0 | @data{ @names } = ($n) x scalar(@names); | |||||||||||||||||||||
| 340 | 0 | my $vb = RDF::Query::VariableBindings->new(\%data); | |||||||||||||||||||||
| 341 | 0 | push(@{ $self->[0]{results} }, $vb); | |||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||
| 343 | } elsif (scalar(@vars) == 1) { | ||||||||||||||||||||||
| 344 | 0 | ▶ | my ($term) = grep { blessed($_) and not($_->isa('RDF::Trine::Node::Variable')) } ($self->start, $self->end); | ||||||||||||||||||||
|
Condition0%0/3
builtin::blessed($_) && !$_->isa('RDF::Trine::Node::Variable')
MC/DC0%0/2
builtin::blessed($_) && !$_->isa('RDF::Trine::Node::Variable')
builtin::blessed($_)
!$_->isa('RDF::Trine::Node::Variable')
Truth table0%0/3
A && not(B)
A= builtin::blessed($_)B= !$_->isa('RDF::Trine::Node::Variable')
| |||||||||||||||||||||||
| 345 | 0 | my $name = $vars[0]->name; | |||||||||||||||||||||
| 346 | 0 | my $vb = RDF::Query::VariableBindings->new({ $name => $term }); | |||||||||||||||||||||
| 347 | 0 | push(@{ $self->[0]{results} }, $vb); | |||||||||||||||||||||
| 348 | } else { | ||||||||||||||||||||||
| 349 | 0 | ▶ | if ($self->start->equal( $self->end )) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 350 | 0 | my $vb = RDF::Query::VariableBindings->new({}); | |||||||||||||||||||||
| 351 | 0 | push(@{ $self->[0]{results} }, $vb); | |||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||
| 355 | |||||||||||||||||||||||
| 356 | |||||||||||||||||||||||
| 357 | |||||||||||||||||||||||
| 358 | =item C<< next >> | ||||||||||||||||||||||
| 359 | |||||||||||||||||||||||
| 360 | =cut | ||||||||||||||||||||||
| 361 | |||||||||||||||||||||||
| 362 | 27 | ▶ | sub next { | ||||||||||||||||||||
|
Subroutine
next: called CC=5 SCAR=16.7
Pod
documented
| |||||||||||||||||||||||
| 363 | 27 | my $self = shift; | |||||||||||||||||||||
| 364 | 27 | my $l = Log::Log4perl->get_logger("rdf.query.plan.path"); | |||||||||||||||||||||
| 365 | |||||||||||||||||||||||
| 366 | 27 | ▶ | unless ($self->state == $self->OPEN) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 367 | 0 | throw RDF::Query::Error::ExecutionError -text => "next() cannot be called on an un-open PATH"; | |||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||
| 369 | |||||||||||||||||||||||
| 370 | 27 | ▶ | if (scalar(@{ $self->[0]{results} })) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 371 | 25 | my $result = shift(@{ $self->[0]{results} }); | |||||||||||||||||||||
| 372 | 25 | ▶ | $l->trace( 'returning path result: ' . $result ) if (defined($result)); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 373 | 25 | ▶ | if (my $d = $self->delegate) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 374 | 0 | $d->log_result( $self, $result ); | |||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||
| 376 | 25 | return $result; | |||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||
| 378 | |||||||||||||||||||||||
| 379 | 2 | return; | |||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||
| 381 | |||||||||||||||||||||||
| 382 | =item C<< close >> | ||||||||||||||||||||||
| 383 | |||||||||||||||||||||||
| 384 | =cut | ||||||||||||||||||||||
| 385 | |||||||||||||||||||||||
| 386 | 2 | ▶ | sub close { | ||||||||||||||||||||
|
Subroutine
close: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||
| 387 | 2 | my $self = shift; | |||||||||||||||||||||
| 388 | 2 | ▶ | unless ($self->state == $self->OPEN) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 389 | 0 | throw RDF::Query::Error::ExecutionError -text => "close() cannot be called on an un-open PATH"; | |||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||
| 391 | 2 | delete $self->[0]{iter}; | |||||||||||||||||||||
| 392 | 2 | $self->SUPER::close(); | |||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||
| 394 | |||||||||||||||||||||||
| 395 | =item C<< path_operator >> | ||||||||||||||||||||||
| 396 | |||||||||||||||||||||||
| 397 | Returns the path operation. | ||||||||||||||||||||||
| 398 | |||||||||||||||||||||||
| 399 | =cut | ||||||||||||||||||||||
| 400 | |||||||||||||||||||||||
| 401 | 10 | ▶ | sub path_operator { | ||||||||||||||||||||
|
Subroutine
path_operator: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 402 | 10 | my $self = shift; | |||||||||||||||||||||
| 403 | 10 | return $self->[1]; | |||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||
| 405 | |||||||||||||||||||||||
| 406 | =item C<< path >> | ||||||||||||||||||||||
| 407 | |||||||||||||||||||||||
| 408 | Returns the path expression. | ||||||||||||||||||||||
| 409 | |||||||||||||||||||||||
| 410 | =cut | ||||||||||||||||||||||
| 411 | |||||||||||||||||||||||
| 412 | 14 | ▶ | sub path { | ||||||||||||||||||||
|
Subroutine
path: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 413 | 14 | my $self = shift; | |||||||||||||||||||||
| 414 | 14 | return $self->[2]; | |||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||
| 416 | |||||||||||||||||||||||
| 417 | =item C<< start >> | ||||||||||||||||||||||
| 418 | |||||||||||||||||||||||
| 419 | Returns the path start node. | ||||||||||||||||||||||
| 420 | |||||||||||||||||||||||
| 421 | =cut | ||||||||||||||||||||||
| 422 | |||||||||||||||||||||||
| 423 | 16 | ▶ | sub start { | ||||||||||||||||||||
|
Subroutine
start: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 424 | 16 | my $self = shift; | |||||||||||||||||||||
| 425 | 16 | return $self->[3]; | |||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||
| 427 | |||||||||||||||||||||||
| 428 | =item C<< end >> | ||||||||||||||||||||||
| 429 | |||||||||||||||||||||||
| 430 | Returns the path end node. | ||||||||||||||||||||||
| 431 | |||||||||||||||||||||||
| 432 | =cut | ||||||||||||||||||||||
| 433 | |||||||||||||||||||||||
| 434 | 18 | ▶ | sub end { | ||||||||||||||||||||
|
Subroutine
end: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 435 | 18 | my $self = shift; | |||||||||||||||||||||
| 436 | 18 | return $self->[4]; | |||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||
| 438 | |||||||||||||||||||||||
| 439 | =item C<< graph >> | ||||||||||||||||||||||
| 440 | |||||||||||||||||||||||
| 441 | Returns the named graph. | ||||||||||||||||||||||
| 442 | |||||||||||||||||||||||
| 443 | =cut | ||||||||||||||||||||||
| 444 | |||||||||||||||||||||||
| 445 | 12 | ▶ | sub graph { | ||||||||||||||||||||
|
Subroutine
graph: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 446 | 12 | my $self = shift; | |||||||||||||||||||||
| 447 | 12 | return $self->[5]; | |||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||
| 449 | |||||||||||||||||||||||
| 450 | =item C<< distinct >> | ||||||||||||||||||||||
| 451 | |||||||||||||||||||||||
| 452 | Returns true if the pattern is guaranteed to return distinct results. | ||||||||||||||||||||||
| 453 | |||||||||||||||||||||||
| 454 | =cut | ||||||||||||||||||||||
| 455 | |||||||||||||||||||||||
| 456 | 63 | ▶ | sub distinct { | ||||||||||||||||||||
|
Subroutine
distinct: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 457 | 63 | my $self = shift; | |||||||||||||||||||||
| 458 | 63 | return $self->[6]; | |||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||
| 460 | |||||||||||||||||||||||
| 461 | =item C<< ordered >> | ||||||||||||||||||||||
| 462 | |||||||||||||||||||||||
| 463 | Returns true if the pattern is guaranteed to return ordered results. | ||||||||||||||||||||||
| 464 | |||||||||||||||||||||||
| 465 | =cut | ||||||||||||||||||||||
| 466 | |||||||||||||||||||||||
| 467 | 0 | ▶ | sub ordered { | ||||||||||||||||||||
|
Subroutine
ordered: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||
| 468 | 0 | return []; | |||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||
| 470 | |||||||||||||||||||||||
| 471 | =item C<< plan_node_name >> | ||||||||||||||||||||||
| 472 | |||||||||||||||||||||||
| 473 | Returns the string name of this plan node, suitable for use in serialization. | ||||||||||||||||||||||
| 474 | |||||||||||||||||||||||
| 475 | =cut | ||||||||||||||||||||||
| 476 | |||||||||||||||||||||||
| 477 | 8 | ▶ | sub plan_node_name { | ||||||||||||||||||||
|
Subroutine
plan_node_name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 478 | 8 | my $self = shift; | |||||||||||||||||||||
| 479 | 8 | return $self->path_operator; | |||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||
| 481 | |||||||||||||||||||||||
| 482 | =item C<< plan_prototype >> | ||||||||||||||||||||||
| 483 | |||||||||||||||||||||||
| 484 | Returns a list of scalar identifiers for the type of the content (children) | ||||||||||||||||||||||
| 485 | nodes of this plan node. See L<RDF::Query::Plan> for a list of the allowable | ||||||||||||||||||||||
| 486 | identifiers. | ||||||||||||||||||||||
| 487 | |||||||||||||||||||||||
| 488 | =cut | ||||||||||||||||||||||
| 489 | |||||||||||||||||||||||
| 490 | 8 | ▶ | sub plan_prototype { | ||||||||||||||||||||
|
Subroutine
plan_prototype: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 491 | 8 | my $self = shift; | |||||||||||||||||||||
| 492 | 8 | return qw(s N N N); | |||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||
| 494 | |||||||||||||||||||||||
| 495 | =item C<< plan_node_data >> | ||||||||||||||||||||||
| 496 | |||||||||||||||||||||||
| 497 | Returns the data for this plan node that corresponds to the values described by | ||||||||||||||||||||||
| 498 | the signature returned by C<< plan_prototype >>. | ||||||||||||||||||||||
| 499 | |||||||||||||||||||||||
| 500 | =cut | ||||||||||||||||||||||
| 501 | |||||||||||||||||||||||
| 502 | 10 | ▶ | sub plan_node_data { | ||||||||||||||||||||
|
Subroutine
plan_node_data: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||
| 503 | 10 | my $self = shift; | |||||||||||||||||||||
| 504 | 10 | my $path = $self->path; | |||||||||||||||||||||
| 505 | 10 | ▶ | if (blessed($path)) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 506 | 10 | return ($path->sse, $self->start, $self->end, $self->graph); | |||||||||||||||||||||
| 507 | } else { | ||||||||||||||||||||||
| 508 | 0 | return ('(undefined path)', $self->start, $self->end, $self->graph); | |||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||
| 511 | |||||||||||||||||||||||
| 512 | |||||||||||||||||||||||
| 513 | =item C<< explain >> | ||||||||||||||||||||||
| 514 | |||||||||||||||||||||||
| 515 | Returns a string serialization of the plan appropriate for display on the | ||||||||||||||||||||||
| 516 | command line. | ||||||||||||||||||||||
| 517 | |||||||||||||||||||||||
| 518 | =cut | ||||||||||||||||||||||
| 519 | |||||||||||||||||||||||
| 520 | 0 | ▶ | sub explain { | ||||||||||||||||||||
|
Subroutine
explain: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||
| 521 | 0 | my $self = shift; | |||||||||||||||||||||
| 522 | 0 | my $s = shift; | |||||||||||||||||||||
| 523 | 0 | my $count = shift; | |||||||||||||||||||||
| 524 | 0 | my $indent = $s x $count; | |||||||||||||||||||||
| 525 | 0 | my $type = $self->plan_node_name; | |||||||||||||||||||||
| 526 | 0 | my $string = sprintf("%s%s (0x%x)\n", $indent, $type, refaddr($self)); | |||||||||||||||||||||
| 527 | 0 | $string .= $self->start->explain($s, $count+1); | |||||||||||||||||||||
| 528 | 0 | my $path = $self->path; | |||||||||||||||||||||
| 529 | 0 | ▶ | if ($type eq 'NegatedPropertySet') { | ||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||
| 530 | 0 | $string .= "${indent}${s}(\n"; | |||||||||||||||||||||
| 531 | 0 | foreach my $iri (@$path) { | |||||||||||||||||||||
| 532 | 0 | $string .= "${indent}${s}${s}" . $iri->as_string . "\n"; | |||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||
| 534 | 0 | $string .= "${indent}${s})\n"; | |||||||||||||||||||||
| 535 | } elsif ($type =~ /^ZeroOrMorePath|OneOrMorePath|ZeroLengthPath$/) { | ||||||||||||||||||||||
| 536 | 0 | $string .= "${indent}${s}${s}" . $self->_path_as_string($path) . "\n"; | |||||||||||||||||||||
| 537 | } else { | ||||||||||||||||||||||
| 538 | 0 | throw RDF::Query::Error; | |||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||
| 540 | 0 | $string .= $self->end->explain($s, $count+1); | |||||||||||||||||||||
| 541 | # $string .= $self->pattern->explain( $s, $count+1 ); | ||||||||||||||||||||||
| 542 | 0 | return $string; | |||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||
| 544 | |||||||||||||||||||||||
| 545 | 0 | ▶ | sub _path_as_string { | ||||||||||||||||||||
|
Subroutine
_path_as_string: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||
| 546 | 0 | my $self = shift; | |||||||||||||||||||||
| 547 | 0 | my $path = shift; | |||||||||||||||||||||
| 548 | 0 | ▶ | if (blessed($path)) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 549 | 0 | return $path->as_string; | |||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||
| 551 | |||||||||||||||||||||||
| 552 | 0 | my ($op, @nodes) = @$path; | |||||||||||||||||||||
| 553 | 0 | ▶ | if ($op eq '/') { | ||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||
| 554 | 0 | return join('/', map { $self->_path_as_string($_) } @nodes); | |||||||||||||||||||||
| 555 | } elsif ($op =~ /^[?+*]$/) { | ||||||||||||||||||||||
| 556 | 0 | return '(' . $self->_path_as_string($nodes[0]) . ')' . $op; | |||||||||||||||||||||
| 557 | } else { | ||||||||||||||||||||||
| 558 | 0 | throw RDF::Query::Error -text => "Can't serialize path '$op' in plan explanation"; | |||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||
| 561 | |||||||||||||||||||||||
| 562 | 35 | 1; | |||||||||||||||||||||
| 563 | |||||||||||||||||||||||
| 564 | __END__ | ||||||||||||||||||||||