.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "RDF::RDFa::Generator 3pm" .TH RDF::RDFa::Generator 3pm "2018-11-03" "perl v5.28.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" RDF::RDFa::Generator \- Generate data for RDFa serialization .SH "DESCRIPTION" .IX Header "DESCRIPTION" .SS "Constructor" .IX Subsection "Constructor" .ie n .IP """$gen = RDF::RDFa::Generator\->new(style => $style, %options)""" 4 .el .IP "\f(CW$gen = RDF::RDFa::Generator\->new(style => $style, %options)\fR" 4 .IX Item "$gen = RDF::RDFa::Generator->new(style => $style, %options)" Creates a new generator object. \f(CW$style\fR is one of the following case-sensitive strings: \&'HTML::Head' (the default), 'HTML::Hidden' or 'HTML::Pretty'. You can also construct an object like this: .Sp .Vb 1 \& $gen = RDF::RDFa::Generator::HTML::Head\->new(%options); .Ve .Sp Options include: .RS 4 .IP "\(bu" 4 \&\fBbase\fR \- the base \s-1URL\s0 where the output data will be published. This allows in some cases for the generated RDFa to include relative URIs. .IP "\(bu" 4 \&\fBdata_context\fR \- if non-null, an Attean Blank or \s-1IRI\s0 object or an RDF::Trine::Node which indicates the context (named graph) containing the data to generate RDFa for. .IP "\(bu" 4 \&\fBnamespacemap\fR \- a URI::NamespaceMap object containing preferred \s-1CURIE\s0 prefixes. This is the preferred method, see note below. .IP "\(bu" 4 \&\fBnamespaces\fR \- a {prefix=>uri} hashref of preferred \s-1CURIE\s0 prefixes. .IP "\(bu" 4 \&\fBns\fR \- a {uri=>prefix} hashref of preferred \s-1CURIE\s0 prefixes. \s-1DEPRECATED\s0 \- use \fBnamespaces\fR instead. .IP "\(bu" 4 \&\fBprefix_attr\fR \- use the \f(CW@prefix\fR attribute for \s-1CURIE\s0 prefixes (RDFa 1.1 only). Boolean, defaults to false. .IP "\(bu" 4 \&\fBsafe_xml_literals\fR \- prevents \s-1XML\s0 literals from injecting arbitrary \s-1XHTML\s0 into the output. Boolean, \fBdefaults to \s-1FALSE\s0\fR. .IP "\(bu" 4 \&\fBtitle\fR \- assign a element for generated \s-1XHTML\s0 documents. .IP "\(bu" 4 \&\fBversion\fR \- set generated RDFa version. Valid values are '1.0' (the default) or '1.1'. .RE .RS 4 .RE .SS "Public Methods" .IX Subsection "Public Methods" .ie n .IP """$gen\->create_document($model, %opts)""" 4 .el .IP "\f(CW$gen\->create_document($model, %opts)\fR" 4 .IX Item "$gen->create_document($model, %opts)" Creates a new RDFa file containing triples. \f(CW$model\fR is an RDF::Trine::Model object providing the triples. Returns an XML::LibXML::Document object suitable for serializing using its \f(CW\*(C`toString\*(C'\fR method. .Sp If you're planning on serving the RDFa with the text/html media type, then it is recommended that you use HTML::HTML5::Writer to serialize the document rather than \f(CW\*(C`toString\*(C'\fR. .Sp Can also be called as a class method: .Sp .Vb 3 \& $document = RDF::RDFa::Generator\->create_document($model) \& # Same as: \& # $document = RDF::RDFa::Generator\->new\->create_document($model) .Ve .Sp Options can also be passed as a \s-1HASH.\s0 This is typically used for style-specific options. .ie n .IP """$gen\->inject_document($document, $model)""" 4 .el .IP "\f(CW$gen\->inject_document($document, $model)\fR" 4 .IX Item "$gen->inject_document($document, $model)" Injects an existing document with triples. \f(CW$document\fR is an XML::LibXML::Document to inject, or a well-formed \s-1XML\s0 string. \f(CW$model\fR is an RDF::Trine::Model object providing the triples. Returns an XML::LibXML::Document object suitable for serializing using its \f(CW\*(C`toString\*(C'\fR method. .Sp See \f(CW\*(C`create_document\*(C'\fR for information about serving the RDFa with the text/html media type. .Sp Can also be called as a class method. See \f(CW\*(C`create_document\*(C'\fR for details. .ie n .IP """$gen\->nodes($model)""" 4 .el .IP "\f(CW$gen\->nodes($model)\fR" 4 .IX Item "$gen->nodes($model)" Provides triple-laden XML::LibXML::Elements to be added to a document. \&\f(CW$model\fR is an RDF::Trine::Model object providing the triples. If called in list context, returns a list of XML::LibXML::Element objects which can be added to a document; otherwise returns an XML::LibXML::NodeList containing a list of such elements. .Sp Can also be called as a class method. See \f(CW\*(C`create_document\*(C'\fR for details. .Sp The HTML::Pretty generator can be passed a couple of additional options: .Sp .Vb 1 \& $gen\->nodes($model, notes_heading=>\*(AqAdditional Info\*(Aq, notes=>\e@notes); .Ve .Sp The notes are a list of RDF::RDFa::Generator::HTML::Pretty::Note objects which are added as notes to the end of each subject's data. .SH "UPGRADING TO 0.200" .IX Header "UPGRADING TO 0.200" The recommended upgrade path is to migrate your application to use Attean rather than RDF::Trine as your \s-1RDF\s0 library. If that is not an option, you may continue to use RDF::Trine, by using a compatibility layer. If you are using this module directly, to upgrade from earlier releases, you would simply add .PP .Vb 1 \& use RDF::TrineX::Compatibility::Attean; .Ve .PP alongside the import of this module. It is in a separate distribution that needs to be installed. If you use the RDF::Trine::Serializer methods, you should instead use RDF::Trine::Serializer::RDFa. .SH "NOTE" .IX Header "NOTE" Version 0.200 introduced a large number of changes to be compatible with both Attean and RDF::Trine. Some of these were backwards-incompatible, some were to support new features, such as the use of URI::NamespaceMap. .SS "Backwards-incompatible changes" .IX Subsection "Backwards-incompatible changes" The methods \f(CW\*(C`serialize_model_to_file\*(C'\fR, \f(CW\*(C`serialize_model_to_string\*(C'\fR, \&\f(CW\*(C`serialize_iterator_to_file\*(C'\fR and \f(CW\*(C`serialize_iterator_to_string\*(C'\fR that were provided for compatibility with the RDF::Trine::Serializer interface have been moved to a module RDF::Trine::Serializer::RDFa that has to be installed separately to use this with RDF::Trine. .PP \&\f(CW\*(C`data_context\*(C'\fR previously accepted a plain-text string \s-1URI.\s0 Now, it requires an appropriate object, as documented. .PP Since \s-1RDF 1.1\s0 abandons untyped literals, this module also ceases to emit them. .SS "Namespace mappings" .IX Subsection "Namespace mappings" The way namespace mappings are handled have been rewritten. Now, the preferred method to add them is to pass an URI::NamespaceMap object to \f(CW\*(C`namespacemap\*(C'\fR. This will override any other options. .PP The namespace mappings for the following prefixes will always be added: \f(CW\*(C`rdfa\*(C'\fR, \f(CW\*(C`rdf\*(C'\fR, \f(CW\*(C`rdfs\*(C'\fR and \f(CW\*(C`xsd\*(C'\fR. .PP If URI::NamespaceMap is not used, but \f(CW\*(C`namespaces\*(C'\fR is given as a hashref of prefix-URI pairs, the pairs will be added. If neither are given, all mappings from RDF::NS::Curated, which includes all if RDFa Initial Context will be added. Finally, any pairs from the deprecated \f(CW\*(C`ns\*(C'\fR option will be added, but a warning will be emitted. .SH "BUGS" .IX Header "BUGS" Please report any bugs to <https://github.com/kjetilk/p5\-rdf\-rdfa\-generator/issues>. .SH "SEE ALSO" .IX Header "SEE ALSO" You may want to use the framework-specific frontends: RDF::Trine::Serializer::RDFa or AtteanX::Serializer::RDFa. .PP Other relevant modules: .PP HTML::HTML5::Writer, XML::LibXML, RDF::RDFa::Parser, RDF::Trine, URI::NamespaceMap, Attean. .SH "AUTHOR" .IX Header "AUTHOR" Toby Inkster <tobyink@cpan.org>. .PP Kjetil Kjernsmo <kjetilk@cpan.org>. .SH "COPYRIGHT AND LICENCE" .IX Header "COPYRIGHT AND LICENCE" Copyright (C) 2010 by Toby Inkster, 2017, 2018 Kjetil Kjernsmo .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8 or, at your option, any later version of Perl 5 you may have available. .SS "Icons" .IX Subsection "Icons" RDF::RDFa::Generator::HTML::Pretty uses the FamFamFam Silk icons; see <http://famfamfam.com/lab/icons/silk/>.