1RDF::Trine::Serializer(U3s)er Contributed Perl DocumentatRiDoFn::Trine::Serializer(3)
2
3
4
6 RDF::Trine::Serializer - RDF Serializer class
7
9 This document describes RDF::Trine::Serializer version 1.019
10
12 use RDF::Trine::Serializer;
13
15 The RDF::Trine::Serializer class provides an API for serializing RDF
16 graphs (via both model objects and graph iterators) to strings and
17 files.
18
20 "serializer_names"
21 Returns a list of valid serializer names for use as arguments to
22 the serializer constructor.
23
24 "new ( $serializer_name, %options )"
25 Returns a new RDF::Trine::Serializer object for the serializer with
26 the specified name (e.g. "rdfxml" or "turtle"). If no serializer
27 with the specified name is found, throws a
28 RDF::Trine::Error::SerializationError exception.
29
30 The valid key-values used in %options are specific to a particular
31 serializer implementation. For serializers that support namespace
32 declarations (to allow more concise serialization), use "namespaces
33 => \%namespaces" in %options, where the keys of %namespaces are
34 namespace names and the values are (partial) URIs. For serializers
35 that support base URI declarations, use "base_uri => $base_uri" .
36
37 "negotiate ( request_headers => $request_headers, %options )"
38 Returns a two-element list containing an appropriate media type and
39 RDF::Trine::Serializer object as decided by HTTP::Negotiate. If
40 the 'request_headers' key-value is supplied, the $request_headers
41 is passed to "HTTP::Negotiate::choose". The option 'restrict', set
42 to a list of serializer names, can be used to limit the serializers
43 to choose from. Finally, an "<'extend' "> option can be set to a
44 hashref that contains MIME-types as keys and a custom variant as
45 value. This will enable the user to use this negotiator to return a
46 type that isn't supported by any serializers. The subsequent code
47 will have to find out how to return a representation. The rest of
48 %options is passed through to the serializer constructor.
49
50 "media_types"
51 Returns a list of media types appropriate for the format of the
52 serializer.
53
54 "serialize_model_to_file ( $fh, $model )"
55 Serializes the $model, printing the results to the supplied
56 filehandle "<$fh">.
57
58 "serialize_model_to_string ( $model )"
59 Serializes the $model, returning the result as a string.
60
61 "serialize_iterator_to_file ( $file, $iterator )"
62 Serializes the statement objects produced by $iterator, printing
63 the results to the supplied filehandle "<$fh">.
64
65 Note that some serializers may not support the use of this method,
66 or may require the full materialization of the iterator in order to
67 serialize it. If materialization is required, available memeory
68 may constrain the iterators that can be serialized.
69
70 "serialize_iterator_to_string ( $iterator )"
71 Serializes the statement objects produced by $iterator, returning
72 the result as a string. Note that the same constraints apply to
73 this method as to "serialize_iterator_to_file".
74
76 Please report any bugs or feature requests to through the GitHub web
77 interface at <https://github.com/kasei/perlrdf/issues>.
78
80 Gregory Todd Williams "<gwilliams@cpan.org>"
81
83 Copyright (c) 2006-2012 Gregory Todd Williams. This program is free
84 software; you can redistribute it and/or modify it under the same terms
85 as Perl itself.
86
87
88
89perl v5.36.0 2023-01-20 RDF::Trine::Serializer(3)