RDF::Query::Algebra::Clear - Algebra class for CLEAR operations


RDF-Query documentation Contained in the RDF-Query distribution.

Index


Code Index:

NAME

Top

RDF::Query::Algebra::Clear - Algebra class for CLEAR operations

VERSION

Top

This document describes RDF::Query::Algebra::Clear version 2.907.

METHODS

Top

Beyond the methods documented below, this class inherits methods from the RDF::Query::Algebra class.

new ( $graph [, $silent] )

Returns a new CLEAR structure.

construct_args

Returns a list of arguments that, passed to this class' constructor, will produce a clone of this algebra pattern.

as_sparql

Returns the SPARQL string for this algebra expression.

sse

Returns the SSE string for this algebra expression.

referenced_blanks

Returns a list of the blank node names used in this algebra expression.

referenced_variables
graph
silent

AUTHOR

Top

 Gregory Todd Williams <gwilliams@cpan.org>


RDF-Query documentation Contained in the RDF-Query distribution.
# RDF::Query::Algebra::Clear
# -----------------------------------------------------------------------------

package RDF::Query::Algebra::Clear;

use strict;
use warnings;
no warnings 'redefine';
use base qw(RDF::Query::Algebra);

use Data::Dumper;
use Log::Log4perl;
use Scalar::Util qw(refaddr);
use Carp qw(carp croak confess);
use Scalar::Util qw(blessed reftype refaddr);
use Time::HiRes qw(gettimeofday tv_interval);
use RDF::Trine::Iterator qw(smap sgrep swatch);

######################################################################

our ($VERSION);
my %TRIPLE_LABELS;
my @node_methods	= qw(subject predicate object);
BEGIN {
	$VERSION	= '2.907';
}

######################################################################

sub new {
	my $class	= shift;
	my $graph	= shift;
	my $silent	= shift;
	unless ($graph) {
		throw RDF::Query::Error::MethodInvocationError -text => "A graph argument is required in RDF::Query::Algebra::Clear->new";
		$graph	= RDF::Trine::Node::Nil->new;
	}
	return bless([$graph, $silent], $class);
}

sub construct_args {
	my $self	= shift;
	return ($self->graph, $self->silent);
}

sub as_sparql {
	my $self	= shift;
	my $context	= shift;
	my $indent	= shift;
	
	my $graph	= $self->graph;
	my $string;
	if ($graph->is_nil) {
		$string	= "CLEAR DEFAULT";
	} elsif ($graph->uri_value =~ m'^tag:gwilliams@cpan[.]org,2010-01-01:RT:(NAMED|ALL)$') {
		$string	= "CLEAR $1";
	} else {
		$string	= ($graph->is_nil)
				? 'CLEAR GRAPH DEFAULT'
				: sprintf( "CLEAR GRAPH <%s>", $graph->uri_value );
	}
	return $string;
}

sub sse {
	my $self	= shift;
	my $context	= shift;
	my $indent	= shift;
	
	my $graph	= $self->graph;
	my $string;
	if ($graph->is_nil) {
		$string	= "(clear default)";
	} elsif ($graph->uri_value =~ m'^tag:gwilliams@cpan[.]org,2010-01-01:RT:(NAMED|ALL)$') {
		$string	= "(clear " . lc($1) . ")";
	} else {
		$string	= ($graph->is_nil)
				? '(clear default)'
				: sprintf( "(clear <%s>)", $graph->uri_value );
	}
	return $string;
}

sub referenced_blanks {
	my $self	= shift;
	return;
}

sub referenced_variables {
	my $self	= shift;
	return;
}

sub graph {
	my $self	= shift;
	return $self->[0];
}

sub silent {
	my $self	= shift;
	return $self->[1];
}

1;

__END__