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
|
|
3033
|
use v5.14; |
|
7
|
|
|
|
|
24
|
|
26
|
7
|
|
|
7
|
|
35
|
use warnings; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
235
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use Moo; |
29
|
7
|
|
|
7
|
|
35
|
use Encode qw(encode); |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
34
|
|
30
|
7
|
|
|
7
|
|
1977
|
use Attean::ListIterator; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
287
|
|
31
|
7
|
|
|
7
|
|
49
|
use List::MoreUtils qw(any); |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
171
|
|
32
|
7
|
|
|
7
|
|
46
|
use namespace::clean; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
41
|
|
33
|
7
|
|
|
7
|
|
3747
|
|
|
7
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
43
|
|
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
|
20
|
my $iter = shift; |
44
|
4
|
|
|
|
|
7
|
while (my $t = $iter->next()) { |
45
|
4
|
|
|
|
|
5
|
my $str = $t->tuples_string . "\n"; |
46
|
4
|
|
|
|
|
11
|
$io->print($str); |
47
|
8
|
|
|
|
|
54
|
} |
48
|
8
|
|
|
|
|
31
|
return; |
49
|
|
|
|
|
|
|
} |
50
|
4
|
|
|
|
|
26
|
|
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
|
20
|
while (my $t = $iter->next()) { |
62
|
4
|
|
|
|
|
9
|
my $str = $t->tuples_string; |
63
|
4
|
|
|
|
|
6
|
$data .= $str . "\n"; |
64
|
4
|
|
|
|
|
22
|
} |
65
|
8
|
|
|
|
|
25
|
return encode('UTF-8', $data); |
66
|
8
|
|
|
|
|
28
|
} |
67
|
|
|
|
|
|
|
} |
68
|
4
|
|
|
|
|
32
|
|
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 |