Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 1 | use strict; |
| 2 | use warnings; |
| 3 | use Test::More; |
| 4 | use File::Basename 'dirname'; |
| 5 | use File::Spec::Functions 'catdir'; |
| 6 | use Data::Dumper; |
| 7 | use KorAP::XML::Tokenizer; |
| 8 | use KorAP::XML::Krill; |
| 9 | use utf8; |
| 10 | |
| 11 | my $path = catdir(dirname(__FILE__), 'PRO-DUD', 'BSP-2013-01', 32); |
| 12 | |
| 13 | ok(my $doc = KorAP::XML::Krill->new( |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 14 | path => $path . '/', |
| 15 | meta_type => 'Sgbr' |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 16 | ), 'Create Document'); |
| 17 | |
| 18 | ok($doc->parse, 'Parse document'); |
| 19 | |
Nils Diewald | b3e9ccd | 2016-10-24 15:16:52 +0200 | [diff] [blame] | 20 | like($doc->path, qr!\Q$path\E/!, 'Path'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 21 | |
| 22 | # Metdata |
Akron | 1cd5b87 | 2016-03-22 00:23:46 +0100 | [diff] [blame] | 23 | is($doc->text_sigle, 'PRO-DUD/BSP-2013-01/32', 'ID-text'); |
| 24 | is($doc->doc_sigle, 'PRO-DUD/BSP-2013-01', 'ID-doc'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 25 | is($doc->corpus_sigle, 'PRO-DUD', 'ID-corpus'); |
| 26 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 27 | my $meta = $doc->meta; |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 28 | is($meta->{T_title}, 'Nur Platt, kein Deutsch', 'title'); |
| 29 | ok(!$meta->{T_sub_title}, 'no subtitle'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 30 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 31 | is($meta->{A_publisher}, 'Dorfblatt GmbH', 'Publisher'); |
| 32 | is($meta->{D_pub_date}, '20130126'); |
| 33 | is($meta->{D_sgbr_date}, '2013-01-26'); |
| 34 | is($meta->{S_pub_place}, 'Stadtingen'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 35 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 36 | is($meta->{T_doc_title}, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title'); |
| 37 | is($meta->{T_doc_sub_title}, 'Subkorpus Ortsblatt, Jahrgang 2013, Monat Januar', 'Doc Sub title'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 38 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 39 | is($meta->{'A_funder'}, 'Bundesministerium für Bildung und Forschung', 'Funder'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 40 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 41 | is($meta->{T_author}, 'unbekannt', 'Author'); |
| 42 | ok(!$meta->{'S_sgbr_author_sex'}, 'No Sex'); |
| 43 | is($meta->{'S_sgbr_kodex'}, 'T', ''); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 44 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 45 | is($meta->keywords('K_keywords'), 'sgbrKodex:T'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 46 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 47 | is($meta->{S_language}, 'de', 'Language'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 48 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 49 | ok(!$meta->{A_editor}, 'Editor'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 50 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 51 | ok(!$meta->{S_text_type}, 'Text Type'); |
| 52 | ok(!$meta->{S_text_type_art}, 'Text Type Art'); |
| 53 | ok(!$meta->{S_text_type_ref}, 'Text Type Ref'); |
| 54 | ok(!$meta->{S_text_column}, 'Text Column'); |
| 55 | ok(!$meta->{S_text_domain}, 'Text Domain'); |
| 56 | ok(!$meta->{D_creation_date}, 'Creation Date'); |
| 57 | ok(!$meta->{A_license}, 'License'); |
| 58 | ok(!$meta->{A_pages}, 'Pages'); |
| 59 | ok(!$meta->{A_file_edition_statement}, 'File Edition Statement'); |
| 60 | ok(!$meta->{A_bibl_edition_statement}, 'Bibl Edition Statement'); |
| 61 | ok(!$meta->{A_reference}, 'Reference'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 62 | |
| 63 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 64 | ok(!$meta->{A_doc_editor}, 'Doc: editor'); |
| 65 | ok(!$meta->{T_doc_author}, 'Doc: author'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 66 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 67 | ok(!$meta->{T_corpus_title}, 'Corpus: title'); |
| 68 | ok(!$meta->{T_corpus_sub_title}, 'Corpus: subtitle'); |
| 69 | ok(!$meta->{A_corpus_editor}, 'Corpus: editor'); |
| 70 | ok(!$meta->{T_corpus_author}, 'Corpus: author'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 71 | |
| 72 | my $hash = $doc->to_hash; |
| 73 | is($hash->{title}, 'Nur Platt, kein Deutsch', 'Corpus title'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 74 | is($hash->{sgbrKodex}, 'T', 'store'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 75 | |
| 76 | |
| 77 | done_testing; |
| 78 | |
| 79 | |
| 80 | __END__ |