| 1 | package AtteanX::Model::SPARQL; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use v5.14; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | our $AUTHORITY = 'cpan:KJETILK'; | |||||||||
| 7 | 1 | our $VERSION = '0.012'; | |||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use Types::Standard qw(InstanceOf); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 1 | has 'store' => ( | |||||||||
| 14 | is => 'ro', | ||||||||||
| 15 | isa => InstanceOf['AtteanX::Store::SPARQL'], | ||||||||||
| 16 | required => 1, | ||||||||||
| 17 | handles => { size => 'size' , | ||||||||||
| 18 | get_quads => 'get_triples', | ||||||||||
| 19 | count_quads => 'count_triples', | ||||||||||
| 20 | get_sparql => 'get_sparql', | ||||||||||
| 21 | plans_for_algebra => 'plans_for_algebra', | ||||||||||
| 22 | count_quads_estimate => 'count_quads_estimate' | ||||||||||
| 23 | } | ||||||||||
| 24 | ); | ||||||||||
| 25 | |||||||||||
| 26 | |||||||||||
| 27 | 1 | with 'Attean::API::Model', 'Attean::API::CostPlanner'; | |||||||||
| 28 | |||||||||||
| 29 | 1 | ▶ | sub cost_for_plan { | ||||||||
|
Subroutine
cost_for_plan: called CC=3 SCAR=15.4
Pod
undocumented
| |||||||||||
| 30 | 1 | my $self = shift; | |||||||||
| 31 | 1 | my $plan = shift; | |||||||||
| 32 | 1 | my $planner = shift; | |||||||||
| 33 | |||||||||||
| 34 | # TODO: check if the store does something | ||||||||||
| 35 | 1 | ▶ | if ($plan->isa('AtteanX::Plan::SPARQLBGP')) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | # BGPs should have a cost proportional to the number of triple patterns, | ||||||||||
| 37 | # but be much more costly if they contain a cartesian product. | ||||||||||
| 38 | 0 | ▶ | if ($plan->children_are_variable_connected) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 0 | return 10 * scalar(@{ $plan->children }); | |||||||||
| 40 | } else { | ||||||||||
| 41 | 0 | return 100 * scalar(@{ $plan->children }); | |||||||||
| 42 | } | ||||||||||
| 43 | } | ||||||||||
| 44 | 1 | return; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | sub get_graphs { | ||||||||
|
Subroutine
get_graphs: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 48 | 0 | return Attean::ListIterator->new(); | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 1 | 1; | |||||||||
| 52 | |||||||||||
| 53 | __END__ | ||||||||||