File: 10trine.t

package info (click to toggle)
librdf-rdfa-parser-perl 1.097-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,948 kB
  • sloc: perl: 6,582; makefile: 7; xml: 6; sh: 1
file content (44 lines) | stat: -rw-r--r-- 938 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use Test::More tests => 6;
use RDF::Trine qw(iri literal);
use RDF::TrineX::Parser::RDFa;
use Data::Dumper;

my $parser = new_ok 'RDF::Trine::Parser' => ['xhtmlrdfa11'];
isa_ok $parser => 'RDF::Trine::Parser';
isa_ok $parser => 'RDF::TrineX::Parser::RDFa';
isa_ok $parser => 'RDF::TrineX::Parser::XHTML_RDFa11';
can_ok $parser => qw(
	parse_url_into_model
	parse_into_model
	parse
	parse_file_into_model
	parse_file
);

my $model = RDF::Trine::Model->new;
$parser->parse_file_into_model(
	'http://www.example.com/',
	\*DATA  => $model,
	context => iri('http://www.example.com/graph'),
);

ok(
	$model->count_statements(
		iri('http://www.example.com/'),
		iri('http://purl.org/dc/terms/title'),
		literal('Hello', 'en'),
		iri('http://www.example.com/graph'),
	)
);


__DATA__
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<head>
		<title property="dc:title">Hello</title>
	</head>
	<body>
		<p>Hello World</p>
	</body>
</html>