XML::GRDDL(3pm) | User Contributed Perl Documentation | XML::GRDDL(3pm) |
XML::GRDDL - transform XML and XHTML to RDF
High-level interface:
my $grddl = XML::GRDDL->new; my $model = $grddl->data($xmldoc, $baseuri); # $model is an RDF::Trine::Model
Low-level interface:
my $grddl = XML::GRDDL->new; my @transformations = $grddl->discover($xmldoc, $baseuri); foreach my $t (@transformations) { # $t is an XML::GRDDL::Transformation my ($output, $mediatype) = $t->transform($xmldoc); # $output is a string of type $mediatype. }
GRDDL is a W3C Recommendation for extracting RDF data from arbitrary XML and XHTML via a transformation, typically written in XSLT. See <http://www.w3.org/TR/grddl/> for more details.
This module implements GRDDL in Perl. It offers both a low level interface, allowing you to generate a list of transformations associated with the document being processed, and thus the ability to selectively run the transformation; and a high-level interface where a single RDF model is returned representing the union of the RDF graphs generated by applying all available transformations.
Returns a list of XML::GRDDL::Transformation objects.
Options include:
Returns an RDF::Trine::Model containing the data. Statement contexts (a.k.a. named graphs / quads) are used to distinguish between data from the result of each transformation.
Options include:
These constants may be exported upon request.
XML::GRDDL supports transformations written in XSLT 1.0, and in RDF-EASE.
XML::GRDDL is a good HTTP citizen: Referer headers are included in requests, and appropriate Accept headers supplied. To be an even better citizen, I recommend changing the User-Agent header to advertise the name of the application:
$grddl->ua->default_header(user_agent => 'MyApp/1.0 ');
Provenance information for GRDDL transformations is returned using the GRDDL vocabulary at <http://www.w3.org/2003/g/data-view#>.
Certain XHTML profiles and XML namespaces known not to contain any transformations, or to contain useless transformations are skipped. See XML::GRDDL::Namespace and XML::GRDDL::Profile for details. In particular profiles for RDFa and many Microformats are skipped, as RDF::RDFa::Parser and HTML::Microformats will typically yield far superior results.
Please report any bugs to <http://rt.cpan.org/>.
Known limitations:
That is, the profile documents and namespace documents linked to from your primary document cannot themselves rely on GRDDL.
XML::GRDDL::Transformation, XML::GRDDL::Namespace, XML::GRDDL::Profile, XML::GRDDL::Transformation::RDF_EASE::Functional, XML::Saxon::XSLT2.
HTML::HTML5::Parser, RDF::RDFa::Parser, HTML::Microformats.
JSON::GRDDL.
<http://www.w3.org/TR/grddl/>.
<http://www.perlrdf.org/>.
This module is derived from Swignition <http://buzzword.org.uk/swignition/>.
Toby Inkster <tobyink@cpan.org>.
Copyright 2008-2012 Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2021-09-19 | perl v5.32.1 |