blob: 6cd33cc569b718a233b173f53f2d904293713005 [file] [log] [blame]
Akron414ec952020-08-03 15:48:43 +02001use strict;
2use warnings;
3use utf8;
4use Test::More;
5use Benchmark ':hireswallclock';
6use Mojo::DOM;
7use Mojo::File;
8use Mojo::ByteStream 'b';
9use Data::Dumper;
10use File::Basename 'dirname';
11use File::Spec::Functions 'catdir';
12use lib 'lib', '../lib';
13
14use_ok('KorAP::XML::Krill');
15
16# ART
17my $path = catdir(dirname(__FILE__), 'corpus','artificial');
18ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
19#is($doc->path, $path . '/', 'Path');
20
21ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document');
22#is($doc->path, $path . '/', 'Path');
23
24ok($doc->parse, 'Parse document');
25
26my $meta = $doc->meta;
27
28# Metdata
29is($meta->{T_title}, 'Artificial Title', 'title');
30is($meta->{T_sub_title}, 'Artificial Subtitle', 'subTitle');
Akronaa166fa2022-11-10 14:15:14 +010031is($doc->text_sigle, 'A_RT/ABC/00001', 'ID');
32is($doc->corpus_sigle, 'A_RT', 'corpusID');
Akron414ec952020-08-03 15:48:43 +020033is($meta->{D_pub_date}, '20010402', 'pubDate');
34is($meta->{S_pub_place}, 'Mannheim', 'pubPlace');
35is($meta->{S_pub_place_key}, 'DE', 'pubPlace key');
36is($meta->{K_text_class}->[0], 'freizeit-unterhaltung', 'TextClass');
37is($meta->{K_text_class}->[1], 'vereine-veranstaltungen', 'TextClass');
38ok(!$meta->{K_text_class}->[2], 'TextClass');
39#is($doc->author->[0], 'Ruru', 'author');
40#is($doc->author->[1], 'Jens.Ol', 'author');
41#is($doc->author->[2], 'Aglarech', 'author');
42is($meta->{T_author}, 'Ruru; Jens.Ol; Aglarech; u.a.', 'author');
43
44# Additional information
45is($meta->{A_editor}, 'Nils Diewald', 'Editor');
46is($meta->{A_publisher}, 'Artificial articles Inc.', 'Publisher');
47is($meta->{D_creation_date}, '19990601', 'Creation date');
48#is($doc->coll_title, 'Artificial articles', 'Collection title');
49#is($doc->coll_sub_title, 'Best of!', 'Collection subtitle');
50#is($doc->coll_editor, 'Nils Diewald', 'Collection editor');
51#is($doc->coll_author, 'Nils Diewald', 'Collection author');
52is($meta->{S_text_type}, 'Zeitung: Tageszeitung', 'No text_type');
53is($meta->{S_text_type_art}, 'Bericht', 'text_type art');
54
Akron8ad06c42022-01-11 17:07:49 +010055use_ok('KorAP::XML::Meta::I5');
56
57$meta = new KorAP::XML::Meta::I5();
58
59is('data:application/x.korap-link;example=%20Das%20war%20einfach;title=Hallo%21,https%3A%2F%2Fwww.test.de',
60 $meta->korap_data_uri('https://www.test.de', title => 'Hallo!', example => ' Das war einfach'));
61
Akron414ec952020-08-03 15:48:43 +020062done_testing;
63__END__
64