Attean::QueryPlanner - Query planner
This document describes Attean::QueryPlanner version 0.017
use v5.14; use Attean; my $planner = Attean::QueryPlanner->new(); my $default_graphs = [ Attean::IRI->new('http://example.org/') ]; my $plan = $planner->plan_for_algebra( $algebra, $model, $default_graphs ); my $iter = $plan->evaluate($model); while (my $result = $iter->next()) { say $result->as_string; }
The Attean::QueryPlanner class is a base class implementing common behavior for query planners. Subclasses will need to consume or compose the Attean::API::JoinPlanner role.
Trivial sub-classes may consume Attean::API::NaiveJoinPlanner, while more complex planners may choose to implement complex join planning (e.g. Attean::IDPQueryPlanner).
new_temporary( $type )
Returns a new unique (in the context of the query planner) ID string that may be used for things like fresh (temporary) variables. The $type string is used in the generated name to aid in identifying different uses for the names.
$type
plan_for_algebra( $algebra, $model, \@active_graphs, \@default_graphs )
Returns the first plan returned from plans_for_algebra.
plans_for_algebra
plans_for_algebra( $algebra, $model, \@active_graphs, \@default_graphs )
Returns Attean::API::Plan objects representing alternate query plans for evaluating the query $algebra against the $model, using the supplied $active_graph.
$algebra
$model
$active_graph
simplify_path( $subject, $path, $object )
Return a simplified Attean::API::Algebra object corresponding to the given property path.
new_projection( $plan, $distinct, @variable_names )
Return a new Attean::Plan::Project plan over $plan, projecting the named variables. $disctinct should be true if the caller can guarantee that the resulting plan will produce distinct results, false otherwise.
$plan
$disctinct
This method takes care of computing plan metadata such as the resulting ordering.
bgp_join_plans( $bgp, $model, \@active_graphs, \@default_graphs, \@interesting_order, \@plansA, \@plansB, ... )
Returns a list of alternative plans for the join of a set of triples. The arguments @plansA, @plansB, etc. represent alternative plans for each triple participating in the join.
@plansA
@plansB
group_join_plans( $model, \@active_graphs, \@default_graphs, \@interesting_order, \@plansA, \@plansB, ... )
Returns a list of alternative plans for the join of a set of sub-plans. The arguments @plansA, @plansB, etc. represent alternative plans for each sub-plan participating in the join.
joins_for_plan_alternatives( $model, \@active_graphs, \@default_graphs, $interesting, \@plan_A, \@plan_B, ... )
Returns a list of alternative plans that may all be used to produce results matching the join of plan_A, plan_B >, etc. Each plan array here (e.g. @plan_A) should contain equivalent plans.
plan_A
plan_B
@plan_A
access_plans( $model, $active_graphs, $pattern )
Returns a list of alternative Attean::API::Plan objects that may be used to produce results matching the Attean::API::TripleOrQuadPattern $pattern in the context of $active_graphs.
$active_graphs
join_plans( $model, \@active_graphs, \@default_graphs, \@plan_left, \@plan_right, $type [, $expr] )
Returns a list of alternative plans for the join of one plan from @plan_left and one plan from @plan_right. The join $type must be one of 'inner', 'left', or 'minus', indicating the join algorithm to be used. If $type is 'left', then the optional $expr may be used to supply a filter expression that should be used by the SPARQL left-join algorithm.
@plan_left
@plan_right
'inner'
'left'
'minus'
$expr
Please report any bugs or feature requests to through the GitHub web interface at https://github.com/kasei/attean/issues.
http://www.perlrdf.org/
Gregory Todd Williams <gwilliams@cpan.org>
<gwilliams@cpan.org>
Copyright (c) 2014--2018 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Attean, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Attean
CPAN shell
perl -MCPAN -e shell install Attean
For more information on module installation, please visit the detailed CPAN module installation guide.