org.openanzo.glitter.query.planning
Class GreedyCostBasedExecutionPlan

java.lang.Object
  extended by org.openanzo.glitter.query.planning.GreedyCostBasedExecutionPlan
All Implemented Interfaces:
CostBasedQueryExecutionPlan, QueryExecutionPlan
Direct Known Subclasses:
SimpleCostExecutionPlan

public class GreedyCostBasedExecutionPlan
extends java.lang.Object
implements CostBasedQueryExecutionPlan

The GreedyCostBasedExecutionPlan provides a simple way to order the execution of a SPARQL query: namely, compare the isolated costs of two nodes and evaluate the cheapest node first. Much more sophisticated approaches are possible, including: A dynaminc programming approach which assesses costs per node *given a set of sibling nodes which have already been evaluated* The OdoQueryOptimizer approach which evaluates triple patterns containing variables that will provide bindings for other triple patterns before isolated triple patterns. Predicate selectivity based models (a predicate selectivty model could feed into a simple cost model) Runtime statistics based models (these could also feed into simple cost models)

Author:
Lee

Constructor Summary
GreedyCostBasedExecutionPlan(NodeCostModel ncm)
           
 
Method Summary
 NodeCostModel getCostModel()
           
 java.util.Iterator<TreeNode> orderNodes(java.util.Iterator<? extends TreeNode> it)
          Provides an execution plan by ordering a sequence of sibling nodes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GreedyCostBasedExecutionPlan

public GreedyCostBasedExecutionPlan(NodeCostModel ncm)
Parameters:
ncm - A NodeCostModel used to determine the cost of evaluating each query node.
Method Detail

orderNodes

public java.util.Iterator<TreeNode> orderNodes(java.util.Iterator<? extends TreeNode> it)
Description copied from interface: QueryExecutionPlan
Provides an execution plan by ordering a sequence of sibling nodes.

Specified by:
orderNodes in interface QueryExecutionPlan
Parameters:
it - The original order of the nodes.
Returns:
An iterator over the nodes in the order in which bindings should be generated.

getCostModel

public NodeCostModel getCostModel()
Specified by:
getCostModel in interface CostBasedQueryExecutionPlan
Returns:
The NodeCostModel that assigns query execution costs to various nodes in a SPARQL query tree.


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.