Simplified and modularized metadata processing

Change-Id: I63e78fd5994126c954263324bcfc2fd9d51e39ea
diff --git a/t/sgbr/meta.t b/t/sgbr/meta.t
index c5f9b60..a1c15c0 100644
--- a/t/sgbr/meta.t
+++ b/t/sgbr/meta.t
@@ -11,7 +11,8 @@
 my $path = catdir(dirname(__FILE__), 'TEST', 'BSP', 1);
 
 ok(my $doc = KorAP::XML::Krill->new(
-  path => $path . '/'
+  path => $path . '/',
+  meta_type => 'Sgbr'
 ), 'Create Document');
 
 ok($doc->parse, 'Parse document');
@@ -23,46 +24,48 @@
 is($doc->doc_sigle, 'TEST_BSP', 'ID-doc');
 is($doc->corpus_sigle, 'TEST', 'ID-corpus');
 
-is($doc->title, 'Sommerüberraschung', 'title');
-is($doc->author, 'TEST.BSP.Autoren.1', 'Author');
-is($doc->store('sgbrAuthorAgeClass'), 'X', 'AgeClass');
+my $meta = $doc->meta;
 
-is($doc->store('sgbrAuthorSex'), 'M', 'Sex');
-is($doc->store('sgbrKodex'), 'M', 'Kodex');
+is($meta->{title}, 'Sommerüberraschung', 'title');
+is($meta->{author}, 'TEST.BSP.Autoren.1', 'Author');
+is($meta->{'sgbr_author_age_class'}, 'X', 'AgeClass');
 
-is($doc->doc_title, 'Beispielkorpus', 'Doc: title');
-is($doc->doc_sub_title, 'Subkorpus Beispieltext', 'Doc: subtitle');
+is($meta->{'sgbr_author_sex'}, 'M', 'Sex');
+is($meta->{'sgbr_kodex'}, 'M', 'Kodex');
 
-is($doc->language, 'de', 'Language');
+is($meta->{doc_title}, 'Beispielkorpus', 'Doc: title');
+is($meta->{doc_sub_title}, 'Subkorpus Beispieltext', 'Doc: subtitle');
 
-ok(!$doc->publisher, 'Publisher');
-ok(!$doc->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');
+is($meta->{language}, 'de', 'Language');
 
-ok(!$doc->doc_editor, 'Doc: editor');
-ok(!$doc->doc_author, 'Doc: author');
+ok(!$meta->{publisher}, 'Publisher');
+ok(!$meta->{editor}, 'Editor');
+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->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->{doc_editor}, 'Doc: editor');
+ok(!$meta->{doc_author}, 'Doc: 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}, 'Sommerüberraschung', 'Corpus title');
-is($hash->{store}->{sgbrAuthorSex}, 'M', 'store');
+is($hash->{sgbrAuthorSex}, 'M', 'additional');
 
 # Sgbr specific keywords
-is($doc->keywords_string, 'sgbrAuthorAgeClass:X sgbrAuthorSex:M sgbrKodex:M');
+is($meta->keywords('keywords'), 'sgbrAuthorAgeClass:X sgbrAuthorSex:M sgbrKodex:M');
 
 
 done_testing;