line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::perlrdf::Command::Void; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
45993
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
5
|
1
|
|
|
1
|
|
3
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
1
|
|
|
1
|
|
31
|
$App::perlrdf::Command::Void::AUTHORITY = 'cpan:KJETILK'; |
9
|
1
|
|
|
|
|
18
|
$App::perlrdf::Command::Void::VERSION = '0.01'; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
App::perlrdf::Command::Void - Generate VoID descriptions on the command line |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
For full documentation, install L<App::perlrdf> and go |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
perlrdf void |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Typical use might be |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
perlrdf store_load -Q=test.sqlite t/data/basic.ttl |
26
|
|
|
|
|
|
|
perlrdf void -Q test.sqlite --endpoint_urls http://example.org/sparql -o - 'http://example.org/void#dataset' |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This module implements functionality so that VoID descriptions can be |
31
|
|
|
|
|
|
|
generated on the command line using L<perlrdf>. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 execute |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
This module only implements one method, execute, which runs the generator. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
1
|
|
3
|
use App::perlrdf -command; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
1
|
|
441
|
use namespace::clean; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
1
|
|
166
|
use constant abstract => q (Generate VoID description for a given store); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
51
|
|
47
|
1
|
|
|
1
|
|
4
|
use constant command_names => qw( void ); |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
61
|
|
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
1
|
|
4
|
use constant description => <<'INTRO' . __PACKAGE__->store_help . <<'DESCRIPTION'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
83
|
|
50
|
|
|
|
|
|
|
Retrieve a VoID description from an RDF::Trine::Store. |
51
|
|
|
|
|
|
|
INTRO |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Output files are specified the same way as for the 'translate' command. See |
54
|
|
|
|
|
|
|
'filespec' for more details. |
55
|
|
|
|
|
|
|
DESCRIPTION |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
50
|
use constant opt_spec => ( |
58
|
|
|
|
|
|
|
__PACKAGE__->store_opt_spec, |
59
|
|
|
|
|
|
|
[]=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>, |
60
|
|
|
|
|
|
|
[ 'output|o=s@', 'Output filename or URL' ], |
61
|
|
|
|
|
|
|
[ 'output-spec|O=s@', 'Output file specification' ], |
62
|
|
|
|
|
|
|
[ 'output-format|s=s', 'Output format (mnemonic: serialise)' ], |
63
|
|
|
|
|
|
|
[ 'detail_level|l=i', 'The level of detail used for VoID (defaults to 2)', { default => 2 } ], |
64
|
|
|
|
|
|
|
[ 'void_urispace=s', 'The URI space a VoID dataset.' ], |
65
|
|
|
|
|
|
|
[ 'used_vocabularies=s@', 'URIs of vocabularies used in the data' ], |
66
|
|
|
|
|
|
|
[ 'endpoint_urls=s@', 'URLs of SPARQL Endpoints that holds the data' ], |
67
|
|
|
|
|
|
|
[ 'void_title=s', 'A title in English for the datasets' ], # TODO: Support more titles |
68
|
|
|
|
|
|
|
[ 'license_uris=s@', 'URIs to licenses that regulates the use of the dataset'], |
69
|
1
|
|
|
1
|
|
3
|
); |
|
1
|
|
|
|
|
1
|
|
70
|
1
|
|
|
1
|
|
4
|
use constant usage_desc => '%c void %o DATASET_URI'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
44
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub execute |
73
|
|
|
|
|
|
|
{ |
74
|
1
|
|
|
1
|
|
7
|
use RDF::Trine qw( iri literal ) ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
93
|
|
75
|
5
|
|
|
5
|
1
|
498255
|
require App::perlrdf::FileSpec::OutputRDF; |
76
|
1
|
|
|
1
|
|
408
|
use RDF::Generator::Void; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
402
|
|
77
|
|
|
|
|
|
|
|
78
|
5
|
|
|
|
|
100713
|
my ($self, $opt, $arg) = @_; |
79
|
|
|
|
|
|
|
|
80
|
5
|
|
|
|
|
32
|
my $store = $self->get_store($opt); |
81
|
5
|
|
|
|
|
34053
|
my $model = RDF::Trine::Model->new($store); |
82
|
|
|
|
|
|
|
|
83
|
5
|
50
|
|
|
|
121
|
my $dataset_uri = @$arg |
84
|
|
|
|
|
|
|
? iri(shift @$arg) |
85
|
|
|
|
|
|
|
: $self->usage_error("No URI for the dataset is given"); |
86
|
|
|
|
|
|
|
|
87
|
5
|
|
|
|
|
187
|
my @outputs = $self->get_filespecs( |
88
|
|
|
|
|
|
|
'App::perlrdf::FileSpec::OutputRDF', |
89
|
|
|
|
|
|
|
output => $opt, |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
push @outputs, map { |
93
|
5
|
|
|
|
|
86
|
App::perlrdf::FileSpec::OutputRDF->new_from_filespec( |
94
|
|
|
|
|
|
|
$_, |
95
|
|
|
|
|
|
|
$opt->{output_format}, |
96
|
|
|
|
|
|
|
$opt->{output_base}, |
97
|
|
|
|
|
|
|
) |
98
|
0
|
|
|
|
|
0
|
} @$arg; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
push @outputs, |
101
|
|
|
|
|
|
|
App::perlrdf::FileSpec::OutputRDF->new_from_filespec( |
102
|
|
|
|
|
|
|
'-', |
103
|
|
|
|
|
|
|
($opt->{output_format} // 'NQuads'), |
104
|
|
|
|
|
|
|
$opt->{output_base}, |
105
|
|
|
|
|
|
|
) |
106
|
5
|
50
|
50
|
|
|
103
|
unless @outputs; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
my $generator = RDF::Generator::Void->new(inmodel => $model, |
109
|
|
|
|
|
|
|
dataset_uri => $dataset_uri, |
110
|
|
|
|
|
|
|
level => $opt->{detail_level}, |
111
|
5
|
|
|
|
|
9086
|
); |
112
|
5
|
100
|
|
|
|
2953
|
if ($opt->{void_urispace}) { |
113
|
1
|
|
|
|
|
27
|
$generator->urispace($opt->{void_urispace}); |
114
|
|
|
|
|
|
|
} |
115
|
5
|
100
|
|
|
|
21
|
if ($opt->{endpoint_urls}) { |
116
|
1
|
|
|
|
|
2
|
$generator->add_endpoints(@{$opt->{endpoint_urls}}); |
|
1
|
|
|
|
|
37
|
|
117
|
|
|
|
|
|
|
} |
118
|
5
|
50
|
|
|
|
17
|
if ($opt->{used_vocabularies}) { |
119
|
0
|
|
|
|
|
0
|
$generator->add_vocabularies(@{$opt->{used_vocabularies}}); |
|
0
|
|
|
|
|
0
|
|
120
|
|
|
|
|
|
|
} |
121
|
5
|
100
|
|
|
|
19
|
if ($opt->{license_uris}) { |
122
|
3
|
|
|
|
|
6
|
$generator->add_licenses(@{$opt->{license_uris}}); |
|
3
|
|
|
|
|
124
|
|
123
|
|
|
|
|
|
|
} |
124
|
5
|
100
|
|
|
|
19
|
if ($opt->{void_title}) { |
125
|
1
|
|
|
|
|
6
|
$generator->add_titles(literal($opt->{void_title}, 'en')); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
5
|
|
|
|
|
21
|
my $description = $generator->generate; |
129
|
|
|
|
|
|
|
|
130
|
5
|
|
|
|
|
18
|
for (@outputs) |
131
|
|
|
|
|
|
|
{ |
132
|
5
|
|
|
|
|
144
|
printf STDERR "Writing %s\n", $_->uri; |
133
|
|
|
|
|
|
|
|
134
|
5
|
50
|
|
|
|
236
|
eval { |
135
|
5
|
|
|
|
|
11
|
local $@ = undef; |
136
|
5
|
|
|
|
|
27
|
$_->serialize_model($description); |
137
|
5
|
|
|
|
|
36654
|
1; |
138
|
|
|
|
|
|
|
} or warn "$@\n"; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 FURTHER DOCUMENTATION |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Please see L<RDF::Generator::Void> for further documentation. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 AUTHORS AND COPYRIGHT |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Please see L<RDF::Generator::Void> for information about authors and copyright for this module. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
1; |