line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::NewsML_G2::Concept; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
6626
|
use XML::NewsML_G2::Media_Topic; |
|
18
|
|
|
|
|
65
|
|
|
18
|
|
|
|
|
689
|
|
4
|
18
|
|
|
18
|
|
8966
|
use XML::NewsML_G2::Facet; |
|
18
|
|
|
|
|
66
|
|
|
18
|
|
|
|
|
655
|
|
5
|
|
|
|
|
|
|
|
6
|
18
|
|
|
18
|
|
131
|
use Moose; |
|
18
|
|
|
|
|
352
|
|
|
18
|
|
|
|
|
114
|
|
7
|
18
|
|
|
18
|
|
109806
|
use namespace::autoclean; |
|
18
|
|
|
|
|
43
|
|
|
18
|
|
|
|
|
113
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has 'main', is => 'ro', isa => 'XML::NewsML_G2::Media_Topic'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'facets', |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => 'HashRef[XML::NewsML_G2::Facet]', |
14
|
|
|
|
|
|
|
default => sub { {} }, |
15
|
|
|
|
|
|
|
traits => ['Hash'], |
16
|
|
|
|
|
|
|
handles => { has_facets => 'count' }; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub add_facet { |
19
|
4
|
|
|
4
|
1
|
10
|
my ( $self, $facet ) = @_; |
20
|
4
|
50
|
|
|
|
95
|
return if exists $self->facets->{ $facet->qcode }; |
21
|
4
|
|
|
|
|
95
|
$self->facets->{ $facet->qcode } = $facet; |
22
|
4
|
|
|
|
|
9
|
return 1; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub uid { |
26
|
4
|
|
|
4
|
1
|
9
|
my ($self) = @_; |
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
87
|
return join( '/', $self->main->qcode, sort keys %{ $self->facets } ); |
|
4
|
|
|
|
|
88
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
XML::NewsML_G2::Concept - a concept covered in the news item, |
39
|
|
|
|
|
|
|
taken from a standardized controlled vocabulary |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $mt = XML::NewsML_G2::Media_Topic->new |
44
|
|
|
|
|
|
|
(name => 'alpine skiing', qcode => 20001057); |
45
|
|
|
|
|
|
|
my $facet = XML::NewsML_G2::Facet->new |
46
|
|
|
|
|
|
|
(name => 'alpine skiing slalom', |
47
|
|
|
|
|
|
|
qcode => 'aspfacetvalue:slalom-alpineskiing' |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
my $concept = XML::NewsML_G2::Concept->new(main => $mt); |
50
|
|
|
|
|
|
|
$concept->add_facet($facet); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=over 4 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item facets |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Hash mapping qcodes to L<XML::NewsML_G2::Facet> instances |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=back |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 METHODS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=over 4 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item add_facet |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Add a new L<XML::NewsML_G2::Facet> instance |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item uid |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Returns a generated unique id for this concept based on the qcodes of its main concept and its facets |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=back |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHOR |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Christian Eder C<< <christian.eder@apa.at> >> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 LICENCE AND COPYRIGHT |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Copyright (c) 2019, APA-IT. All rights reserved. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
See L<XML::NewsML_G2> for the license. |