blob: a1e2b8e921d66db25ec9e3a1d4bbb27cb86bf4ad [file] [log] [blame]
Akron14c7f672016-01-26 18:42:44 +01001use strict;
2use warnings;
3use Test::More;
4use File::Basename 'dirname';
5use File::Spec::Functions 'catdir';
6use Data::Dumper;
Akron8fa76bc2016-01-28 15:10:50 +01007use KorAP::XML::Tokenizer;
8use KorAP::XML::Krill;
Akron14c7f672016-01-26 18:42:44 +01009use utf8;
10
11my $path = catdir(dirname(__FILE__), 'TEST', 'BSP', 1);
12
Akron8fa76bc2016-01-28 15:10:50 +010013ok(my $doc = KorAP::XML::Krill->new(
Akron14c7f672016-01-26 18:42:44 +010014 path => $path . '/'
15), 'Create Document');
16
17ok($doc->parse, 'Parse document');
18
19like($doc->path, qr!$path/!, 'Path');
20
21# Metdata
22is($doc->text_sigle, 'TEST_BSP.1', 'ID-text');
23is($doc->doc_sigle, 'TEST_BSP', 'ID-doc');
24is($doc->corpus_sigle, 'TEST', 'ID-corpus');
25
Akron9d8cbc52016-01-27 21:47:57 +010026is($doc->title, 'Sommerüberraschung', 'title');
27#is($doc->sub_title, 'Beispiel Text Untertitel', 'title');
28#is($doc->pub_date, '20010402', 'Publication date');
29#is($doc->pub_place, 'Mannheim', 'Publication place');
Akrond3c33082016-02-04 15:02:20 +010030
Akron9d8cbc52016-01-27 21:47:57 +010031is($doc->author, 'TEST.BSP.Autoren.1', 'Author');
Akrond3c33082016-02-04 15:02:20 +010032
Akron9d8cbc52016-01-27 21:47:57 +010033is($doc->store('sgbrAuthorAgeClass'), 'X', 'AgeClass');
Akrond3c33082016-02-04 15:02:20 +010034
Akron9d8cbc52016-01-27 21:47:57 +010035is($doc->store('sgbrAuthorSex'), 'M', 'Sex');
36is($doc->store('sgbrKodex'), 'M', 'Kodex');
37
38is($doc->doc_title, 'Beispielkorpus', 'Doc: title');
39is($doc->doc_sub_title, 'Subkorpus Beispieltext', 'Doc: subtitle');
40
41is($doc->language, 'de', 'Language');
42
43ok(!$doc->publisher, 'Publisher');
44ok(!$doc->editor, 'Editor');
45ok(!$doc->text_type, 'Text Type');
46ok(!$doc->text_type_art, 'Text Type Art');
47ok(!$doc->text_type_ref, 'Text Type Ref');
48ok(!$doc->text_column, 'Text Column');
49ok(!$doc->text_domain, 'Text Domain');
50ok(!$doc->creation_date, 'Creation Date');
51ok(!$doc->license, 'License');
52ok(!$doc->pages, 'Pages');
53ok(!$doc->file_edition_statement, 'File Edition Statement');
54ok(!$doc->bibl_edition_statement, 'Bibl Edition Statement');
55ok(!$doc->reference, 'Reference');
56
57ok(!$doc->doc_editor, 'Doc: editor');
58ok(!$doc->doc_author, 'Doc: author');
59
60ok(!$doc->corpus_title, 'Corpus: title');
61ok(!$doc->corpus_sub_title, 'Corpus: subtitle');
62ok(!$doc->corpus_editor, 'Corpus: editor');
63ok(!$doc->corpus_author, 'Corpus: author');
Akron14c7f672016-01-26 18:42:44 +010064
Akron88986742016-01-31 23:58:53 +010065my $hash = $doc->to_hash;
66is($hash->{title}, 'Sommerüberraschung', 'Corpus title');
67is($hash->{store}->{sgbrAuthorSex}, 'M', 'store');
68
Akrond3c33082016-02-04 15:02:20 +010069# Sgbr specific keywords
70is($doc->keywords_string, 'sgbrAuthorAgeClass:X sgbrAuthorSex:M sgbrKodex:M');
71
Akron14c7f672016-01-26 18:42:44 +010072done_testing;
Akron9d8cbc52016-01-27 21:47:57 +010073
74
75__END__