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'); |
| 32 | is($doc->pub_place, 'Stadtingen'); |
| 33 | |
| 34 | is($doc->doc_title, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title'); |
| 35 | is($doc->doc_sub_title, 'Subkorpus Ortsblatt, Jahrgang 2013, Monat Januar', 'Doc Sub title'); |
| 36 | |
| 37 | is($doc->store('funder'), 'Bundesministerium für Bildung und Forschung', 'Funder'); |
| 38 | |
| 39 | is($doc->author, 'unbekannt', 'Author'); |
| 40 | ok(!$doc->store('sgbrAuthorSex'), 'No Sex'); |
| 41 | is($doc->store('sgbrKodex'), 'T', ''); |
| 42 | |
| 43 | is($doc->keywords_string, 'sgbrKodex:T'); |
| 44 | |
| 45 | is($doc->language, 'de', 'Language'); |
| 46 | |
| 47 | ok(!$doc->editor, 'Editor'); |
| 48 | |
| 49 | ok(!$doc->text_type, 'Text Type'); |
| 50 | ok(!$doc->text_type_art, 'Text Type Art'); |
| 51 | ok(!$doc->text_type_ref, 'Text Type Ref'); |
| 52 | ok(!$doc->text_column, 'Text Column'); |
| 53 | ok(!$doc->text_domain, 'Text Domain'); |
| 54 | ok(!$doc->creation_date, 'Creation Date'); |
| 55 | ok(!$doc->license, 'License'); |
| 56 | ok(!$doc->pages, 'Pages'); |
| 57 | ok(!$doc->file_edition_statement, 'File Edition Statement'); |
| 58 | ok(!$doc->bibl_edition_statement, 'Bibl Edition Statement'); |
| 59 | ok(!$doc->reference, 'Reference'); |
| 60 | |
| 61 | |
| 62 | ok(!$doc->doc_editor, 'Doc: editor'); |
| 63 | ok(!$doc->doc_author, 'Doc: author'); |
| 64 | |
| 65 | ok(!$doc->corpus_title, 'Corpus: title'); |
| 66 | ok(!$doc->corpus_sub_title, 'Corpus: subtitle'); |
| 67 | ok(!$doc->corpus_editor, 'Corpus: editor'); |
| 68 | ok(!$doc->corpus_author, 'Corpus: author'); |
| 69 | |
| 70 | my $hash = $doc->to_hash; |
| 71 | is($hash->{title}, 'Nur Platt, kein Deutsch', 'Corpus title'); |
| 72 | is($hash->{store}->{sgbrKodex}, 'T', 'store'); |
| 73 | |
| 74 | |
| 75 | done_testing; |
| 76 | |
| 77 | |
| 78 | __END__ |