| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# RDF::Trine::Node::Variable |
|
2
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
RDF::Trine::Node::Variable - RDF Node class for variables |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 VERSION |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
This document describes RDF::Trine::Node::Variable version 1.018 |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
package RDF::Trine::Node::Variable; |
|
15
|
|
|
|
|
|
|
|
|
16
|
68
|
|
|
68
|
|
430
|
use strict; |
|
|
68
|
|
|
|
|
150
|
|
|
|
68
|
|
|
|
|
1690
|
|
|
17
|
68
|
|
|
68
|
|
313
|
use warnings; |
|
|
68
|
|
|
|
|
145
|
|
|
|
68
|
|
|
|
|
1551
|
|
|
18
|
68
|
|
|
68
|
|
627
|
no warnings 'redefine'; |
|
|
68
|
|
|
|
|
147
|
|
|
|
68
|
|
|
|
|
2451
|
|
|
19
|
68
|
|
|
68
|
|
355
|
use base qw(RDF::Trine::Node); |
|
|
68
|
|
|
|
|
156
|
|
|
|
68
|
|
|
|
|
5206
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
68
|
|
|
68
|
|
393
|
use Data::Dumper; |
|
|
68
|
|
|
|
|
143
|
|
|
|
68
|
|
|
|
|
2635
|
|
|
22
|
68
|
|
|
68
|
|
367
|
use Scalar::Util qw(blessed); |
|
|
68
|
|
|
|
|
140
|
|
|
|
68
|
|
|
|
|
2401
|
|
|
23
|
68
|
|
|
68
|
|
351
|
use Carp qw(carp croak confess); |
|
|
68
|
|
|
|
|
149
|
|
|
|
68
|
|
|
|
|
3608
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
###################################################################### |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our ($VERSION); |
|
28
|
|
|
|
|
|
|
BEGIN { |
|
29
|
68
|
|
|
68
|
|
2460
|
$VERSION = '1.018'; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
###################################################################### |
|
33
|
|
|
|
|
|
|
|
|
34
|
10
|
|
|
10
|
|
1447
|
use overload '""' => sub { $_[0]->sse }, |
|
35
|
68
|
|
|
68
|
|
354
|
; |
|
|
68
|
|
|
|
|
136
|
|
|
|
68
|
|
|
|
|
504
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 METHODS |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Beyond the methods documented below, this class inherits methods from the |
|
40
|
|
|
|
|
|
|
L<RDF::Trine::Node> class. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over 4 |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item C<new ( $name )> |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Returns a new Variable structure. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub new { |
|
53
|
4420
|
|
|
4420
|
1
|
10268
|
my $class = shift; |
|
54
|
4420
|
|
|
|
|
6388
|
my $name = shift; |
|
55
|
4420
|
|
|
|
|
15789
|
return bless( [ $name ], $class ); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item C<< name >> |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Returns the name of the variable. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub name { |
|
65
|
9128
|
|
|
9128
|
1
|
14099
|
my $self = shift; |
|
66
|
9128
|
|
|
|
|
28098
|
return $self->[0]; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item C<< sse >> |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Returns the SSE string for this variable. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub sse { |
|
76
|
166
|
|
|
166
|
1
|
286
|
my $self = shift; |
|
77
|
166
|
|
|
|
|
374
|
my $name = $self->name; |
|
78
|
166
|
|
|
|
|
918
|
return qq(?${name}); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item C<< as_string >> |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Returns a string representation of the node. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub as_string { |
|
88
|
32
|
|
|
32
|
1
|
57
|
my $self = shift; |
|
89
|
32
|
|
|
|
|
70
|
return '?' . $self->name; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item C<< value >> |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Returns the variable name. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub value { |
|
99
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
100
|
0
|
|
|
|
|
0
|
return $self->name; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item C<< as_ntriples >> |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Returns the node in a string form suitable for NTriples serialization. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub as_ntriples { |
|
110
|
1
|
|
|
1
|
1
|
34
|
my $self = shift; |
|
111
|
1
|
|
|
|
|
12
|
throw RDF::Trine::Error::UnimplementedError -text => "Variable nodes aren't allowed in NTriples"; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item C<< type >> |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Returns the type string of this node. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub type { |
|
121
|
3
|
|
|
3
|
1
|
9
|
return 'VAR'; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item C<< equal ( $node ) >> |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Returns true if the two nodes are equal, false otherwise. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub equal { |
|
131
|
4
|
|
|
4
|
1
|
8
|
my $self = shift; |
|
132
|
4
|
|
|
|
|
5
|
my $node = shift; |
|
133
|
4
|
100
|
100
|
|
|
37
|
return 0 unless (blessed($node) and $node->isa('RDF::Trine::Node')); |
|
134
|
2
|
100
|
|
|
|
6
|
return 0 unless ($self->type eq $node->type); |
|
135
|
1
|
|
|
|
|
3
|
return ($self->name eq $node->name); |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# called to compare two nodes of the same type |
|
139
|
|
|
|
|
|
|
sub _compare { |
|
140
|
0
|
|
|
0
|
|
|
my $a = shift; |
|
141
|
0
|
|
|
|
|
|
my $b = shift; |
|
142
|
0
|
|
|
|
|
|
return ($a->name cmp $b->name); |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
1; |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
__END__ |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=back |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 BUGS |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Please report any bugs or feature requests to through the GitHub web interface |
|
154
|
|
|
|
|
|
|
at L<https://github.com/kasei/perlrdf/issues>. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 AUTHOR |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Gregory Todd Williams C<< <gwilliams@cpan.org> >> |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Copyright (c) 2006-2012 Gregory Todd Williams. This |
|
163
|
|
|
|
|
|
|
program is free software; you can redistribute it and/or modify it under |
|
164
|
|
|
|
|
|
|
the same terms as Perl itself. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=cut |