line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
88535
|
use 5.010; |
|
2
|
|
|
|
|
17
|
|
2
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
44
|
|
3
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
105
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
7
|
|
|
|
|
|
|
our $VERSION = '0.105'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Moose; |
10
|
2
|
|
|
2
|
|
3988
|
extends 'RDF::DOAP::Resource'; |
|
2
|
|
|
|
|
827787
|
|
|
2
|
|
|
|
|
8
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use RDF::Trine; |
13
|
2
|
|
|
2
|
|
12784
|
use RDF::DOAP::Project; |
|
2
|
|
|
|
|
1639618
|
|
|
2
|
|
|
|
|
92
|
|
14
|
2
|
|
|
2
|
|
958
|
use RDF::DOAP::Types -types; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
82
|
|
15
|
2
|
|
|
2
|
|
12
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
12
|
|
16
|
|
|
|
|
|
|
use RDF::Trine::Namespace qw(rdf rdfs owl xsd); |
17
|
2
|
|
|
2
|
|
10261
|
my $doap = 'RDF::Trine::Namespace'->new('http://usefulinc.com/ns/doap#'); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has projects => ( |
20
|
|
|
|
|
|
|
is => 'ro', |
21
|
|
|
|
|
|
|
isa => ArrayRef[Project], |
22
|
|
|
|
|
|
|
default => sub { [] }, |
23
|
|
|
|
|
|
|
coerce => 1, |
24
|
|
|
|
|
|
|
init_arg => '_projects', |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
{ |
28
|
|
|
|
|
|
|
require RDF::Trine; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
1
|
0
|
my $class = shift; |
31
|
|
|
|
|
|
|
my ($url) = @_; |
32
|
0
|
|
|
|
|
0
|
|
33
|
0
|
|
|
|
|
0
|
my $model = 'RDF::Trine::Model'->new; |
34
|
|
|
|
|
|
|
'RDF::Trine::Parser'->parse_url_into_model("$url", $model); |
35
|
0
|
|
|
|
|
0
|
|
36
|
0
|
|
|
|
|
0
|
return $class->from_model($model, { rdf_about => $url }); |
37
|
|
|
|
|
|
|
} |
38
|
0
|
|
|
|
|
0
|
|
39
|
|
|
|
|
|
|
{ |
40
|
|
|
|
|
|
|
require RDF::Trine; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $class = shift; |
43
|
0
|
|
|
0
|
1
|
0
|
my ($fh, $base) = @_; |
44
|
|
|
|
|
|
|
$base //= 'http://localhost/'; |
45
|
0
|
|
|
|
|
0
|
|
46
|
0
|
|
|
|
|
0
|
my $model = 'RDF::Trine::Model'->new; |
47
|
0
|
|
0
|
|
|
0
|
'RDF::Trine::Parser'->parse_file_into_model($base, $fh, $model); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
0
|
return $class->from_model($model); |
50
|
0
|
|
|
|
|
0
|
} |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
0
|
{ |
53
|
|
|
|
|
|
|
my $class = shift; |
54
|
|
|
|
|
|
|
my ($model, $args) = @_; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# required for coercion to work! |
57
|
1
|
|
|
1
|
1
|
644349
|
local $RDF::DOAP::Resource::MODEL = $model; |
58
|
1
|
|
|
|
|
5
|
|
59
|
|
|
|
|
|
|
$class->new( |
60
|
|
|
|
|
|
|
%{ $args || {} }, |
61
|
1
|
|
|
|
|
4
|
rdf_model => $model, |
62
|
|
|
|
|
|
|
_projects => [ $model->subjects($rdf->type, $doap->Project) ], |
63
|
|
|
|
|
|
|
); |
64
|
1
|
50
|
|
|
|
2
|
} |
|
1
|
|
|
|
|
13
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
{ |
67
|
|
|
|
|
|
|
my $self = shift; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my @projects = @{$self->projects}; |
70
|
|
|
|
|
|
|
return $projects[0] if @projects <= 1; |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
1
|
1
|
392
|
my @sorted = |
73
|
|
|
|
|
|
|
map $_->[0], |
74
|
1
|
|
|
|
|
2
|
sort { $b->[1] <=> $a->[1] } |
|
1
|
|
|
|
|
27
|
|
75
|
1
|
50
|
|
|
|
7
|
map [ |
76
|
|
|
|
|
|
|
$_, |
77
|
|
|
|
|
|
|
$_->has_rdf_model && $_->has_rdf_about |
78
|
|
|
|
|
|
|
? $_->rdf_model->count_statements($_->rdf_about, undef, undef) |
79
|
0
|
0
|
0
|
|
|
|
: 0 |
|
0
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
], @projects; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
return $sorted[0]; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=pod |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=encoding utf-8 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=begin stopwords |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
rdfs:Resource |
95
|
|
|
|
|
|
|
doap:Project |
96
|
|
|
|
|
|
|
doap:Repository |
97
|
|
|
|
|
|
|
foaf:Person |
98
|
|
|
|
|
|
|
doap:Version |
99
|
|
|
|
|
|
|
dcs:ChangeSet |
100
|
|
|
|
|
|
|
dcs:Change |
101
|
|
|
|
|
|
|
dbug:Issue |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=end stopwords |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 NAME |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
RDF::DOAP - an object-oriented interface for DOAP (Description of a Project) data |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 SYNOPSIS |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
use feature 'say'; |
112
|
|
|
|
|
|
|
use RDF::DOAP; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
my $url = 'http://api.metacpan.org/source/DOY/Moose-2.0604/doap.rdf'; |
115
|
|
|
|
|
|
|
my $doap = 'RDF::DOAP'->from_url($url); |
116
|
|
|
|
|
|
|
my $proj = $doap->project; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
say $proj->name; # "Moose" |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
say $_->name |
121
|
|
|
|
|
|
|
for @{ $proj->maintainer }; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 DESCRIPTION |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
A little sparsely documented right now. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
The RDF::DOAP class itself is mostly a wrapper for parsing RDF |
128
|
|
|
|
|
|
|
and building objects. Most of the interesting stuff is in the |
129
|
|
|
|
|
|
|
L</Bundled Classes>. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 Constructors |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=over |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item C<< new(%attrs) >> |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
You don't want to use this. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item C<< from_url($url) >> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Parse the RDF at the given URL and construct an RDF::DOAP object. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item C<< from_file($fh, $base) >> |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Parse a file handle or file name. A base URL may be provided for |
146
|
|
|
|
|
|
|
resolving relative URI references; if omitted the base is assumed |
147
|
|
|
|
|
|
|
to be C<< http://localhost/ >> which is almost certainly wrong. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item C<< from_model($model) >> |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Read DOAP from an existing L<RDF::Trine::Model>. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=back |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 Attributes |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=over |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item C<< projects >> |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
An arrayref; the list of software projects found in the input data. |
162
|
|
|
|
|
|
|
This cannot be provided in the constructor. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=back |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head2 Methods |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=over |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item C<< project >> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
If C<< projects >> contains only one project, returns it. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Otherwise, tries to guess which of the projects the input data was |
175
|
|
|
|
|
|
|
mostly trying to describe. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=back |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 Bundled Classes |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Within each of these classes, the attributes correspond roughly to |
182
|
|
|
|
|
|
|
the properties defined for them in the DOAP schema; however hyphens |
183
|
|
|
|
|
|
|
in property URIs become underscores in attribute names. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=over |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item B<< L<RDF::DOAP::Resource> >> |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Correponds roughly to the I<< rdfs:Resource >> class, excluding |
190
|
|
|
|
|
|
|
literals. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item B<< L<RDF::DOAP::Project> >> |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Correponds to I<< doap:Project >>. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item B<< L<RDF::DOAP::Repository> >> |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Correponds to I<< doap:Repository >>. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item B<< L<RDF::DOAP::Person> >> |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Correponds to I<< foaf:Person >>. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=item B<< L<RDF::DOAP::Version> >> |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Correponds to I<< doap:Version >>. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item B<< L<RDF::DOAP::ChangeSet> >> |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Correponds to I<< dcs:ChangeSet >>. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item B<< L<RDF::DOAP::Change> >> |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Correponds to I<< dcs:Change >>. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item B<< L<RDF::DOAP::Issue> >> |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Correponds to I<< dbug:Issue >>. |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=back |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head1 BUGS |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Please report any bugs to |
225
|
|
|
|
|
|
|
L<https://github.com/kjetilk/p5-rdf-doap/issues>. |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head1 SEE ALSO |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=over |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=item * |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
Edd Dumbill's series of articles on DOAP's design: |
234
|
|
|
|
|
|
|
L<part 1|http://www.ibm.com/developerworks/xml/library/x-osproj/>, |
235
|
|
|
|
|
|
|
L<part 2|http://www.ibm.com/developerworks/xml/library/x-osproj2/>, |
236
|
|
|
|
|
|
|
L<part 3|http://www.ibm.com/developerworks/xml/library/x-osproj4/> and |
237
|
|
|
|
|
|
|
L<part 4|http://www.ibm.com/developerworks/xml/library/x-osproj3/> |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=item * |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
L<The DOAP Schema|http://usefulinc.com/ns/doap#>. |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=item * |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
L<The DOAP Change Sets Schema|http://ontologi.es/doap-changeset#>. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=item * |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
L<The DOAP Bugs Schema|http://ontologi.es/doap-bugs#>. |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=back |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head1 AUTHOR |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt>. |
256
|
|
|
|
|
|
|
Kjetil Kjernsmo E<lt>kjetilk@cpan.orgE<gt>. |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Toby Inkster, 2017 by Kjetil Kjernsmo. |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
263
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
268
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
269
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
270
|
|
|
|
|
|
|
|