.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40)
.\"
.\" 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 "XML::GRDDL 3pm"
.TH XML::GRDDL 3pm "2021-09-19" "perl v5.32.1" "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"
XML::GRDDL \- transform XML and XHTML to RDF
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
High-level interface:
.PP
.Vb 3
\& my $grddl = XML::GRDDL\->new;
\& my $model = $grddl\->data($xmldoc, $baseuri);
\& # $model is an RDF::Trine::Model
.Ve
.PP
Low-level interface:
.PP
.Vb 8
\& 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.
\& }
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
\&\s-1GRDDL\s0 is a W3C Recommendation for extracting \s-1RDF\s0 data from arbitrary
\&\s-1XML\s0 and \s-1XHTML\s0 via a transformation, typically written in \s-1XSLT.\s0 See
for more details.
.PP
This module implements \s-1GRDDL\s0 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 \s-1RDF\s0 model
is returned representing the union of the \s-1RDF\s0 graphs generated by
applying all available transformations.
.SS "Constructor"
.IX Subsection "Constructor"
.ie n .IP """XML::GRDDL\->new""" 4
.el .IP "\f(CWXML::GRDDL\->new\fR" 4
.IX Item "XML::GRDDL->new"
The constructor accepts no parameters and returns an \s-1XML::GRDDL\s0
object.
.SS "Methods"
.IX Subsection "Methods"
.ie n .IP """$grddl\->discover($xml, $base, %options)""" 4
.el .IP "\f(CW$grddl\->discover($xml, $base, %options)\fR" 4
.IX Item "$grddl->discover($xml, $base, %options)"
Processes the document to discover the transformations associated
with it. \f(CW$xml\fR is the raw \s-1XML\s0 source of the document, or an
XML::LibXML::Document object. ($xml cannot be \*(L"tag soup\*(R" \s-1HTML,\s0
though you should be able to use HTML::HTML5::Parser to
parse tag soup into an XML::LibXML::Document.) \f(CW$base\fR is the
base \s-1URI\s0 for resolving relative references.
.Sp
Returns a list of XML::GRDDL::Transformation objects.
.Sp
Options include:
.RS 4
.IP "\(bu" 4
\&\fBforce_rel\fR \- boolean; interpret \s-1XHTML\s0 rel=\*(L"transformation\*(R" even in the absence of the \s-1GRDDL\s0 profile.
.IP "\(bu" 4
\&\fBstrings\fR \- boolean; return a list of plain strings instead of blessed objects.
.RE
.RS 4
.RE
.ie n .IP """$grddl\->data($xml, $base, %options)""" 4
.el .IP "\f(CW$grddl\->data($xml, $base, %options)\fR" 4
.IX Item "$grddl->data($xml, $base, %options)"
Processes the document, discovers the transformations associated
with it, applies the transformations and merges the results into a
single \s-1RDF\s0 model. \f(CW$xml\fR and \f(CW$base\fR are as per \f(CW\*(C`discover\*(C'\fR.
.Sp
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.
.Sp
Options include:
.RS 4
.IP "\(bu" 4
\&\fBforce_rel\fR \- boolean; interpret \s-1XHTML\s0 rel=\*(L"transformation\*(R" even in the absence of the \s-1GRDDL\s0 profile.
.IP "\(bu" 4
\&\fBmetadata\fR \- boolean; include provenance information in the default graph (a.k.a. nil context).
.RE
.RS 4
.RE
.ie n .IP """$grddl\->ua( [$ua] )""" 4
.el .IP "\f(CW$grddl\->ua( [$ua] )\fR" 4
.IX Item "$grddl->ua( [$ua] )"
Get/set the user agent used for \s-1HTTP\s0 requests. \f(CW$ua\fR, if supplied, must be
an LWP::UserAgent.
.SS "Constants"
.IX Subsection "Constants"
These constants may be exported upon request.
.ie n .IP """GRDDL_NS""" 4
.el .IP "\f(CWGRDDL_NS\fR" 4
.IX Item "GRDDL_NS"
.PD 0
.ie n .IP """XHTML_NS""" 4
.el .IP "\f(CWXHTML_NS\fR" 4
.IX Item "XHTML_NS"
.PD
.SH "FEATURES"
.IX Header "FEATURES"
\&\s-1XML::GRDDL\s0 supports transformations written in \s-1XSLT 1.0,\s0 and in RDF-EASE.
.PP
\&\s-1XML::GRDDL\s0 is a good \s-1HTTP\s0 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:
.PP
.Vb 1
\& $grddl\->ua\->default_header(user_agent => \*(AqMyApp/1.0 \*(Aq);
.Ve
.PP
Provenance information for \s-1GRDDL\s0 transformations is returned using the
\&\s-1GRDDL\s0 vocabulary at .
.PP
Certain \s-1XHTML\s0 profiles and \s-1XML\s0 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.
.SH "BUGS"
.IX Header "BUGS"
Please report any bugs to .
.PP
Known limitations:
.IP "\(bu" 4
Recursive \s-1GRDDL\s0 doesn't work yet.
.Sp
That is, the profile documents and namespace documents linked to from
your primary document cannot themselves rely on \s-1GRDDL.\s0
.SH "SEE ALSO"
.IX Header "SEE ALSO"
XML::GRDDL::Transformation,
XML::GRDDL::Namespace,
XML::GRDDL::Profile,
XML::GRDDL::Transformation::RDF_EASE::Functional,
XML::Saxon::XSLT2.
.PP
HTML::HTML5::Parser,
RDF::RDFa::Parser,
HTML::Microformats.
.PP
\&\s-1JSON::GRDDL\s0.
.PP
.
.PP
.
.PP
This module is derived from Swignition .
.SH "AUTHOR"
.IX Header "AUTHOR"
Toby Inkster .
.SH "COPYRIGHT AND LICENCE"
.IX Header "COPYRIGHT AND LICENCE"
Copyright 2008\-2012 Toby Inkster
.PP
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
.SH "DISCLAIMER OF WARRANTIES"
.IX Header "DISCLAIMER OF WARRANTIES"
\&\s-1THIS PACKAGE IS PROVIDED \*(L"AS IS\*(R" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\s0