line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
84497
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
172
|
|
2
|
|
|
|
|
|
|
#use warnings; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package RDF::Notation3::Triples; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require 5.005_62; |
7
|
2
|
|
|
2
|
|
1144
|
use RDF::Notation3; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
83
|
|
8
|
2
|
|
|
2
|
|
1257
|
use RDF::Notation3::Template::TTriples; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
1050
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
############################################################ |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
@RDF::Notation3::Triples::ISA = |
13
|
|
|
|
|
|
|
qw(RDF::Notation3::Template::TTriples RDF::Notation3); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _process_statement { |
17
|
75
|
|
|
75
|
|
116
|
my ($self, $subject, $properties) = @_; |
18
|
|
|
|
|
|
|
|
19
|
75
|
|
|
|
|
156
|
$subject = $self->_expand_prefix($subject); |
20
|
|
|
|
|
|
|
|
21
|
75
|
|
|
|
|
141
|
foreach (@$properties) { |
22
|
118
|
50
|
|
|
|
249
|
if ($_->[0] ne 'i') { |
23
|
118
|
|
|
|
|
262
|
$_->[0] = $self->_expand_prefix($_->[0]); |
24
|
|
|
|
|
|
|
|
25
|
118
|
|
|
|
|
318
|
for (my $i = 1; $i < scalar @$_; $i++ ) { |
26
|
120
|
|
|
|
|
311
|
$_->[$i] = $self->_expand_prefix($_->[$i]); |
27
|
|
|
|
|
|
|
|
28
|
120
|
|
|
|
|
148
|
push @{$self->{triples}}, |
|
120
|
|
|
|
|
1047
|
|
29
|
|
|
|
|
|
|
[$subject, $_->[0], $_->[$i], $self->{context}]; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} else { |
32
|
|
|
|
|
|
|
# inverse mode (is, <-) |
33
|
0
|
|
|
|
|
0
|
shift @$_; |
34
|
0
|
|
|
|
|
0
|
$_->[0] = $self->_expand_prefix($_->[0]); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
0
|
for (my $i = 1; $i < scalar @$_; $i++ ) { |
37
|
0
|
|
|
|
|
0
|
$_->[$i] = $self->_expand_prefix($_->[$i]); |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
0
|
push @{$self->{triples}}, |
|
0
|
|
|
|
|
0
|
|
40
|
|
|
|
|
|
|
[$_->[$i], $_->[0], $subject, $self->{context}]; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub add_triple { |
48
|
1
|
|
|
1
|
0
|
7
|
my ($self, $s, $p, $o) = @_; |
49
|
|
|
|
|
|
|
|
50
|
1
|
50
|
|
|
|
6
|
$self->{triples} or $self->{triples} = []; |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
8
|
$self->_check_resource($s, $s); |
53
|
1
|
|
|
|
|
3
|
$self->_check_resource($s, $p); |
54
|
1
|
|
|
|
|
4
|
$self->_check_resource($s, $o, 'l'); |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
7
|
$s = $self->_expand_prefix($s); |
57
|
1
|
|
|
|
|
3
|
$p = $self->_expand_prefix($p); |
58
|
1
|
|
|
|
|
4
|
$o = $self->_expand_prefix($o); |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
3
|
push @{$self->{triples}}, [$s, $p, $o, '<>']; |
|
1
|
|
|
|
|
5
|
|
61
|
1
|
|
|
|
|
1
|
return scalar @{$self->{triples}}; |
|
1
|
|
|
|
|
4
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _expand_prefix { |
66
|
316
|
|
|
316
|
|
490
|
my ($self, $qname) = @_; |
67
|
|
|
|
|
|
|
|
68
|
316
|
|
|
|
|
319
|
foreach (keys %{$self->{ns}->{$self->{context}}}) { |
|
316
|
|
|
|
|
1307
|
|
69
|
2207
|
|
|
|
|
25039
|
$qname =~ s/^$_:(.*)$/<$self->{ns}->{$self->{context}}->{$_}$1>/; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
316
|
50
|
|
|
|
1242
|
if ($qname =~ /^([_a-zA-Z]\w*)*:[a-zA-Z]\w*$/) { |
73
|
0
|
|
|
|
|
0
|
$self->_do_error(106, $qname); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
316
|
|
|
|
|
803
|
return $qname; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |