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