RDF::T...alizer(3pm)

πŸ“¦
version 1.019 Β· 7 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 => \%namespaces inside %options β€” where the keys of %namespaces are 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_headers gets passed to HTTP::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 %options is 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 (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