Simplified and modularized metadata processing
Change-Id: I63e78fd5994126c954263324bcfc2fd9d51e39ea
diff --git a/t/sgbr/meta_duden.t b/t/sgbr/meta_duden.t
index 7cae3c5..c808022 100644
--- a/t/sgbr/meta_duden.t
+++ b/t/sgbr/meta_duden.t
@@ -11,7 +11,8 @@
my $path = catdir(dirname(__FILE__), 'PRO-DUD', 'BSP-2013-01', 32);
ok(my $doc = KorAP::XML::Krill->new(
- path => $path . '/'
+ path => $path . '/',
+ meta_type => 'Sgbr'
), 'Create Document');
ok($doc->parse, 'Parse document');
@@ -20,57 +21,57 @@
# Metdata
is($doc->text_sigle, 'PRO-DUD_BSP-2013-01.32', 'ID-text');
-
is($doc->doc_sigle, 'PRO-DUD_BSP-2013-01', 'ID-doc');
is($doc->corpus_sigle, 'PRO-DUD', 'ID-corpus');
-is($doc->title, 'Nur Platt, kein Deutsch', 'title');
-ok(!$doc->sub_title, 'no subtitle');
+my $meta = $doc->meta;
+is($meta->{title}, 'Nur Platt, kein Deutsch', 'title');
+ok(!$meta->{sub_title}, 'no subtitle');
-is($doc->publisher, 'Dorfblatt GmbH', 'Publisher');
-is($doc->pub_date, '20130126');
-is($doc->store('sgbrDate'), '2013-01-26');
-is($doc->pub_place, 'Stadtingen');
+is($meta->{publisher}, 'Dorfblatt GmbH', 'Publisher');
+is($meta->{pub_date}, '20130126');
+is($meta->{sgbr_date}, '2013-01-26');
+is($meta->{pub_place}, 'Stadtingen');
-is($doc->doc_title, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title');
-is($doc->doc_sub_title, 'Subkorpus Ortsblatt, Jahrgang 2013, Monat Januar', 'Doc Sub title');
+is($meta->{doc_title}, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title');
+is($meta->{doc_sub_title}, 'Subkorpus Ortsblatt, Jahrgang 2013, Monat Januar', 'Doc Sub title');
-is($doc->store('funder'), 'Bundesministerium für Bildung und Forschung', 'Funder');
+is($meta->{'funder'}, 'Bundesministerium für Bildung und Forschung', 'Funder');
-is($doc->author, 'unbekannt', 'Author');
-ok(!$doc->store('sgbrAuthorSex'), 'No Sex');
-is($doc->store('sgbrKodex'), 'T', '');
+is($meta->{author}, 'unbekannt', 'Author');
+ok(!$meta->{'sgbr_author_sex'}, 'No Sex');
+is($meta->{'sgbr_kodex'}, 'T', '');
-is($doc->keywords_string, 'sgbrKodex:T');
+is($meta->keywords('keywords'), 'sgbrKodex:T');
-is($doc->language, 'de', 'Language');
+is($meta->{language}, 'de', 'Language');
-ok(!$doc->editor, 'Editor');
+ok(!$meta->{editor}, 'Editor');
-ok(!$doc->text_type, 'Text Type');
-ok(!$doc->text_type_art, 'Text Type Art');
-ok(!$doc->text_type_ref, 'Text Type Ref');
-ok(!$doc->text_column, 'Text Column');
-ok(!$doc->text_domain, 'Text Domain');
-ok(!$doc->creation_date, 'Creation Date');
-ok(!$doc->license, 'License');
-ok(!$doc->pages, 'Pages');
-ok(!$doc->file_edition_statement, 'File Edition Statement');
-ok(!$doc->bibl_edition_statement, 'Bibl Edition Statement');
-ok(!$doc->reference, 'Reference');
+ok(!$meta->{text_type}, 'Text Type');
+ok(!$meta->{text_type_art}, 'Text Type Art');
+ok(!$meta->{text_type_ref}, 'Text Type Ref');
+ok(!$meta->{text_column}, 'Text Column');
+ok(!$meta->{text_domain}, 'Text Domain');
+ok(!$meta->{creation_date}, 'Creation Date');
+ok(!$meta->{license}, 'License');
+ok(!$meta->{pages}, 'Pages');
+ok(!$meta->{file_edition_statement}, 'File Edition Statement');
+ok(!$meta->{bibl_edition_statement}, 'Bibl Edition Statement');
+ok(!$meta->{reference}, 'Reference');
-ok(!$doc->doc_editor, 'Doc: editor');
-ok(!$doc->doc_author, 'Doc: author');
+ok(!$meta->{doc_editor}, 'Doc: editor');
+ok(!$meta->{doc_author}, 'Doc: author');
-ok(!$doc->corpus_title, 'Corpus: title');
-ok(!$doc->corpus_sub_title, 'Corpus: subtitle');
-ok(!$doc->corpus_editor, 'Corpus: editor');
-ok(!$doc->corpus_author, 'Corpus: author');
+ok(!$meta->{corpus_title}, 'Corpus: title');
+ok(!$meta->{corpus_sub_title}, 'Corpus: subtitle');
+ok(!$meta->{corpus_editor}, 'Corpus: editor');
+ok(!$meta->{corpus_author}, 'Corpus: author');
my $hash = $doc->to_hash;
is($hash->{title}, 'Nur Platt, kein Deutsch', 'Corpus title');
-is($hash->{store}->{sgbrKodex}, 'T', 'store');
+is($hash->{sgbrKodex}, 'T', 'store');
done_testing;