1dd239b291a3f7a1befa2bf541127751930552c2
[star2016] / star2016-abstracts.pl
1 #!/usr/bin/perl
2 use autodie;
3
4 use XML::TreePP;
5 use Data::Dump qw(dump);
6
7 my $tpp = XML::TreePP->new();
8 my $tree = $tpp->parsefile( "abstracts.xml" );
9
10 my $abstracts = delete $tree->{AbstractBook}->{abstract};
11
12 warn "# tree = ", dump($tree);
13
14
15 my $stat;
16 my $id2nr;
17
18 my $nr = 0;
19 foreach my $abstract ( @$abstracts ) {
20
21         my $id = $abstract->{'Id'} || die "no Id in ",dump($abstract);
22         warn "# $id abstract = ", dump($abstract);
23
24         foreach $k (qw( ContributionType )) {
25                 $stat->{$k}->{ $abstract->{$k} } ++;
26         }
27
28         foreach $f (@{ $abstract->{field} } ) {
29                 $f->{'-id'} == 1 ?  push @{ $stat->{_symposium}->{ $f->{'#text'} } }, $id :
30                 $f->{'-id'} == 2 ?  push @{ $stat->{_theme}->{ $f->{'#text'} } }, $id :
31                 "";
32
33                 $stat->{field}->{ $f->{'-id'} }++;
34         }
35         $id2nr->{ $id } = $nr++;
36 }
37
38 warn "# stat = ",dump($stat);