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