| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
AtteanX::Serializer::NTuples - Shared functionality for N-Triples and N-Quads serializers |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 VERSION |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
This document describes AtteanX::Serializer::NTuples version 0.032 |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Attean; |
|
12
|
|
|
|
|
|
|
my $serializer = Attean->get_serializer('NTriples')->new(); |
|
13
|
|
|
|
|
|
|
$serializer->serialize_iter_to_io( $io, $fh ); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
... |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=over 4 |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
|
24
|
|
|
|
|
|
|
|
|
25
|
7
|
|
|
7
|
|
3499
|
use v5.14; |
|
|
7
|
|
|
|
|
26
|
|
|
26
|
7
|
|
|
7
|
|
37
|
use warnings; |
|
|
7
|
|
|
|
|
16
|
|
|
|
7
|
|
|
|
|
260
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use Moo; |
|
29
|
7
|
|
|
7
|
|
38
|
use Encode qw(encode); |
|
|
7
|
|
|
|
|
18
|
|
|
|
7
|
|
|
|
|
40
|
|
|
30
|
7
|
|
|
7
|
|
2087
|
use Attean::ListIterator; |
|
|
7
|
|
|
|
|
18
|
|
|
|
7
|
|
|
|
|
289
|
|
|
31
|
7
|
|
|
7
|
|
67
|
use List::MoreUtils qw(any); |
|
|
7
|
|
|
|
|
17
|
|
|
|
7
|
|
|
|
|
175
|
|
|
32
|
7
|
|
|
7
|
|
46
|
use namespace::clean; |
|
|
7
|
|
|
|
|
16
|
|
|
|
7
|
|
|
|
|
49
|
|
|
33
|
7
|
|
|
7
|
|
3981
|
|
|
|
7
|
|
|
|
|
23
|
|
|
|
7
|
|
|
|
|
47
|
|
|
34
|
|
|
|
|
|
|
=item C<< serialize_iter_to_io( $fh, $iterator ) >> |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Serializes the L<Attean::API::Binding> objects from C<< $iterator >> to the |
|
37
|
|
|
|
|
|
|
L<IO::Handle> object C<< $fh >>. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $self = shift; |
|
42
|
|
|
|
|
|
|
my $io = shift; |
|
43
|
4
|
|
|
4
|
1
|
36
|
my $iter = shift; |
|
44
|
4
|
|
|
|
|
8
|
while (my $t = $iter->next()) { |
|
45
|
4
|
|
|
|
|
7
|
my $str = $t->tuples_string . "\n"; |
|
46
|
4
|
|
|
|
|
20
|
$io->print($str); |
|
47
|
8
|
|
|
|
|
33
|
} |
|
48
|
8
|
|
|
|
|
46
|
return; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
4
|
|
|
|
|
13
|
|
|
51
|
|
|
|
|
|
|
=item C<< serialize_iter_to_bytes( $iterator ) >> |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Serializes the L<Attean::API::Binding> objects from C<< $iterator >> |
|
54
|
|
|
|
|
|
|
and returns the serialization as a UTF-8 encoded byte string. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $self = shift; |
|
59
|
|
|
|
|
|
|
my $iter = shift; |
|
60
|
|
|
|
|
|
|
my $data = ''; |
|
61
|
4
|
|
|
4
|
1
|
26
|
while (my $t = $iter->next()) { |
|
62
|
4
|
|
|
|
|
7
|
my $str = $t->tuples_string; |
|
63
|
4
|
|
|
|
|
7
|
$data .= $str . "\n"; |
|
64
|
4
|
|
|
|
|
24
|
} |
|
65
|
8
|
|
|
|
|
32
|
return encode('UTF-8', $data); |
|
66
|
8
|
|
|
|
|
32
|
} |
|
67
|
|
|
|
|
|
|
} |
|
68
|
4
|
|
|
|
|
36
|
|
|
69
|
|
|
|
|
|
|
1; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=back |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 BUGS |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Please report any bugs or feature requests to through the GitHub web interface |
|
77
|
|
|
|
|
|
|
at L<https://github.com/kasei/perlrdf/issues>. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Gregory Todd Williams C<< <gwilliams@cpan.org> >> |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Copyright (c) 2014--2022 Gregory Todd Williams. This |
|
86
|
|
|
|
|
|
|
program is free software; you can redistribute it and/or modify it under |
|
87
|
|
|
|
|
|
|
the same terms as Perl itself. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |