1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
use XML::GRDDL;
use LWP::Simple;
use RDF::TrineX::Functions -shortcuts;
my $grddl = XML::GRDDL->new();
my $url = 'http://example.com/document.html';
my $html = <<'HTML';
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://purl.org/NET/erdf/profile">
<title>Homepage</title>
<base href="http://example.org/about" />
<link rel="schema.foaf" href="http://xmlns.com/foaf/0.1/" />
</head>
<body>
<p id="ian"><a rel="foaf.homepage" href="http://example.org/home">my home page</a></p>
</body>
</html>
HTML
my $r = $grddl->data($html, $url, force_rel=>1, metadata=>1);
print rdf_string($r, 'nquads');
|