HTML::Embedded::Turtle - embedding RDF in HTML the crazy way
my $het = HTML::Embedded::Turtle->new($html, $base_uri);
foreach my $graph ($het->endorsements)
my $model = $het->graph($graph);
# $model is an RDF::Trine::Model. Do something with it.
RDF can be embedded in (X)HTML using simple
The rel="meta" stuff is parsed using an RDFa parser, so equivalent RDFa
This module parses HTML files containing graphs like these, and allows
you to access them each individually; as a union of all graphs on the
page; or as a union of just the endorsed graphs.
Despite the module name, this module supports a variety of
Languages supported are (case insensitive): "Turtle", "NTriples",
"RDFJSON", "RDFXML" and "Notation3".
"HTML::Embedded::Turtle->new($markup, $base_uri, \%opts)"
Create a new object. $markup is the HTML or XHTML markup to parse;
$base_uri is the base URI to use for relative references.
Choose which parser to use: 'html' or 'xml'. The former chooses
HTML::HTML5::Parser, which can handle tag soup; the latter
chooses XML::LibXML, which cannot. Defaults to 'html'.
A set of options to be parsed to RDF::RDFa::Parser when looking
for endorsements. See RDF::RDFa::Parser::Config. The default is
A union graph of all graphs found in the document, as an
RDF::Trine::Model. Note that the returned model contains quads.
A union graph of only the endorsed graphs, as an RDF::Trine::Model.
Note that the returned model contains quads.
A single graph from the page.
A hashref where the keys are graph names and the values are
RDF::Trine::Models. Some graph names will be URIs, and others may be
blank nodes (e.g. "_:foobar").
"graphs" and "all_graphs" are aliases for each other.
Like "all_graphs", but only returns endorsed graphs. Note that all
endorsed graphs will have graph names that are URIs.
Returns a list of URIs which are the names of endorsed graphs. Note
that the presence of a URI $x in this list does not imply that
"$het->graph($x)" will be defined.
Returns the page DOM.
Returns the page URI.
Please report any bugs to .
Please forgive me in advance for inflicting this module upon you.
RDF::RDFa::Parser, RDF::Trine, RDF::TriN3.
Toby Inkster .
COPYRIGHT AND LICENSE
Copyright (C) 2010-2011 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
DISCLAIMER OF WARRANTIES
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.