line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::NewsML_G2::Writer::Substancial_Item; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
9678
|
use Moose; |
|
18
|
|
|
|
|
48
|
|
|
18
|
|
|
|
|
109
|
|
4
|
18
|
|
|
18
|
|
107886
|
use namespace::autoclean; |
|
18
|
|
|
|
|
45
|
|
|
18
|
|
|
|
|
118
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
extends 'XML::NewsML_G2::Writer'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub _create_subjects_media_topic { |
9
|
66
|
|
|
66
|
|
165
|
my $self = shift; |
10
|
66
|
|
|
|
|
154
|
my @res; |
11
|
|
|
|
|
|
|
|
12
|
66
|
100
|
|
|
|
1745
|
push @res, $self->doc->createComment('media topics') |
13
|
|
|
|
|
|
|
if $self->_root_item->has_media_topics; |
14
|
66
|
|
|
|
|
196
|
foreach my $mt_qcode ( sort keys %{ $self->_root_item->media_topics } ) { |
|
66
|
|
|
|
|
1699
|
|
15
|
160
|
|
|
|
|
4861
|
my $mt = $self->_root_item->media_topics->{$mt_qcode}; |
16
|
160
|
100
|
|
|
|
4358
|
my $why = $mt->direct ? 'why:direct' : 'why:ancestor'; |
17
|
160
|
|
|
|
|
556
|
push @res, |
18
|
|
|
|
|
|
|
my $s = $self->create_element( |
19
|
|
|
|
|
|
|
'subject', |
20
|
|
|
|
|
|
|
type => 'cpnat:abstract', |
21
|
|
|
|
|
|
|
why => $why, |
22
|
|
|
|
|
|
|
_name_text => $mt |
23
|
|
|
|
|
|
|
); |
24
|
160
|
|
|
|
|
7841
|
$self->scheme_manager->add_qcode_or_literal( $s, 'medtop', |
25
|
|
|
|
|
|
|
$mt->qcode ); |
26
|
160
|
|
|
|
|
330
|
foreach my $lang ( sort keys %{ $mt->translations } ) { |
|
160
|
|
|
|
|
4973
|
|
27
|
|
|
|
|
|
|
$s->appendChild( |
28
|
|
|
|
|
|
|
$self->create_element( |
29
|
|
|
|
|
|
|
'name', |
30
|
|
|
|
|
|
|
'xml:lang' => $lang, |
31
|
159
|
|
|
|
|
4508
|
_text => $mt->translations->{$lang} |
32
|
|
|
|
|
|
|
) |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
160
|
100
|
|
|
|
7648
|
if ( $mt->parent ) { |
36
|
106
|
|
|
|
|
368
|
$s->appendChild( my $b = $self->create_element('broader') ); |
37
|
106
|
|
|
|
|
334
|
$self->scheme_manager->add_qcode_or_literal( $b, 'medtop', |
38
|
|
|
|
|
|
|
$mt->parent->qcode ); |
39
|
106
|
|
|
|
|
581
|
my $hierarchy = $self->_create_hierarchy( $mt, 'medtop' ); |
40
|
106
|
100
|
|
|
|
415
|
$b->appendChild($hierarchy) if $hierarchy; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
66
|
|
|
|
|
5154
|
return @res; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _create_subject_concept { |
47
|
6
|
|
|
6
|
|
16
|
my ( $self, $name, $item, $qcode_prefix ) = @_; |
48
|
|
|
|
|
|
|
|
49
|
6
|
|
|
|
|
24
|
my $elem = $self->create_element( $name, _name_text => $item ); |
50
|
6
|
|
|
|
|
241
|
$self->scheme_manager->add_qcode_or_literal( $elem, $qcode_prefix, |
51
|
|
|
|
|
|
|
$item->qcode ); |
52
|
6
|
|
|
|
|
12
|
foreach my $lang ( sort keys %{ $item->translations } ) { |
|
6
|
|
|
|
|
224
|
|
53
|
|
|
|
|
|
|
$elem->appendChild( |
54
|
|
|
|
|
|
|
$self->create_element( |
55
|
|
|
|
|
|
|
'name', |
56
|
|
|
|
|
|
|
'xml:lang' => $lang, |
57
|
0
|
|
|
|
|
0
|
_text => $item->translations->{$lang} |
58
|
|
|
|
|
|
|
) |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
} |
61
|
6
|
|
|
|
|
45
|
return $elem; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _create_subjects_concepts { |
65
|
3
|
|
|
3
|
|
7
|
my ($self) = @_; |
66
|
|
|
|
|
|
|
|
67
|
3
|
|
|
|
|
18
|
my @res; |
68
|
3
|
100
|
|
|
|
73
|
push @res, $self->doc->createComment('concepts') |
69
|
|
|
|
|
|
|
if $self->_root_item->has_concepts; |
70
|
3
|
|
|
|
|
8
|
foreach my $concept_uid ( sort keys %{ $self->_root_item->concepts } ) { |
|
3
|
|
|
|
|
80
|
|
71
|
2
|
|
|
|
|
47
|
my $concept = $self->_root_item->concepts->{$concept_uid}; |
72
|
2
|
|
|
|
|
8
|
push @res, my $s = $self->create_element('subject'); |
73
|
2
|
|
|
|
|
52
|
$s->appendChild( |
74
|
|
|
|
|
|
|
$self->_create_subject_concept( |
75
|
|
|
|
|
|
|
'mainConcept', $concept->main, 'medtop' |
76
|
|
|
|
|
|
|
) |
77
|
|
|
|
|
|
|
); |
78
|
2
|
|
|
|
|
6
|
foreach my $facet_qcode ( sort keys %{ $concept->facets } ) { |
|
2
|
|
|
|
|
83
|
|
79
|
4
|
|
|
|
|
123
|
my $facet = $concept->facets->{$facet_qcode}; |
80
|
4
|
|
|
|
|
21
|
my ($facet_cls) = reverse split '::', $facet->meta->name; |
81
|
4
|
|
|
|
|
98
|
$s->appendChild( |
82
|
|
|
|
|
|
|
$self->_create_subject_concept( |
83
|
|
|
|
|
|
|
'facetConcept', $facet, lc $facet_cls |
84
|
|
|
|
|
|
|
) |
85
|
|
|
|
|
|
|
); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
3
|
|
|
|
|
43
|
return @res; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 NAME |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
XML::NewsML_G2::Writer::Substancial_Item - base class for writers |
101
|
|
|
|
|
|
|
creating DOM trees conforming to substancial items |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 DESCRIPTION |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This module acts as a base class e.g. for event item writers and news item |
106
|
|
|
|
|
|
|
writers. |
107
|
|
|
|
|
|
|
See L<XML::NewsML_G2::Writer::News_Item>, L<XML::NewsML_G2::Writer::Event_Item>. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 AUTHOR |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Christian Eder C<< <christian.eder@apa.at> >> |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 LICENCE AND COPYRIGHT |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Copyright (c) 2019, APA-IT. All rights reserved. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
See L<XML::NewsML_G2> for the license. |