| RDF-Query documentation | Contained in the RDF-Query distribution. |
RDF::Query::Plan::Iterator - Executable query plan for result-generating iterators.
This document describes RDF::Query::Plan::Iterator version 2.907.
Beyond the methods documented below, this class inherits methods from the RDF::Query::Plan class.
new ( $iter, \&execute_cb )new ( \&create_iterator_cb )execute ( $execution_context )nextclosedistinctReturns true if the pattern is guaranteed to return distinct results.
orderedReturns true if the pattern is guaranteed to return ordered results.
plan_node_nameReturns the string name of this plan node, suitable for use in serialization.
plan_prototypeReturns a list of scalar identifiers for the type of the content (children) nodes of this plan node. See RDF::Query::Plan for a list of the allowable identifiers.
plan_node_dataReturns the data for this plan node that corresponds to the values described by
the signature returned by plan_prototype.
Gregory Todd Williams <gwilliams@cpan.org>
| RDF-Query documentation | Contained in the RDF-Query distribution. |
# RDF::Query::Plan::Iterator # -----------------------------------------------------------------------------
package RDF::Query::Plan::Iterator; use strict; use warnings; use base qw(RDF::Query::Plan); use Scalar::Util qw(blessed reftype); ###################################################################### our ($VERSION); BEGIN { $VERSION = '2.907'; } ######################################################################
sub new { my $class = shift; my $iter = shift; my $cb = shift; my $self = $class->SUPER::new( $iter, $cb ); $self->[0]{referenced_variables} = []; return $self; }
sub execute ($) { my $self = shift; my $context = shift; if ($self->state == $self->OPEN) { throw RDF::Query::Error::ExecutionError -text => "ITERATOR plan can't be executed while already open"; } if (ref($self->[2])) { $self->[2]->( $context ); } # if we don't have an actual iterator, but only a promise of one, construct it now if (reftype($self->[1]) eq 'CODE' and not(blessed($self->[1]) and $self->[1]->isa('RDF::Trine::Iterator'))) { $self->[1] = $self->[1]->( $context ); } $self->state( $self->OPEN ); $self; }
sub next { my $self = shift; unless ($self->state == $self->OPEN) { throw RDF::Query::Error::ExecutionError -text => "next() cannot be called on an un-open ITERATOR"; } my $iter = $self->[1]; return $iter->next; }
sub close { my $self = shift; unless ($self->state == $self->OPEN) { throw RDF::Query::Error::ExecutionError -text => "close() cannot be called on an un-open ITERATOR"; } my $iter = $self->[1]; $iter->close; $self->SUPER::close(); }
sub distinct { return 0; }
sub ordered { return []; }
sub plan_node_name { return 'optimized-iterator'; }
sub plan_prototype { my $self = shift; return qw(); }
sub plan_node_data { my $self = shift; return; } 1; __END__