blob: deea71f38a1f256f26775705e40a9dbb96361073 [file] [log] [blame]
Akrona8665782016-01-27 21:47:57 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
Akron35db6e32016-03-17 22:42:22 +01005use JSON::XS;
Akrona8665782016-01-27 21:47:57 +01006use Test::More;
7use Scalar::Util qw/weaken/;
8use Data::Dumper;
Akron151676d2016-03-14 20:12:14 +01009use lib 't/annotation';
Akrona8665782016-01-27 21:47:57 +010010use TestInit;
11use File::Basename 'dirname';
12use File::Spec::Functions 'catdir';
13
14
15my $path = catdir(dirname(__FILE__), 'corpus', 'doc', '0001');
16
Akrone4c2e412016-01-28 15:10:50 +010017ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Akrona8665782016-01-27 21:47:57 +010018ok($doc->parse, 'Parse document');
Nils Diewaldb3e9ccd2016-10-24 15:16:52 +020019like($doc->path, qr!\Q$path\E/!, 'Path');
Akrona8665782016-01-27 21:47:57 +010020
21# Metdata
Akron1cd5b872016-03-22 00:23:46 +010022is($doc->text_sigle, 'Corpus/Doc/0001', 'ID-text');
23is($doc->doc_sigle, 'Corpus/Doc', 'ID-doc');
Akrona8665782016-01-27 21:47:57 +010024is($doc->corpus_sigle, 'Corpus', 'ID-corpus');
25
Akron35db6e32016-03-17 22:42:22 +010026my $meta = $doc->meta;
Akrona8665782016-01-27 21:47:57 +010027
Akron5eb3aa02019-01-25 18:30:47 +010028is($meta->{T_title}, 'Beispiel Text', 'title');
29is($meta->{T_sub_title}, 'Beispiel Text Untertitel', 'title');
30is($meta->{D_pub_date}, '20010402', 'Publication date');
31is($meta->{S_pub_place}, 'Mannheim', 'Publication place');
32is($meta->{T_author}, 'Mustermann, Max', 'Author');
Akrona8665782016-01-27 21:47:57 +010033
Akron5eb3aa02019-01-25 18:30:47 +010034is($meta->{A_publisher}, 'Artificial articles Inc.', 'Publisher');
35is($meta->{A_editor}, 'Monika Mustermann', 'Editor');
36is($meta->{S_text_type}, 'Zeitung: Tageszeitung', 'Text Type');
37is($meta->{S_text_type_art}, 'Bericht', 'Text Type Art');
38is($meta->{S_text_type_ref}, 'Aphorismen', 'Text Type Ref');
39ok(!$meta->{S_text_column}, 'Text Column');
40ok(!$meta->{S_text_domain}, 'Text Domain');
41is($meta->{D_creation_date}, '19990601', 'Creation Date');
Akron35db6e32016-03-17 22:42:22 +010042ok(!$meta->{license}, 'License');
43ok(!$meta->{pages}, 'Pages');
Akron5eb3aa02019-01-25 18:30:47 +010044ok(!$meta->{A_file_edition_statement}, 'File Edition Statement');
45ok(!$meta->{A_bibl_edition_statement}, 'Bibl Edition Statement');
46ok(!$meta->{A_reference}, 'Reference');
47is($meta->{S_language}, 'de', 'Language');
Akrona8665782016-01-27 21:47:57 +010048
Akron5eb3aa02019-01-25 18:30:47 +010049is($meta->{T_doc_title}, 'Beispiel Dokument', 'Doc: title');
50ok(!$meta->{T_doc_sub_title}, 'Doc: subtitle');
51ok(!$meta->{A_doc_editor}, 'Doc: editor');
52ok(!$meta->{T_doc_author}, 'Doc: author');
Akron35db6e32016-03-17 22:42:22 +010053
Akron5eb3aa02019-01-25 18:30:47 +010054is($meta->{T_corpus_title}, 'Werke von Beispiel', 'Corpus: title');
55ok(!$meta->{T_corpus_sub_title}, 'Corpus: subtitle');
56is($meta->{A_corpus_editor}, 'Mustermann, Monika', 'Corpus: editor');
57is($meta->{T_corpus_author}, 'Mustermann, Max', 'Corpus: author');
Akron35db6e32016-03-17 22:42:22 +010058
Akrona8665782016-01-27 21:47:57 +010059
60done_testing;
61
62__END__