| 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 |  | 11528 | use v5.14; | 
|  | 5 |  |  |  |  | 19 |  | 
| 26 | 5 |  |  | 5 |  | 27 | use warnings; | 
|  | 5 |  |  |  |  | 12 |  | 
|  | 5 |  |  |  |  | 227 |  | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | use Moo; | 
| 29 | 5 |  |  | 5 |  | 28 | use Encode; | 
|  | 5 |  |  |  |  | 14 |  | 
|  | 5 |  |  |  |  | 42 |  | 
| 30 | 5 |  |  | 5 |  | 1888 | extends 'AtteanX::Serializer::NTriples'; | 
|  | 5 |  |  |  |  | 13 |  | 
|  | 5 |  |  |  |  | 500 |  | 
| 31 |  |  |  |  |  |  | use namespace::clean; | 
| 32 | 5 |  |  | 5 |  | 35 |  | 
|  | 5 |  |  |  |  | 10 |  | 
|  | 5 |  |  |  |  | 51 |  | 
| 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 |  |  |  |  | 3 | $iter		= $iter->materialize; | 
| 44 | 2 |  |  |  |  | 3 | my $triples	= $iter->canonical_set(); | 
| 45 | 2 |  |  |  |  | 19 |  | 
| 46 | 2 |  |  |  |  | 9 | foreach my $t (@$triples) { | 
| 47 |  |  |  |  |  |  | my $str = $t->tuples_string; | 
| 48 | 2 |  |  |  |  | 5 | $io->print($str . "\n"); | 
| 49 | 6 |  |  |  |  | 41 | } | 
| 50 | 6 |  |  |  |  | 27 | return; | 
| 51 |  |  |  |  |  |  | } | 
| 52 | 2 |  |  |  |  | 26 |  | 
| 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 | 4 | open(my $fh, '>', \$data); | 
| 64 | 2 |  |  |  |  | 5 | $self->serialize_iter_to_io($fh, $iter); | 
| 65 | 2 |  |  |  |  | 16 | close($fh); | 
| 66 | 2 |  |  | 1 |  | 284 | return $data; | 
|  | 1 |  |  |  |  | 8 |  | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 9 |  | 
| 67 | 2 |  |  |  |  | 839 | } | 
| 68 | 2 |  |  |  |  | 7 | } | 
| 69 | 2 |  |  |  |  | 16 |  | 
| 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 |