Generate some data in rdfa
Creates a new generator object. $style 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:
$gen = RDF::RDFa::Generator::HTML::Head->new(%options);
Options include:
base - 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.
data_context - if non-null, a \s-1URI\s0 (string) which indicates the context (named graph) containing the data to generate RDFa for.
namespaces - a {prefix=>uri} hashref of preferred \s-1CURIE\s0 prefixes.
ns - a {uri=>prefix} hashref of preferred \s-1CURIE\s0 prefixes. \s-1DEPRECATED\s0 - use namespaces instead.
prefix_attr - use the @prefix attribute for \s-1CURIE\s0 prefixes (RDFa 1.1 only). Boolean, defaults to false.
safe_xml_literals - prevents \s-1XML\s0 literals from injecting arbitrary \s-1XHTML\s0 into the output. Boolean, defaults to \s-1FALSE\s0.
title - assign a <title> element for generated \s-1XHTML\s0 documents.
version - set generated RDFa version. Valid values are '1.0' (the default) or '1.1'.
Creates a new RDFa file containing triples. $model is an RDF::Trine::Model object providing the triples. Returns an XML::LibXML::Document object suitable for serialising using its \*(C`toString\*(C' method. 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 serialise the document rather than \*(C`toString\*(C'. Can also be called as a class method: $document = RDF::RDFa::Generator->create_document($model) # Same as: # $document = RDF::RDFa::Generator->new->create_document($model) Injects an existing document with triples. $document is an XML::LibXML::Document to inject, or a well-formed \s-1XML\s0 string. $model is an RDF::Trine::Model object providing the triples. Returns an XML::LibXML::Document object suitable for serialising using its \*(C`toString\*(C' method. See \*(C`create_document\*(C' for information about serving the RDFa with the text/html media type. Can also be called as a class method. See \*(C`create_document\*(C' for details. Provides triple-laden XML::LibXML::Elements to be added to a document. $model 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. Can also be called as a class method. See \*(C`create_document\*(C' for details. The HTML::Pretty generator can be passed a couple of additional options: $gen->nodes($model, notes_heading=>'Additional Info', notes=>\@notes); 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.
Additionally the methods \*(C`serialize_model_to_file\*(C', \*(C`serialize_model_to_string\*(C', \*(C`serialize_iterator_to_file\*(C' and \*(C`serialize_iterator_to_string\*(C' are provided for compatibility with the RDF::Trine::Serializer interface.
Please report any bugs to <http://rt.cpan.org/>.
HTML::HTML5::Writer, XML::LibXML, RDF::RDFa::Parser, RDF::Trine, RDF::Prefixes.
<http://www.perlrdf.org/>.
Toby Inkster <[email protected]>.
Copyright (C) 2010 by Toby Inkster
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.
RDF::RDFa::Generator::HTML::Pretty uses the FamFamFam Silk icons; see <http://famfamfam.com/lab/icons/silk/>.