com.bigdata.rdf.sparql.ast.optimizers
Class ASTSimpleOptionalOptimizer

java.lang.Object
  extended by com.bigdata.rdf.sparql.ast.optimizers.ASTSimpleOptionalOptimizer
All Implemented Interfaces:
IASTOptimizer

public class ASTSimpleOptionalOptimizer
extends Object
implements IASTOptimizer

A "simple optional" is an optional sub-group that contains only one statement pattern, no sub-groups of its own, and no filters that require materialized variables based on the optional statement pattern. We can lift these "simple optionals" into the parent group where the join evaluation will be less expensive.

Note: When the filter is lifted, it must be attached to the statement pattern node such that toPredicate() puts them onto the predicate since they must run *with* the join for that predicate. (The problem is that ?x != Bar is filtering the optional join, not ?x).

 where {
  ?x type Foo . // adds binding for ?x
  optional {
    ?x p ?y . // adds bindings for ?y if ?x != Bar
    filter (?x != Bar) .
  }
 }
 

Version:
$Id: ASTSimpleOptionalOptimizer.java 5197 2011-09-15 19:10:44Z thompsonbry $
Author:
Bryan Thompson

Constructor Summary
ASTSimpleOptionalOptimizer()
           
 
Method Summary
 IQueryNode optimize(AST2BOpContext context, IQueryNode queryNode, IBindingSet[] bindingSets)
          Optimize the AST.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASTSimpleOptionalOptimizer

public ASTSimpleOptionalOptimizer()
Method Detail

optimize

public IQueryNode optimize(AST2BOpContext context,
                           IQueryNode queryNode,
                           IBindingSet[] bindingSets)
Description copied from interface: IASTOptimizer
Optimize the AST.

Specified by:
optimize in interface IASTOptimizer
Parameters:
context - The evaluation context.
queryNode - The AST (in).
Returns:
The optimized AST.


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.