| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package AtteanX::Model::SPARQL; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 878845 | use v5.14; | 
|  | 1 |  |  |  |  | 3 |  | 
| 4 | 1 |  |  | 1 |  | 3 | use warnings; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 18 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 1 |  |  | 1 |  | 3 | use Moo; | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 7 | 1 |  |  | 1 |  | 175 | use Types::Standard qw(InstanceOf); | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 8 | 1 |  |  | 1 |  | 273 | use namespace::clean; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | has 'store'    => ( | 
| 11 |  |  |  |  |  |  | is => 'ro', | 
| 12 |  |  |  |  |  |  | isa => InstanceOf['AtteanX::Store::SPARQL'], | 
| 13 |  |  |  |  |  |  | required => 1, | 
| 14 |  |  |  |  |  |  | handles => { size => 'size' , | 
| 15 |  |  |  |  |  |  | get_quads => 'get_triples', | 
| 16 |  |  |  |  |  |  | count_quads => 'count_triples', | 
| 17 |  |  |  |  |  |  | get_sparql => 'get_sparql', | 
| 18 |  |  |  |  |  |  | plans_for_algebra => 'plans_for_algebra' | 
| 19 |  |  |  |  |  |  | } | 
| 20 |  |  |  |  |  |  | ); | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | with 'Attean::API::Model', 'Attean::API::CostPlanner'; | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | sub cost_for_plan { | 
| 26 |  |  |  |  |  |  | my $self = shift; | 
| 27 |  |  |  |  |  |  | my $plan = shift; | 
| 28 |  |  |  |  |  |  | my $planner = shift; | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | # TODO: check if the store does something | 
| 31 |  |  |  |  |  |  | if ($plan->isa('AtteanX::Plan::SPARQLBGP')) { | 
| 32 |  |  |  |  |  |  | # BGPs should have a cost proportional to the number of triple patterns, | 
| 33 |  |  |  |  |  |  | # but be much more costly if they contain a cartesian product. | 
| 34 |  |  |  |  |  |  | if ($plan->children_are_variable_connected) { | 
| 35 |  |  |  |  |  |  | return 10 * scalar(@{ $plan->children }); | 
| 36 |  |  |  |  |  |  | } else { | 
| 37 |  |  |  |  |  |  | return 100 * scalar(@{ $plan->children }); | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  | return; | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | sub get_graphs { | 
| 44 | 0 |  |  | 0 | 0 |  | return Attean::ListIterator->new(); | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | 1; | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | __END__ | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | =pod | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | =encoding utf-8 | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | =head1 NAME | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | AtteanX::Model::SPARQL - Attean SPARQL Model | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | my $store = Attean->get_store('SPARQL')->new(endpoint_url => $url); | 
| 62 |  |  |  |  |  |  | my $model = AtteanX::Model::SPARQL->new( store => $store ); | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | This model is in practice a thin wrapper around the underlying SPARQL | 
| 67 |  |  |  |  |  |  | store, that adds facilities only to allow quering and planning with | 
| 68 |  |  |  |  |  |  | quad semantics. | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | It consumes L<Attean::API::Model> and L<Attean::API::CostPlanner> and | 
| 71 |  |  |  |  |  |  | adds no new methods or attributes. | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =head1 OTHER DETAILS | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | For author, copyright and other details, see L<AtteanX::Store::SPARQL>. | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | =cut | 
| 79 |  |  |  |  |  |  |  |