blob: aa0fc10f06fe70d23b2eddd28c09d75c5ccb0a0b [file] [log] [blame]
Akronb2636cf2016-01-26 18:42:44 +01001use strict;
2use warnings;
3use Test::More;
4use File::Basename 'dirname';
5use File::Spec::Functions 'catdir';
6use Data::Dumper;
Akrone4c2e412016-01-28 15:10:50 +01007use KorAP::XML::Tokenizer;
8use KorAP::XML::Krill;
Akronb2636cf2016-01-26 18:42:44 +01009use utf8;
10
11my $path = catdir(dirname(__FILE__), 'TEST', 'BSP', 1);
12
Akrone4c2e412016-01-28 15:10:50 +010013ok(my $doc = KorAP::XML::Krill->new(
Akron35db6e32016-03-17 22:42:22 +010014 path => $path . '/',
15 meta_type => 'Sgbr'
Akronb2636cf2016-01-26 18:42:44 +010016), 'Create Document');
17
18ok($doc->parse, 'Parse document');
19
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +020020like($doc->path, qr!\Q$path\E/!, 'Path');
Akronb2636cf2016-01-26 18:42:44 +010021
22# Metdata
Akron1cd5b872016-03-22 00:23:46 +010023is($doc->text_sigle, 'TEST/BSP/1', 'ID-text');
24is($doc->doc_sigle, 'TEST/BSP', 'ID-doc');
Akronb2636cf2016-01-26 18:42:44 +010025is($doc->corpus_sigle, 'TEST', 'ID-corpus');
26
Akron35db6e32016-03-17 22:42:22 +010027my $meta = $doc->meta;
Akron15e6fa72016-02-04 15:02:20 +010028
Akron5eb3aa02019-01-25 18:30:47 +010029is($meta->{T_title}, 'Sommerüberraschung', 'title');
30is($meta->{T_author}, 'TEST.BSP.Autoren.1', 'Author');
31is($meta->{'S_sgbr_author_age_class'}, 'X', 'AgeClass');
Akrona8665782016-01-27 21:47:57 +010032
Akron5eb3aa02019-01-25 18:30:47 +010033is($meta->{'S_sgbr_author_sex'}, 'M', 'Sex');
34is($meta->{'S_sgbr_kodex'}, 'M', 'Kodex');
Akrona8665782016-01-27 21:47:57 +010035
Akron5eb3aa02019-01-25 18:30:47 +010036is($meta->{T_doc_title}, 'Beispielkorpus', 'Doc: title');
37is($meta->{T_doc_sub_title}, 'Subkorpus Beispieltext', 'Doc: subtitle');
Akrona8665782016-01-27 21:47:57 +010038
Akron5eb3aa02019-01-25 18:30:47 +010039is($meta->{S_language}, 'de', 'Language');
Akrona8665782016-01-27 21:47:57 +010040
Akron5eb3aa02019-01-25 18:30:47 +010041ok(!$meta->{A_publisher}, 'Publisher');
42ok(!$meta->{A_editor}, 'Editor');
43ok(!$meta->{S_text_type}, 'Text Type');
44ok(!$meta->{S_text_type_art}, 'Text Type Art');
45ok(!$meta->{S_text_type_ref}, 'Text Type Ref');
46ok(!$meta->{S_text_column}, 'Text Column');
47ok(!$meta->{S_text_domain}, 'Text Domain');
48ok(!$meta->{D_creation_date}, 'Creation Date');
Akron35db6e32016-03-17 22:42:22 +010049ok(!$meta->{license}, 'License');
50ok(!$meta->{pages}, 'Pages');
Akron5eb3aa02019-01-25 18:30:47 +010051ok(!$meta->{A_file_edition_statement}, 'File Edition Statement');
52ok(!$meta->{A_bibl_edition_statement}, 'Bibl Edition Statement');
53ok(!$meta->{A_reference}, 'Reference');
Akrona8665782016-01-27 21:47:57 +010054
Akron5eb3aa02019-01-25 18:30:47 +010055ok(!$meta->{A_doc_editor}, 'Doc: editor');
56ok(!$meta->{T_doc_author}, 'Doc: author');
Akron35db6e32016-03-17 22:42:22 +010057
Akron5eb3aa02019-01-25 18:30:47 +010058ok(!$meta->{T_corpus_title}, 'Corpus: title');
59ok(!$meta->{T_corpus_sub_title}, 'Corpus: subtitle');
60ok(!$meta->{A_corpus_editor}, 'Corpus: editor');
61ok(!$meta->{T_corpus_author}, 'Corpus: author');
Akronb2636cf2016-01-26 18:42:44 +010062
Akron12ef05b2016-01-31 23:58:53 +010063my $hash = $doc->to_hash;
64is($hash->{title}, 'Sommerüberraschung', 'Corpus title');
Akron35db6e32016-03-17 22:42:22 +010065is($hash->{sgbrAuthorSex}, 'M', 'additional');
Akron12ef05b2016-01-31 23:58:53 +010066
Akron15e6fa72016-02-04 15:02:20 +010067# Sgbr specific keywords
Akron5eb3aa02019-01-25 18:30:47 +010068is($meta->keywords('K_keywords'), 'sgbrAuthorAgeClass:X sgbrAuthorSex:M sgbrKodex:M');
Akron15e6fa72016-02-04 15:02:20 +010069
Akronfd0707e2016-02-11 22:13:36 +010070
Akronb2636cf2016-01-26 18:42:44 +010071done_testing;
Akrona8665782016-01-27 21:47:57 +010072
73
74__END__