RDF::Trine::Node::Nil - RDF Node class for the nil node


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

Index


Code Index:

NAME

Top

RDF::Trine::Node::Nil - RDF Node class for the nil node

VERSION

Top

This document describes RDF::Trine::Node::Nil version 0.135

METHODS

Top

Beyond the methods documented below, this class inherits methods from the RDF::Trine::Node class.

new ()

Returns the nil-valued node.

is_nil

Returns true if this object is the nil-valued node.

sse

Returns the SSE string for this nil node.

type

Returns the type string of this node.

value

Returns the empty string.

equal ( $node )

Returns true if the two nodes are equal, false otherwise.

AUTHOR

Top

Gregory Todd Williams <gwilliams@cpan.org>

COPYRIGHT

Top


RDF-Trine documentation Contained in the RDF-Trine distribution.
# RDF::Trine::Node::Nil
# -----------------------------------------------------------------------------

package RDF::Trine::Node::Nil;

use strict;
use warnings;
no warnings 'redefine';
use base qw(RDF::Trine::Node);

use Data::Dumper;
use Scalar::Util qw(blessed refaddr);
use Carp qw(carp croak confess);

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

my $NIL_NODE;
our ($VERSION);
BEGIN {
	$VERSION	= '0.135';
}

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

use overload	'""'	=> sub { $_[0]->sse },
			;

sub new {
	my $class	= shift;
	if (blessed($NIL_NODE)) {
		return $NIL_NODE;
	} else {
		$NIL_NODE	= bless({}, $class);
		return $NIL_NODE;
	}
}

sub is_nil {
	my $self	= shift;
	return (refaddr($self) == refaddr($NIL_NODE));
}

sub sse {
	my $self	= shift;
	return '(nil)';
}

sub type {
	return 'NIL';
}

sub value {
	my $self	= shift;
	return '';
}

sub equal {
	my $self	= shift;
	my $node	= shift;
	return 0 unless (blessed($node));
	if ($self->isa('RDF::Trine::Node::Nil') and $node->isa('RDF::Trine::Node::Nil')) {
		return 1;
	} else {
		return 0;
	}
}

# called to compare two nodes of the same type
sub _compare {
	return 0;
}

1;

__END__