perlrdf/Command/StoreDump.pm

filter: Statementstmt 59.2% 32 / 54 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 91.6% 11 / 12 Podpod 100% 1 / 1 totaltotal 57.8% 44 / 76 CC 7 SCAR 31.1
CC
7
Cov
52%
execute
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 22.4
« perlrdf/Command/Isomorphic.pm ↑ Summary perlrdf/Command/Prefix.pm »
1 package App::perlrdf::Command::StoreDump;
2  
3 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 $App::perlrdf::Command::StoreDump::AUTHORITY = 'cpan:TOBYINK';
10 1 $App::perlrdf::Command::StoreDump::VERSION = '0.006';
11 }
12  
13 1 ▶use App::perlrdf -command;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use constant abstract => q (Dump RDF data from an RDF::Trine::Store.);
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use constant command_names => qw( store_dump dump );
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use constant description => <<'INTRO' . __PACKAGE__->store_help . <<'DESCRIPTION';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 Dump data from an RDF::Trine::Store.
20 INTRO
21  
22 Output files are specified the same way as for the 'translate' command. See
23 'filespec' for more details.
24 DESCRIPTION
25  
26 1 ▶use constant opt_spec => (
Subroutine BEGIN: called CC=1 SCAR=0.0
27 __PACKAGE__->store_opt_spec,
28 []=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>,
29 [ 'output|o=s@', 'Output filename or URL' ],
30 [ 'output-spec|O=s@', 'Output file specification' ],
31 [ 'output-format|s=s', 'Output format (mnemonic: serialise)' ],
32 []=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>,
33 [ 'graph|g=s@', 'Graph(s) to dump (default: all graphs)' ],
34 1 );
35  
36 sub execute
37 0 ▶{
Subroutine execute: not called CC=7 SCAR=40.3
Pod documented
38 0 require RDF::Trine;
39 0 require App::perlrdf::FileSpec::OutputRDF;
40
41 0 my ($self, $opt, $arg) = @_;
42  
43 0 my $store = $self->get_store($opt);
44 0 my $model = RDF::Trine::Model->new($store);
45  
46 0 ▶ if ($opt->{graph})
Branch: 1 branch
BranchTrueFalseTotal
if ($opt->{"graph"}) 0 0 0
47 {
48 0 my $orig = $model;
49 0 $model = RDF::Trine::Model->new;
50 0 for (@{ $opt->{graph} })
51 {
52 0 my $graph = RDF::Trine::Node::Resource->new($_);
53 0 $model->add_iterator( scalar $orig->get_statements((undef)x3, $graph) );
54 }
55 }
56  
57 0 my @outputs = $self->get_filespecs(
58 'App::perlrdf::FileSpec::OutputRDF',
59 output => $opt,
60 );
61
62 push @outputs, map {
63 0 App::perlrdf::FileSpec::OutputRDF->new_from_filespec(
64 $_,
65 $opt->{output_format},
66 $opt->{output_base},
67 )
68 0 } @$arg;
69
70 push @outputs,
71 App::perlrdf::FileSpec::OutputRDF->new_from_filespec(
72 '-',
73 ($opt->{output_format} // 'NQuads'),
74 $opt->{output_base},
75 )
76 0 ▶ unless @outputs;
Branch: 1 branch
BranchTrueFalseTotal
unless @outputs 0 0 0
Condition0%0/2
$opt->{"output_format"} // "NQuads"
l!l
00
MC/DC0%0/1
$opt->{"output_format"} // "NQuads"
$opt->{"output_format"}
Truth table0%0/2
A
A= $opt->{"output_format"}
Aresult
11
00
77
78 0 for (@outputs)
79 {
80 0 printf STDERR "Writing %s\n", $_->uri;
81
82 0 ▶ eval {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { local $@ = undef; $_->serialize_model($model); 1 } } or warn "$@\n" 0 0 0
83 0 local $@ = undef;
84 0 $_->serialize_model($model);
85 0 1;
86 } or warn "$@\n";
87 }
88 }
89  
90 1 1;
« perlrdf/Command/Isomorphic.pm ↑ Summary perlrdf/Command/Prefix.pm »