| 1 | # RDF::Trine::Node::Nil | ||||||||||||||||||||||||||||
| 2 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | =head1 NAME | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | RDF::Trine::Node::Nil - RDF Node class for the nil node | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | =head1 VERSION | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | This document describes RDF::Trine::Node::Nil version 1.019 | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | =cut | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | package RDF::Trine::Node::Nil; | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 68 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 68 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 68 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 68 | ▶ | use base qw(RDF::Trine::Node); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 68 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 68 | ▶ | use Scalar::Util qw(blessed refaddr); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 68 | ▶ | use Carp qw(carp croak confess); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | ###################################################################### | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 68 | my $NIL_NODE; | |||||||||||||||||||||||||||
| 28 | 68 | our ($VERSION); | |||||||||||||||||||||||||||
| 29 | 68 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | 68 | $VERSION = '1.019'; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | ###################################################################### | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1427 | ▶ | use overload '""' => sub { $_[0]->sse }, | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 36 | 68 | ; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head1 METHODS | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | Beyond the methods documented below, this class inherits methods from the | ||||||||||||||||||||||||||||
| 41 | L<RDF::Trine::Node> class. | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | =over 4 | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | =cut | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | =item C<< new () >> | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | Returns the nil-valued node. | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | =cut | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 4331 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 54 | 4331 | my $class = shift; | |||||||||||||||||||||||||||
| 55 | 4331 | ▶ | if (blessed($NIL_NODE)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 4292 | return $NIL_NODE; | |||||||||||||||||||||||||||
| 57 | } else { | ||||||||||||||||||||||||||||
| 58 | 39 | $NIL_NODE = bless({}, $class); | |||||||||||||||||||||||||||
| 59 | 39 | return $NIL_NODE; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =item C<< is_nil >> | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | Returns true if this object is the nil-valued node. | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =cut | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 102 | ▶ | sub is_nil { | ||||||||||||||||||||||||||
|
Subroutine
is_nil: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 70 | 102 | my $self = shift; | |||||||||||||||||||||||||||
| 71 | 102 | return (refaddr($self) == refaddr($NIL_NODE)); | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | =item C<< sse >> | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | Returns the SSE string for this nil node. | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =cut | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 15302 | ▶ | sub sse { | ||||||||||||||||||||||||||
|
Subroutine
sse: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 81 | 15302 | my $self = shift; | |||||||||||||||||||||||||||
| 82 | 15302 | return '(nil)'; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | =item C<< as_ntriples >> | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | Returns the N-Triples serialization of the nil node's IRI | ||||||||||||||||||||||||||||
| 88 | <tag:gwilliams@cpan.org,2010-01-01:RT:NIL>. | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | =cut | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 0 | ▶ | sub as_ntriples { | ||||||||||||||||||||||||||
|
Subroutine
as_ntriples: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 93 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 94 | 0 | return sprintf('<%s>', &RDF::Trine::NIL_GRAPH()); | |||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | =item C<< type >> | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | Returns the type string of this node. | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | =cut | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub type { | ||||||||||||||||||||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 104 | 0 | return 'NIL'; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | =item C<< value >> | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | Returns the empty string. | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | =cut | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | ▶ | sub value { | ||||||||||||||||||||||||||
|
Subroutine
value: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 114 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 115 | 0 | return ''; | |||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | =item C<< equal ( $node ) >> | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | Returns true if the two nodes are equal, false otherwise. | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | =cut | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 4 | ▶ | sub equal { | ||||||||||||||||||||||||||
|
Subroutine
equal: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||
| 125 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 126 | 4 | my $node = shift; | |||||||||||||||||||||||||||
| 127 | 4 | ▶ | return 0 unless (blessed($node)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | 4 | ▶ | if ($self->isa('RDF::Trine::Node::Nil') and $node->isa('RDF::Trine::Node::Nil')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->isa("RDF::Trine::Node::Nil") and $node->isa("RDF::Trine::Node::Nil")
MC/DC50%1/2
$self->isa("RDF::Trine::Node::Nil") and $node->isa("RDF::Trine::Node::Nil")
$self->isa("RDF::Trine::Node::Nil")
$node->isa("RDF::Trine::Node::Nil")
Truth table66%2/3
A and B
A= $self->isa("RDF::Trine::Node::Nil")B= $node->isa("RDF::Trine::Node::Nil")
| |||||||||||||||||||||||||||||
| 129 | 2 | return 1; | |||||||||||||||||||||||||||
| 130 | } else { | ||||||||||||||||||||||||||||
| 131 | 2 | return 0; | |||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | # called to compare two nodes of the same type | ||||||||||||||||||||||||||||
| 136 | 0 | ▶ | sub _compare { | ||||||||||||||||||||||||||
|
Subroutine
_compare: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 137 | 0 | return 0; | |||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 68 | 1; | |||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | __END__ | ||||||||||||||||||||||||||||