line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RDF::SKOS::OeNACE;
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
43974
|
use strict;
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
83
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
58
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use Data::Dumper;
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
122
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
12
|
use base 'RDF::SKOS';
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
674
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
2657
|
use Text::CSV_XS;
|
|
2
|
|
|
|
|
21611
|
|
|
2
|
|
|
|
|
2236
|
|
11
|
|
|
|
|
|
|
my $csv = Text::CSV_XS->new ({
|
12
|
|
|
|
|
|
|
quote_char => '"',
|
13
|
|
|
|
|
|
|
sep_char => ';',
|
14
|
|
|
|
|
|
|
binary => 1
|
15
|
|
|
|
|
|
|
});
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
RDF::SKOS::OeNACE - SKOS - OeNACE Classification Data
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use RDF::SKOS::OeNACE;
|
24
|
|
|
|
|
|
|
my $oenace = new RDF::SKOS::OeNACE;
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# this is a subclass of RDF::SKOS
|
27
|
|
|
|
|
|
|
@cs = $oenace->concepts;
|
28
|
|
|
|
|
|
|
...
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
To quote from L
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Auf nationaler Ebene wird ab 2008 die ÃNACE 2008 angewandt. Diese
|
35
|
|
|
|
|
|
|
Aktivitätsklassifikation untergliedert die europäische NACE
|
36
|
|
|
|
|
|
|
mittels Unterklassen noch detaillierter, sodass österreichische
|
37
|
|
|
|
|
|
|
Spezifika berücksichtigt werden können. Ihr Code ist 5-stellig
|
38
|
|
|
|
|
|
|
und stimmt bis zur 4. Stelle mit der NACE überein. Die
|
39
|
|
|
|
|
|
|
Unterklassen werden dabei durch die mit Bindestrich abgetrennte
|
40
|
|
|
|
|
|
|
letzte Ziffer des Codes dargestellt.
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
B: I is the usual euphemism of our local
|
43
|
|
|
|
|
|
|
buerocracy. Austria is ... special.
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This package implements an SKOS view over this data. It is a subclass L.
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 SKOS Interpretations
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=over
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
The data contains german (C) and english (C) preferred labels.
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
As hidden label the alphanumeric code is used. It is also the ID.
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
No other I, I, I, .... are available.
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
There is no I information.
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
As for the parent class, there is no *Match functionality.
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=back
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 Limitations
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=over
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
C does not respect transitivity. Same with C.
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=back
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 INTERFACE
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 Constructor
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
The constructor does not expect any parameters.
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
our %SKOS;
|
93
|
|
|
|
|
|
|
sub _initialize {
|
94
|
1
|
|
|
1
|
|
4
|
; # skip first
|
95
|
1
|
|
|
|
|
5
|
while ($_ = ) {
|
96
|
1698
|
100
|
|
|
|
6031
|
last if /----/;
|
97
|
1697
|
|
|
|
|
5575
|
$csv->parse ($_);
|
98
|
1697
|
|
|
|
|
41944
|
my @fs = $csv->fields ();
|
99
|
1697
|
|
|
|
|
28370
|
$SKOS{$fs[1]} = [ @fs[2,3] ];
|
100
|
|
|
|
|
|
|
}
|
101
|
1
|
|
|
|
|
2
|
; # skip first
|
102
|
1
|
|
|
|
|
6
|
while ($_ = ) {
|
103
|
1697
|
|
|
|
|
4922
|
$csv->parse ($_);
|
104
|
1697
|
|
|
|
|
35731
|
my @fs = $csv->fields ();
|
105
|
1697
|
|
|
|
|
13857
|
push @{ $SKOS{$fs[1]} }, $fs[3];
|
|
1697
|
|
|
|
|
10092
|
|
106
|
|
|
|
|
|
|
}
|
107
|
|
|
|
|
|
|
|
108
|
1
|
|
|
|
|
1807
|
foreach my $k (keys %SKOS ) { #-- internal consistency check
|
109
|
1697
|
50
|
|
|
|
1982
|
die "inconsistent data" unless scalar @{ $SKOS{$k} } == 3;
|
|
1697
|
|
|
|
|
4353
|
|
110
|
|
|
|
|
|
|
}
|
111
|
|
|
|
|
|
|
}
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub new {
|
115
|
5
|
|
|
5
|
0
|
3098
|
my $class = shift;
|
116
|
5
|
100
|
|
|
|
26
|
_initialize unless %SKOS;
|
117
|
5
|
|
|
|
|
135
|
my $self = bless {}, $class;
|
118
|
5
|
|
|
|
|
19
|
return $self;
|
119
|
|
|
|
|
|
|
}
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=pod
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 Methods
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
See also L.
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=over
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item B
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Different to the superclass, this method is read-only.
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub concept {
|
136
|
13
|
|
|
13
|
1
|
7243
|
my $self = shift;
|
137
|
13
|
|
|
|
|
21
|
my $id = shift;
|
138
|
13
|
50
|
|
|
|
74
|
return new RDF::SKOS::Concept ($self, $id) if $SKOS{$id};
|
139
|
|
|
|
|
|
|
}
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub concepts {
|
142
|
2
|
|
|
2
|
1
|
15
|
my $self = shift;
|
143
|
2
|
|
|
|
|
477
|
return map { new RDF::SKOS::Concept ($self, $_) } keys %SKOS;
|
|
3394
|
|
|
|
|
8488
|
|
144
|
|
|
|
|
|
|
}
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=pod
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item B
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
As OeNACE does not have any explicit scheme, this will return an empty list.
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item B
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
As there are no scheme, we will die here.
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=cut
|
157
|
|
|
|
|
|
|
|
158
|
1
|
|
|
1
|
1
|
8
|
sub scheme { die "no schemeing"; }
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=pod
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item B
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
While there are no schemes, there are top concepts in OeNACE. These
|
165
|
|
|
|
|
|
|
are those with a single letter ID (A, B, C, ...) and these will be
|
166
|
|
|
|
|
|
|
returned. Any scheme parameter will be ignored.
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=cut
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub topConcepts {
|
171
|
1
|
|
|
1
|
1
|
1347
|
my $self = shift;
|
172
|
|
|
|
|
|
|
return
|
173
|
21
|
|
|
|
|
55
|
map { new RDF::SKOS::Concept ($self, $_) }
|
|
1697
|
|
|
|
|
3381
|
|
174
|
1
|
|
|
|
|
376
|
grep { $_ =~ /^[A-Z]$/}
|
175
|
|
|
|
|
|
|
keys %SKOS;
|
176
|
|
|
|
|
|
|
}
|
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub prefLabels {
|
179
|
1697
|
|
|
1697
|
1
|
2110
|
my $self = shift;
|
180
|
1697
|
|
|
|
|
2610
|
my $id = shift;
|
181
|
|
|
|
|
|
|
return
|
182
|
1697
|
|
|
|
|
12559
|
[ $SKOS{$id} [1], 'de' ],
|
183
|
|
|
|
|
|
|
[ $SKOS{$id} [2], 'en' ];
|
184
|
|
|
|
|
|
|
}
|
185
|
|
|
|
|
|
|
|
186
|
1697
|
|
|
1697
|
1
|
7870
|
sub altLabels { () }
|
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub hiddenLabels {
|
189
|
1697
|
|
|
1697
|
1
|
2064
|
my $self = shift;
|
190
|
1697
|
|
|
|
|
2275
|
my $id = shift;
|
191
|
1697
|
|
|
|
|
5865
|
return [ $id, undef ];
|
192
|
|
|
|
|
|
|
}
|
193
|
|
|
|
|
|
|
|
194
|
0
|
|
|
0
|
1
|
0
|
sub notes { () }
|
195
|
0
|
|
|
0
|
1
|
0
|
sub scopeNotes { () }
|
196
|
0
|
|
|
0
|
1
|
0
|
sub definitions { () }
|
197
|
0
|
|
|
0
|
1
|
0
|
sub examples { () }
|
198
|
0
|
|
|
0
|
1
|
0
|
sub historyNotes { () }
|
199
|
0
|
|
|
0
|
1
|
0
|
sub editorialNotes { () }
|
200
|
0
|
|
|
0
|
1
|
0
|
sub changeNotes { () }
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub narrower {
|
204
|
6
|
|
|
6
|
1
|
8
|
my $self = shift;
|
205
|
6
|
|
|
|
|
8
|
my $id = shift;
|
206
|
6
|
100
|
|
|
|
19
|
if ($id =~ /^[A-Z]$/) {
|
207
|
|
|
|
|
|
|
return
|
208
|
6
|
|
|
|
|
30
|
map { bless { id => $_, skos => $self }, 'RDF::SKOS::Concept' }
|
|
1697
|
|
|
|
|
3394
|
|
209
|
1
|
|
|
|
|
300
|
grep { /$id..$/ }
|
210
|
|
|
|
|
|
|
keys %SKOS;
|
211
|
|
|
|
|
|
|
} else {
|
212
|
|
|
|
|
|
|
return
|
213
|
18
|
|
|
|
|
92
|
map { bless { id => $_, skos => $self }, 'RDF::SKOS::Concept' }
|
|
8485
|
|
|
|
|
17359
|
|
214
|
5
|
|
|
|
|
999
|
grep { /$id.$/ }
|
215
|
|
|
|
|
|
|
keys %SKOS;
|
216
|
|
|
|
|
|
|
}
|
217
|
|
|
|
|
|
|
}
|
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=pod
|
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=item B
|
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
B: At the moment this does not honor transitivity.
|
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=cut
|
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub narrowerTransitive {
|
228
|
1
|
|
|
1
|
1
|
2
|
my $self = shift;
|
229
|
1
|
|
|
|
|
3
|
$self->narrower (@_);
|
230
|
|
|
|
|
|
|
}
|
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
sub broader {
|
233
|
7
|
|
|
7
|
1
|
12
|
my $self = shift;
|
234
|
7
|
|
|
|
|
10
|
my $id = shift;
|
235
|
|
|
|
|
|
|
|
236
|
7
|
100
|
|
|
|
50
|
if ($id =~ /^([A-Z])..$/) {
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
237
|
1
|
|
|
|
|
8
|
return bless { id => $1, skos => $self }, 'RDF::SKOS::Concept';
|
238
|
|
|
|
|
|
|
} elsif ($id =~ /^[A-Z]$/) {
|
239
|
1
|
|
|
|
|
6
|
return ();
|
240
|
|
|
|
|
|
|
} elsif ($id =~ /([A-Z].*).$/) {
|
241
|
5
|
|
|
|
|
32
|
return bless { id => $1, skos => $self }, 'RDF::SKOS::Concept';
|
242
|
|
|
|
|
|
|
}
|
243
|
|
|
|
|
|
|
}
|
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=pod
|
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=item B
|
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
B: At the moment this does not honor transitivity.
|
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=cut
|
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
sub broaderTransitive {
|
254
|
1
|
|
|
1
|
1
|
3
|
my $self = shift;
|
255
|
1
|
|
|
|
|
2
|
$self->broader (@_);
|
256
|
|
|
|
|
|
|
}
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=pod
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=back
|
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=head1 AUTHOR
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
Robert Barta, C<< >>
|
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=head1 BUGS
|
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through
|
269
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll
|
270
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes.
|
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE
|
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
Copyright 2009 Robert Barta, all rights reserved.
|
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl
|
277
|
|
|
|
|
|
|
itself.
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=cut
|
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
our $VERSION = '0.01';
|
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
"against all odds";
|
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
__DATA__
|