| 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
| |||||||||||
| 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
| |||||||||||
| 38 | 0 | $cb->($r); | |||||||||
| 39 | } | ||||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 1 | 1; | |||||||||