lib/Web/Solid/Auth/Util.pm

filter: Statementstmt 39.2% 11 / 28 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 2 totaltotal 35.9% 14 / 39 CC 3 SCAR 13.5
CC
3
Cov
34%
parse_turtle
6.0
sparql
6.0
BEGIN
1.0
CRAP 3.9
« lib/Web/Solid/Auth/Agent.pm ↑ Summary
1 package Web::Solid::Auth::Util;
2  
3 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Attean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Attean::RDF qw(iri);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $GNAME = 'http://graph-name/';
8  
9 0 ▶sub parse_turtle {
Subroutine parse_turtle: not called CC=2 SCAR=17.9
Pod undocumented
10 0 my ($self, $turtle) = @_;
11  
12 0 my $store = Attean->get_store('Memory')->new();
13 0 my $parser = Attean->get_parser('Turtle')->new();
14
15 0 my $iter = $parser->parse_iter_from_bytes($turtle);
16  
17 0 ▶ return undef unless $iter;
Branch: 1 branch
BranchTrueFalseTotal
unless $iter 0 0 0
18  
19 0 my $graph = iri($GNAME);
20 0 my $quads = $iter->as_quads($graph);
21  
22 0 $store->add_iter($quads);
23  
24 0 my $model = Attean::QuadModel->new( store => $store );
25  
26 0 return $model;
27 }
28  
29 0 ▶sub sparql {
Subroutine sparql: not called CC=2 SCAR=17.9
Pod undocumented
30 0 my ($self, $model, $sparql, $cb) = @_;
31  
32 0 my $s = Attean->get_parser('SPARQL')->new();
33 0 my ($algebra) = $s->parse($sparql);
34 0 my $graph = iri($GNAME);
35 0 my $results = $model->evaluate($algebra, $graph);
36  
37 0 ▶ while (my $r = $results->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $r = $results->next) 0 0 0
38 0 $cb->($r);
39 }
40 }
41  
42 1 1;
« lib/Web/Solid/Auth/Agent.pm ↑ Summary