1RDF::Trine::Serializer:U:sNeTrriCpolnetsr:iR:bDCuFat:ne:odTnriPicenarell:(:3DS)oecruimaelnitzaetri:o:nNTriples::Canonical(3)
2
3
4
6 RDF::Trine::Serializer::NTriples::Canonical - Canonical representation
7 of an RDF model
8
10 This document describes RDF::Trine::Serializer::NTriples::Canonical
11 version 1.019
12
14 use RDF::Trine::Serializer::NTriples::Canonical;
15 my $serializer = RDF::Trine::Serializer::NTriples->new( onfail=>'truncate' );
16 $serializer->serialize_model_to_file(FH, $model);
17
19 This module produces a canonical string representation of an RDF graph.
20 If the graph contains blank nodes, sometimes there is no canonical
21 representation that can be produced. The 'onfail' option allows you to
22 decide what is done in those circumstances:
23
24 · truncate - drop problematic triples and only serialize a
25 subgraph.
26
27 · append - append problematic triples to the end of graph. The
28 result will be non-canonical. This is the default behaviour.
29
30 · space - As with 'append', but leave a blank line separating the
31 canonical and non-canonical portions of the graph.
32
33 · die - cause a fatal error.
34
35 Other than the 'onfail' option, this package has exactly the same
36 interface as RDF::Trine::Serializer::NTriples, providing
37 "serialize_model_to_file" and "serialize_model_to_string" methods.
38
39 This package will be considerably slower than the non-canonicalising
40 serializer though, so should only be used for small to medium-sized
41 graphs, and only when you need canonicalisation (e.g. for side-by-side
42 comparison of two graphs to check they're isomorphic; or creating a
43 canonical representation for digital signing).
44
46 Beyond the methods documented below, this class inherits methods from
47 the RDF::Trine::Serializer::NTriples class.
48
49 "new ( [ onfail => $rule ] )"
50 Returns a new Canonical N-Triples serializer object. If specified,
51 the value of the 'onfail' argument dictates the handling of blank
52 nodes with no canonical representation. The allowable rule values
53 are 'truncate', 'append', 'space', and 'die', and their respective
54 behaviour is described in "DESCRIPTION" above.
55
56 "serialize_model_to_file ( $fh, $model )"
57 Serializes the $model to canonical NTriples, printing the results
58 to the supplied filehandle "<$fh">.
59
60 "serialize_model_to_string ( $model )"
61 Serializes the $model to canonical NTriples, returning the result
62 as a string.
63
65 Please report any bugs or feature requests to through the GitHub web
66 interface at <https://github.com/kasei/perlrdf/issues>.
67
69 Signing RDF Graphs, Jeremey J Carroll, Digital Media Systems
70 Laboratory, HB Laboratories Bristol. HPL-2003-142, 23 July 2003.
71 <http://www.hpl.hp.com/techreports/2003/HPL-2003-142.pdf>.
72
73 RDF::Trine, RDF::Trine::Serializer::NTriples.
74
75 <http://www.perlrdf.org/>.
76
78 Toby Inkster, <tobyink@cpan.org>
79
81 Copyright (c) 2010 Toby Inkster
82
83 This library is free software; you can redistribute it and/or modify it
84 under the same terms as Perl itself, either Perl version 5.8.1 or, at
85 your option, any later version of Perl 5 you may have available.
86
87
88
89perl v5.32.0 RD2F0:2:0T-r0i7n-e2:8:Serializer::NTriples::Canonical(3)