line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# RDF::Query::Node::Blank |
2
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
RDF::Query::Node::Blank - RDF Node class for blank nodes |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
This document describes RDF::Query::Node::Blank version 2.915_01. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 METHODS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Beyond the methods documented below, this class inherits methods from the |
15
|
|
|
|
|
|
|
L<RDF::Query::Node> and L<RDF::Trine::Node::Blank> classes. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=over 4 |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
package RDF::Query::Node::Blank; |
22
|
|
|
|
|
|
|
|
23
|
36
|
|
|
36
|
|
186
|
use strict; |
|
36
|
|
|
|
|
70
|
|
|
36
|
|
|
|
|
888
|
|
24
|
36
|
|
|
36
|
|
176
|
use warnings; |
|
36
|
|
|
|
|
70
|
|
|
36
|
|
|
|
|
951
|
|
25
|
36
|
|
|
36
|
|
169
|
no warnings 'redefine'; |
|
36
|
|
|
|
|
68
|
|
|
36
|
|
|
|
|
1111
|
|
26
|
36
|
|
|
36
|
|
173
|
use base qw(RDF::Query::Node RDF::Trine::Node::Blank); |
|
36
|
|
|
|
|
62
|
|
|
36
|
|
|
|
|
5480
|
|
27
|
|
|
|
|
|
|
|
28
|
36
|
|
|
36
|
|
519374
|
use Data::Dumper; |
|
36
|
|
|
|
|
74
|
|
|
36
|
|
|
|
|
1697
|
|
29
|
36
|
|
|
36
|
|
184
|
use Scalar::Util qw(blessed); |
|
36
|
|
|
|
|
67
|
|
|
36
|
|
|
|
|
1714
|
|
30
|
36
|
|
|
36
|
|
178
|
use Carp qw(carp croak confess); |
|
36
|
|
|
|
|
73
|
|
|
36
|
|
|
|
|
2726
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
###################################################################### |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our ($VERSION); |
35
|
|
|
|
|
|
|
BEGIN { |
36
|
36
|
|
|
36
|
|
6979
|
$VERSION = '2.915_01'; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
###################################################################### |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use overload '<=>' => \&_cmp, |
42
|
|
|
|
|
|
|
'cmp' => \&_cmp, |
43
|
2
|
|
|
2
|
|
718
|
'<' => sub { _cmp(@_[0,1]) == -1 }, |
44
|
1
|
|
|
1
|
|
406
|
'>' => sub { _cmp(@_[0,1]) == 1 }, |
45
|
1
|
|
|
1
|
|
364
|
'!=' => sub { _cmp(@_[0,1]) != 0 }, |
46
|
1
|
|
|
1
|
|
363
|
'==' => sub { _cmp(@_[0,1]) == 0 }, |
47
|
0
|
|
|
0
|
|
0
|
'+' => sub { $_[0] }, |
48
|
104
|
|
|
104
|
|
5536
|
'""' => sub { $_[0]->sse }, |
49
|
36
|
|
|
36
|
|
201
|
; |
|
36
|
|
|
|
|
77
|
|
|
36
|
|
|
|
|
769
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _cmp { |
52
|
6
|
|
|
6
|
|
12
|
my $nodea = shift; |
53
|
6
|
|
|
|
|
11
|
my $nodeb = shift; |
54
|
6
|
|
|
|
|
25
|
my $l = Log::Log4perl->get_logger("rdf.query.node.blank"); |
55
|
6
|
|
|
|
|
918
|
$l->debug("blank comparison: " . Dumper($nodea, $nodeb)); |
56
|
6
|
50
|
|
|
|
558
|
return 1 unless blessed($nodeb); |
57
|
6
|
50
|
|
|
|
43
|
return -1 if ($nodeb->isa('RDF::Trine::Node::Nil')); |
58
|
6
|
100
|
|
|
|
45
|
return -1 if ($nodeb->isa('RDF::Query::Node::Literal')); |
59
|
5
|
100
|
|
|
|
24
|
return -1 if ($nodeb->isa('RDF::Query::Node::Resource')); |
60
|
4
|
50
|
|
|
|
15
|
return 1 unless ($nodeb->isa('RDF::Query::Node::Blank')); |
61
|
4
|
|
|
|
|
14
|
my $cmp = $nodea->blank_identifier cmp $nodeb->blank_identifier; |
62
|
4
|
|
|
|
|
41
|
$l->debug("-> $cmp"); |
63
|
4
|
|
|
|
|
80
|
return $cmp; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item C<< new ( [ $name ] ) >> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Returns a new Blank node object. If C<< $name >> is supplied, it will be used as |
69
|
|
|
|
|
|
|
the blank node identifier. Otherwise a time-based identifier will be generated |
70
|
|
|
|
|
|
|
and used. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub new { |
75
|
140
|
|
|
140
|
1
|
831
|
my $class = shift; |
76
|
140
|
|
|
|
|
242
|
my $name = shift; |
77
|
140
|
100
|
|
|
|
379
|
unless (defined($name)) { |
78
|
3
|
|
|
|
|
14
|
$name = 'r' . time() . 'r' . $RDF::Trine::Node::Blank::COUNTER++; |
79
|
|
|
|
|
|
|
} |
80
|
140
|
|
|
|
|
696
|
return $class->_new( $name ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item C<< as_sparql >> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Returns the SPARQL string for this node. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub as_sparql { |
90
|
8
|
|
|
8
|
1
|
50
|
my $self = shift; |
91
|
8
|
|
|
|
|
33
|
return $self->sse; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item C<< as_hash >> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Returns the query as a nested set of plain data structures (no objects). |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub as_hash { |
101
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
102
|
0
|
|
|
|
|
0
|
my $context = shift; |
103
|
|
|
|
|
|
|
return { |
104
|
0
|
|
|
|
|
0
|
type => 'node', |
105
|
|
|
|
|
|
|
blank => $self->blank_identifier, |
106
|
|
|
|
|
|
|
}; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item C<< make_distinguished_variable >> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Returns a new variable based on this blank node. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub make_distinguished_variable { |
116
|
38
|
|
|
38
|
1
|
51
|
my $self = shift; |
117
|
38
|
|
|
|
|
107
|
my $id = $self->blank_identifier; |
118
|
38
|
|
|
|
|
178
|
my $name = '__ndv_' . $id; |
119
|
38
|
|
|
|
|
130
|
my $var = RDF::Query::Node::Variable->new( $name ); |
120
|
38
|
|
|
|
|
284
|
return $var; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
__END__ |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=back |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHOR |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Gregory Todd Williams <gwilliams@cpan.org> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |