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( |
| 14 | path => $path . '/' |
| 15 | ), 'Create Document'); |
| 16 | |
| 17 | ok($doc->parse, 'Parse document'); |
| 18 | |
| 19 | like($doc->path, qr!$path/!, 'Path'); |
| 20 | |
| 21 | # Metdata |
| 22 | is($doc->text_sigle, 'PRO-DUD_BSP-2013-01.32', 'ID-text'); |
| 23 | |
| 24 | is($doc->doc_sigle, 'PRO-DUD_BSP-2013-01', 'ID-doc'); |
| 25 | is($doc->corpus_sigle, 'PRO-DUD', 'ID-corpus'); |
| 26 | |
| 27 | is($doc->title, 'Nur Platt, kein Deutsch', 'title'); |
| 28 | ok(!$doc->sub_title, 'no subtitle'); |
| 29 | |
| 30 | is($doc->publisher, 'Dorfblatt GmbH', 'Publisher'); |
| 31 | is($doc->pub_date, '20130126'); |
Akron | 8c84aa5 | 2016-02-13 21:26:54 +0100 | [diff] [blame^] | 32 | is($doc->store('sgbrDate'), '2013-01-26'); |
Akron | a98a14c | 2016-02-12 16:28:39 +0100 | [diff] [blame] | 33 | is($doc->pub_place, 'Stadtingen'); |
| 34 | |
| 35 | is($doc->doc_title, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title'); |
| 36 | is($doc->doc_sub_title, 'Subkorpus Ortsblatt, Jahrgang 2013, Monat Januar', 'Doc Sub title'); |
| 37 | |
| 38 | is($doc->store('funder'), 'Bundesministerium für Bildung und Forschung', 'Funder'); |
| 39 | |
| 40 | is($doc->author, 'unbekannt', 'Author'); |
| 41 | ok(!$doc->store('sgbrAuthorSex'), 'No Sex'); |
| 42 | is($doc->store('sgbrKodex'), 'T', ''); |
| 43 | |
| 44 | is($doc->keywords_string, 'sgbrKodex:T'); |
| 45 | |
| 46 | is($doc->language, 'de', 'Language'); |
| 47 | |
| 48 | ok(!$doc->editor, 'Editor'); |
| 49 | |
| 50 | ok(!$doc->text_type, 'Text Type'); |
| 51 | ok(!$doc->text_type_art, 'Text Type Art'); |
| 52 | ok(!$doc->text_type_ref, 'Text Type Ref'); |
| 53 | ok(!$doc->text_column, 'Text Column'); |
| 54 | ok(!$doc->text_domain, 'Text Domain'); |
| 55 | ok(!$doc->creation_date, 'Creation Date'); |
| 56 | ok(!$doc->license, 'License'); |
| 57 | ok(!$doc->pages, 'Pages'); |
| 58 | ok(!$doc->file_edition_statement, 'File Edition Statement'); |
| 59 | ok(!$doc->bibl_edition_statement, 'Bibl Edition Statement'); |
| 60 | ok(!$doc->reference, 'Reference'); |
| 61 | |
| 62 | |
| 63 | ok(!$doc->doc_editor, 'Doc: editor'); |
| 64 | ok(!$doc->doc_author, 'Doc: author'); |
| 65 | |
| 66 | ok(!$doc->corpus_title, 'Corpus: title'); |
| 67 | ok(!$doc->corpus_sub_title, 'Corpus: subtitle'); |
| 68 | ok(!$doc->corpus_editor, 'Corpus: editor'); |
| 69 | ok(!$doc->corpus_author, 'Corpus: author'); |
| 70 | |
| 71 | my $hash = $doc->to_hash; |
| 72 | is($hash->{title}, 'Nur Platt, kein Deutsch', 'Corpus title'); |
| 73 | is($hash->{store}->{sgbrKodex}, 'T', 'store'); |
| 74 | |
| 75 | |
| 76 | done_testing; |
| 77 | |
| 78 | |
| 79 | __END__ |