RDF::T...alizer(3pm)
π RDF::Trine::Serializer β the manual page, bestie edition π
okay so this is the manpage for RDF::Trine::Serializer (that's a Perl module, manual section 3pm, the "User Contributed Perl Documentation" corner of the library) and honestly? it's giving "quiet little class that does a LOT." grab a strawberry π and let's get into it.
β¨ NAME β¨
RDF::Trine::Serializer β the RDF Serializer class, periodt. π
πΈ VERSION πΈ
This doc is describing RDF::Trine::Serializer version 1.019, no cap.
π¦ SYNOPSIS π¦
the whole vibe in one line:
use RDF::Trine::Serializer;
that's it. that's the entrance. πͺβ¨
π DESCRIPTION π
The RDF::Trine::Serializer class serves up an API for serializing RDF graphs β and it does it both ways, through model objects and through graph iterators β out to strings and files. so like, whatever shape your data's in, she can write it out for you. iconic behavior fr fr. π₯
π§ METHODS π§
π serializer_names
Returns a list of valid serializer names, i.e. the ones you're allowed to pass as arguments to the serializer constructor. your lil menu of options, bestie. π
π new ( $serializer_name, %options )
Returns a brand-new RDF::Trine::Serializer object for the serializer with the specified name β think "rdfxml" or "turtle". π’
β οΈ heads up: if there's no serializer with the name you gave, she throws a RDF::Trine::Error::SerializationError exception. no serializer, no service. π
The valid key-values you can put in %options are specific to each particular serializer implementation β so it depends on who you're talking to. but here's the general tea:
- For serializers that support namespace declarations (the ones that let you serialize more concisely), use
namespaces => \%namespacesinside%optionsβ where the keys of%namespacesare namespace names and the values are (partial) URIs. π·οΈ - For serializers that support base URI declarations, use
base_uri => $base_uri. π
π negotiate ( request_headers => $request_headers, %options )
Returns a two-element list containing an appropriate media type and an RDF::Trine::Serializer object, as decided by HTTP::Negotiate. π€
- If the
'request_headers'key-value is supplied, the$request_headersgets passed toHTTP::Negotiate::choose. - The option
'restrict', set to a list of serializer names, can be used to limit the serializers to choose from. π§ - Finally, an
"'extend'"option can be set to a hashref that contains MIME-types as keys and a custom variant as value. This will enable the user to use this negotiator to return a type that isn't supported by any serializers. The subsequent code will have to find out how to return a representation. π (so like, you get the type back, but figuring out what to do with it? that's on you, babe.) - The rest of
%optionsis passed through to the serializer constructor.
π media_types
Returns a list of media types appropriate for the format of the serializer. πΊ
π serialize_model_to_file ( $fh, $model )
Serializes the $model, printing the results to the supplied filehandle $fh. π
π serialize_model_to_string ( $model )
Serializes the $model, returning the result as a string. π
π serialize_iterator_to_file ( $file, $iterator )
Serializes the statement objects produced by $iterator, printing the results to the supplied filehandle $fh. ποΈ
β οΈ real talk: note that some serializers may not support the use of this method, or may require the full materialization of the iterator in order to serialize it. If materialization is required, available memeory may constrain the iterators that can be serialized. π (yes, that's exactly how it's spelled in the source, we keep it real here.)
π serialize_iterator_to_string ( $iterator )
Serializes the statement objects produced by $iterator, returning the result as a string. π«Ά
β οΈ Note that the same constraints apply to this method as to serialize_iterator_to_file. same energy, same limits.
π BUGS π
Please report any bugs or feature requests through the GitHub web interface at <https://github.com/kasei/perlrdf/issues>. don't be shy, they want to hear it. πβ‘οΈβ¨
π AUTHOR π
Gregory Todd Williams <gwilliams@cpan.org>
π COPYRIGHT π
Copyright (c) 2006-2012 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, bestie!! π¦π this one's perl v5.38.2, dated 2024-01-13, and it ate. now go serialize something gorgeous. πβ¨
π¦ where this page comes from
- debian trixie: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms