public class ASTBottomUpOptimizer extends Object implements IASTOptimizer
Note: The test suite for this class is a set of DAWG tests which focus on bottom up evaluation semantics, including:
Nested Optionals - 1 (Query is not well designed because there are no shared variables in the intermediate join group and there is an embedded OPTIONAL join group. Since ?v is not present in the intermediate join group the (:x3 :q ?w . OPTIONAL { :x2 :p ?v }) solutions must be computed first and then joined against the (:x1 :p ?v) solutions.)
SELECT * { :x1 :p ?v . OPTIONAL { :x3 :q ?w . OPTIONAL { :x2 :p ?v } } }Filter-scope - 1 (Query is not well designed because there are no shared variables in the intermediate join group and there is an embedded OPTIONAL join group. Also, ?v is used in the FILTER but is not visible in that scope.)
SELECT * { :x :p ?v . { :x :q ?w OPTIONAL { :x :p ?v2 FILTER(?v = 1) } } }Join-scope - 1 (Query is not well designed because there are no shared variables in the intermediate group and there is an embedded OPTIONAL join group.)
SELECT * { ?X :name "paul" {?Y :name "george" . OPTIONAL { ?X :email ?Z } } }Filter-nested - 2 (Filter on variable ?v which is not in scope)
SELECT ?v { :x :p ?v . { FILTER(?v = 1) } }bind07 - BIND (?o not in scope for bind)
SELECT ?s ?p ?o ?z { ?s ?p ?o . { BIND(?o+1 AS ?z) } UNION { BIND(?o+2 AS ?z) } }Nested groups which do not share variables with their parent can be lifted out into a named subquery. This has the same effect as bottom up evaluation since we will run the named subquery first and then perform the join against the parent group. However, in this case an exogenous binding which causes a shared variable to exist would mean that the query could run normally since the value in the outer group and the inner group would now be correlated through the exogenous binding. E.g.,
in the last example
above.
https://sourceforge.net/apps/trac/bigdata/ticket/232
,
http://www.dcc.uchile.cl/~cgutierr/papers/sparql.pdf
Constructor and Description |
---|
ASTBottomUpOptimizer() |
Modifier and Type | Method and Description |
---|---|
QueryNodeWithBindingSet |
optimize(AST2BOpContext context,
QueryNodeWithBindingSet input)
Optimize the AST.
|
public QueryNodeWithBindingSet optimize(AST2BOpContext context, QueryNodeWithBindingSet input)
IASTOptimizer
optimize
in interface IASTOptimizer
context
- The evaluation context.input
- The input to the optimizer, consisting of a queryNode and
input binding set.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.