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 | 0e48977 | 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; |
| 28 | is($meta->{title}, 'Nur Platt, kein Deutsch', 'title'); |
| 29 | ok(!$meta->{sub_title}, 'no subtitle'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 30 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 31 | is($meta->{publisher}, 'Dorfblatt GmbH', 'Publisher'); |
| 32 | is($meta->{pub_date}, '20130126'); |
| 33 | is($meta->{sgbr_date}, '2013-01-26'); |
| 34 | is($meta->{pub_place}, 'Stadtingen'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 35 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 36 | is($meta->{doc_title}, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title'); |
| 37 | is($meta->{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 | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 39 | is($meta->{'funder'}, 'Bundesministerium für Bildung und Forschung', 'Funder'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 40 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 41 | is($meta->{author}, 'unbekannt', 'Author'); |
| 42 | ok(!$meta->{'sgbr_author_sex'}, 'No Sex'); |
| 43 | is($meta->{'sgbr_kodex'}, 'T', ''); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 44 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 45 | is($meta->keywords('keywords'), 'sgbrKodex:T'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 46 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 47 | is($meta->{language}, 'de', 'Language'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 48 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 49 | ok(!$meta->{editor}, 'Editor'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 50 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 51 | ok(!$meta->{text_type}, 'Text Type'); |
| 52 | ok(!$meta->{text_type_art}, 'Text Type Art'); |
| 53 | ok(!$meta->{text_type_ref}, 'Text Type Ref'); |
| 54 | ok(!$meta->{text_column}, 'Text Column'); |
| 55 | ok(!$meta->{text_domain}, 'Text Domain'); |
| 56 | ok(!$meta->{creation_date}, 'Creation Date'); |
| 57 | ok(!$meta->{license}, 'License'); |
| 58 | ok(!$meta->{pages}, 'Pages'); |
| 59 | ok(!$meta->{file_edition_statement}, 'File Edition Statement'); |
| 60 | ok(!$meta->{bibl_edition_statement}, 'Bibl Edition Statement'); |
| 61 | ok(!$meta->{reference}, 'Reference'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 62 | |
| 63 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 64 | ok(!$meta->{doc_editor}, 'Doc: editor'); |
| 65 | ok(!$meta->{doc_author}, 'Doc: author'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 66 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 67 | ok(!$meta->{corpus_title}, 'Corpus: title'); |
| 68 | ok(!$meta->{corpus_sub_title}, 'Corpus: subtitle'); |
| 69 | ok(!$meta->{corpus_editor}, 'Corpus: editor'); |
| 70 | ok(!$meta->{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__ |