public class TestASTStaticBindingsOptimizer extends AbstractASTEvaluationTestCase
ASTStaticBindingsOptimizer class.TestCase2.MyProperties, TestCase2.RandomTypebaseURI, store, valueFactory_randomType| Constructor and Description | 
|---|
TestASTStaticBindingsOptimizer()  | 
TestASTStaticBindingsOptimizer(String name)  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
testFilterAndBindInlinedBindAddedToExogeneous()
Given 
 | 
void | 
testInlineFromBind()
Test inlining from BIND clause of static bindings from BIND clause,
 including the removal of the clause and putting the values into the
 exogeneous mapping set. 
 | 
void | 
testInlineFromBindInComplexFilter()
Test inlining from BIND clause of static bindings from BIND clause,
 including the removal of the clause and putting the values into the
 exogeneous mapping set. 
 | 
void | 
testInlineFromBindInFilter()
Test inlining from BIND clause of static bindings from BIND clause,
 including the removal of the clause and putting the values into the
 exogeneous mapping set. 
 | 
void | 
testInlineFromBindNested1()
Test inlining from BIND clause of static bindings from BIND clause,
 including the removal of the clause and putting the values into the
 exogeneous mapping set in a nested setting. 
 | 
void | 
testInlineFromBindNested2()
Test inlining from BIND clause of static bindings from BIND clause,
 including the removal of the clause and putting the values into the
 exogeneous mapping set in a nested setting. 
 | 
void | 
testInlineFromExogeneousBindings()
Given 
 | 
void | 
testInlineFromTopLevelValues()
Test inlining from BIND clause of static bindings from top-level VALUES
 clause, including the removal of the clause and putting the values into 
 the exogeneous mapping set. 
 | 
void | 
testInlineFromValues()
Test inlining from BIND clause of static bindings from top-level VALUES
 clause, including the removal of the clause and putting the values into
 the exogeneous mapping set. 
 | 
void | 
testInlineSimpleFilterEqURI()
Given 
 | 
void | 
testInlineSimpleFilterEqURIRev()
Test testInlineSimpleFilterEqURI with FILTER conditions reversed. 
 | 
void | 
testInlineSimpleFilterINURI()
Given 
 | 
void | 
testInlineWithSubquery()
Test inlining from BIND clause of static bindings from BIND clause,
 including the removal of the clause and putting the values into the
 exogeneous mapping set. 
 | 
void | 
testInliningForComplexExogeneousMapping()
Assert that even for complex exogeneous mappings, variables that map
 to the same value in all cases are inlined properly. 
 | 
void | 
testMergeWithComplexExogeneousMapping()  | 
void | 
testMergeWithSimpleExogeneousMapping()
Test inlining from BIND clause of static bindings from top-level VALUES
 clause, including the removal of the clause and putting the values into
 the exogeneous mapping set. 
 | 
void | 
testMultiInlineFromExogeneousBindings()
Given 
 | 
void | 
testNotInlineSimpleFilterEqLiteral()
Given 
 | 
void | 
testNotInlineSimpleFilterEqLiteralRev()
Test testNotInlineSimpleFilterEqLiteral with filter reversed. 
 | 
void | 
testSimpleSameTermFilter()
Given 
 | 
void | 
testSubqueryWithValues()
Test inlining from BIND clause of static bindings from BIND clause,
 including the removal of the clause and putting the values into the
 exogeneous mapping set. 
 | 
void | 
testTicket653()
Tests rewriting of a modified form of ticket #653 (i.e., the 
 corresponding SELECT query). 
 | 
void | 
testTicketBLZG2042()
Test inlining from BIND clause into property paths, inspired by the case
 reported in https://jira.blazegraph.com/browse/BLZG-2042. 
 | 
void | 
testValuesComplexExogeneousMappingInSubquery()
Assert that even for complex exogeneous mappings, variables that map
 to the same value in all cases are inlined properly. 
 | 
assertSameAST, asSet, asSet, asSet, asSet, asSet, enableDeleteMarkersInIndes, getBOpContext, getProperties, getStore, makeIV, setUp, tearDownassertSameSolutions, assertSameSolutions, assertSameSolutions, assertSameSolutionsAnyOrder, assertSameSolutionsAnyOrder, assertSameSolutionsAnyOrder, assertSameSolutionsAnyOrder, assertSameSolutionsAnyOrder, assertSameSolutionsAnyOrder, compareGraphs, compareTupleQueryResults, diffassertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualsWithinUlps, assertSameArray, assertSameArray, assertSameBigDecimal, assertSameBigDecimal, assertSameBigInteger, assertSameBigInteger, assertSameIterator, assertSameIterator, assertSameIteratorAnyOrder, assertSameIteratorAnyOrder, assertSameValue, assertSameValue, assertZeroUlps, assertZeroUlps, fail, getInnerCause, getNormalInt, getProjectBuildPath, getRandomObject, getRandomObject, getRandomOrder, getRandomString, getTestInputStream, getTestResource, getTestResource, getUlps, getUlps, isDEBUG, isDEBUG, isINFO, isINFO, isInnerCause, logPropertiesassertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toStringpublic TestASTStaticBindingsOptimizer()
public TestASTStaticBindingsOptimizer(String name)
public void testInlineFromExogeneousBindings()
 SELECT ?s where {?s ?p ?o}
 
 
 and a binding for ?p in an input solution, verify that the
 AST is rewritten as:
 
 
 SELECT ?s where {?s CONST ?o}
 
 
 where CONST is the binding for ?p in the input solution.
 
 Carried over from TestASTBindingAssigner#test_astBindingAssigner().public void testMultiInlineFromExogeneousBindings()
 SELECT ?p where {?s ?p ?s}
 
 
 and a binding for ?s in an input solution, verify that the
 AST is rewritten as:
 
 
 SELECT ?p where {CONST ?p CONST}
 
 
 where CONST is the binding for ?s in the input solution.
 
 Note: For this unit test, a variable is replaced in more than one
 location in the AST.
 
 Carried over from TestASTBindingAssigner#test_astBindingAssigner2().
public void testInlineFromBind()
 SELECT ?s where { BIND(CONST AS ?p) . ?s ?p ?s }
 
 
 and a binding for ?s in an input solution, verify that the
 AST is rewritten as:
 
 
 SELECT ?s where { ?s CONST ?s }
 
 
 where CONST is the binding for ?p in the input solution
 and the exogeneous mapping { ?p -> CONST } is added.public void testInlineFromBindNested1()
 SELECT ?s where { { BIND(CONST AS ?p) . ?s ?p ?s } }
 
 
 and a binding for ?s in an input solution, verify that the
 AST is rewritten as:
 
 
 SELECT ?s where { { ?s CONST ?s } }
 
 
 where CONST is the binding for ?p in the input solution
 and the exogeneous mapping { ?p -> CONST } is added.public void testInlineFromBindNested2()
 SELECT ?s where { { BIND(CONST AS ?p) } ?s ?p ?s }
 
 
 and a binding for ?s in an input solution, verify that the
 AST is rewritten as:
 
 
 SELECT ?s where { { } ?s CONST ?s }
 
 
 where CONST is the binding for ?p in the input solution
 and the exogeneous mapping { ?p -> CONST } is added.public void testInlineFromTopLevelValues()
 SELECT ?p where { ?s ?p ?s } VALUES ?p { CONST }
 
 
 and a binding for ?s in an input solution, verify that the
 AST is rewritten as:
 
 
 SELECT ?p where { ?s CONST ?s }
 
 
 where CONST is the binding for ?p in the input solution
 and the exogeneous mapping { ?p -> CONST } is added.public void testInlineFromValues()
 SELECT ?p where { VALUES ?p { CONST } . ?s ?p ?s }
 
 
 and a binding for ?s in an input solution, verify that the
 AST is rewritten as:
 
 
 SELECT ?p where { ?s CONST ?s }
 
 
 where CONST is the binding for ?p in the input solution
 and the exogeneous mapping { ?p -> CONST } is added.public void testMergeWithSimpleExogeneousMapping()
 SELECT ?p where { BIND(1 AS ?p) }
 
 
 and a binding for ?s in an input solution, verify that the
 AST is rewritten as:
 
 
 SELECT ?p where { }
 
 
 and the exogeneous mapping is /extended/ by { ?p -> CONST }.public void testMergeWithComplexExogeneousMapping()
public void testInliningForComplexExogeneousMapping()
 SELECT ?p where { 
   BIND("b" AS ?b) . 
   VALUES (?c ?d) { ("c1" "d1") ("c2" "d2") } 
 } VALUES ?e { "e" }
 
 
 and an exogeneous binding set 
 { { ?a -> "a1", ?c -> "c1" }, 
   { ?a -> "a2", ?c -> "c2" }, 
   { ?a -> "a3", ?c -> "c1" } } 
   
 in an input solution, verify that the rewritten query is
 
 
 SELECT ?p where { }
 
 
 and that the resulting generated exogeneous binding set is:
 
 { { ?a -> "a1", ?b -> "b", ?c -> "c1", ?d -> "d1", ?e -> "e" }, 
   { ?a -> "a2", ?b -> "b", ?c -> "c2", ?d -> "d2", ?e -> "e" } }public void testSimpleSameTermFilter()
 SELECT ?p ?o where {?s ?p ?o. FILTER( sameTerm(?o,12) ) }
 
 
 Verify that the AST is rewritten as:
 
 
 SELECT ?p CONST where {?s ?p CONST . FILTER( sameTerm(CONST,12) ) }
 
 
 where CONST is the binding for ?o given by the FILTER.
 
 Note: For this unit test, a variable is replaced in more than one
 location in the AST.
 
 Carried over from TestASTBindingAssigner#test_astBindingAssigner_filter_eq_ConstURI()
public void testInlineSimpleFilterEqURI()
 SELECT ?p ?o where {?s ?p ?o. FILTER( ?o=CONST_URI) ) }
 
 
 Verify that the AST is rewritten as:
 
 
 SELECT ?p ?o where {?s ?p CONST_URI . FILTER( ?o=CONST_URI) ) }
 
 
 where CONST_URI is a URI binding for ?o given by the FILTER.
 
 Note: For this unit test, a variable is replaced in more than one
 location in the AST.
 
 Carried over from TestASTBindingAssigner#test_astBindingAssigner_filter_eq_ConstURI().
public void testInlineSimpleFilterINURI()
 SELECT ?p ?o where {?s ?p ?o. FILTER( ?o IN (CONST_URI) ) }
 
 
 Verify that the AST is rewritten as:
 
 
 SELECT ?p ?o where { ?s ?p CONST_URI . FILTER( ?o IN (CONST_URI) ) }
 
 
 
 where CONST_URI is a URI binding for ?o given by the FILTER.
 
 Note: For this unit test, a variable is replaced in more than one
 location in the AST.
 
 Carried over from TestASTBindingAssigner#test_astBindingAssigner_filter_eq_ConstURI().
public void testInlineSimpleFilterEqURIRev()
public void testNotInlineSimpleFilterEqLiteral()
 SELECT ?p ?o where {?s ?p ?o. FILTER( ?o=CONST_LIT) ) }
 
 
 Verify that the AST is not rewritten.
 
 Carried over from {@link TestASTBindingAssigner#test_astBindingAssigner_filter_eq_ConstLit()public void testNotInlineSimpleFilterEqLiteralRev()
public void testFilterAndBindInlinedBindAddedToExogeneous()
 SELECT ?p ?o where { BIND( AS ?p> . FILTER(?o=CONST_LIT) . ?s ?p ?o ) }
  
 
 Verify that the AST is rewritten as
 
 
 SELECT ?p ?o where { BIND( AS ?p> . FILTER(?o=CONST_LIT) . ?s ?p ?o ) }
  
 
 Carried over from {@link TestASTBindingAssigner#test_astBindingAssigner_filter_eq_ConstLit()public void testValuesComplexExogeneousMappingInSubquery()
 SELECT ?p WHERE {
   {
     SELECT ?p where { 
       BIND("b" AS ?b) . 
       VALUES (?c ?d) { ("c1" "d1") ("c2" "d2") } 
     } VALUES ?e { "e" }
   }
 } VALUES (?a ?c) { ("a1" "c1") ("a2" "c2") ("a2" "c3" )}
 
 
 verify that the rewritten query is
 
 
 SELECT ?p WHERE {
   {
     SELECT ?p where { 
     } VALUES (?b ?c ?e) { ("b" "c1" "e" "d1) ("b" c2" "e" "d2") }
   }
 }
 
 
 and that the resulting generated exogeneous binding is identical to the
 VALUES clause of the top-level query.public void testInlineFromBindInFilter()
 SELECT ?s where { FILTER(?p=URI) . BIND(URI AS ?p) } }
 
 
 and a binding for ?s in an input solution, verify that the
 AST is rewritten as:
 
 
 SELECT ?s where { FILTER(Const(?p -> URI)=URI) . BIND(URI AS ?p) }
 
 
 with unmodified exogenous mapping set.public void testInlineFromBindInComplexFilter()
 SELECT ?s where { FILTER(?p=URI && ?p!=URI2) . BIND(URI AS ?p) } }
 
 
 and a binding for ?s in an input solution, verify that the
 AST is rewritten as:
 
 
 SELECT ?s where { FILTER(Const(?p -> URI)=URI && Const(?p -> URI)!=URI2) . BIND(URI AS ?p) }
 
 
 with unmodified exogenous mapping set.public void testInlineWithSubquery()
 SELECT ?s where { 
   BIND(CONST AS ?p) . ?s ?p ?s 
   SELECT ?s where {
     BIND(CONST2 AS ?p) . ?s ?p ?s 
   }
 }
 
 
 and a binding for ?s in an input solution, verify that the
 AST is rewritten as:
 
 
 SELECT ?s where { 
   ?s CONST ?s 
   SELECT ?s where {
     ?s CONST2 ?s
   } VALUES ?p (CONST2)
 }
 
 
 where CONST is the binding for ?p in the input solution
 and the exogeneous mapping { ?p -> CONST } is added.public void testSubqueryWithValues()
 SELECT ?s where { 
   ?s ?p ?o
   SELECT ?x where {
     ?s ?p ?o
     BIND(CONST1 AS ?x)
   } VALUES ?y (CONST2)
 }
 
 
 and an exogenous binding CONST3 for ?s in an input solution, verify that the
 AST is rewritten as:
 
 
 SELECT ?s where { 
   CONST3 ?p ?o
   SELECT ?x where {
     ?s ?p ?o
   } VALUES ?x ?y (CONST1 CONST2)
 }
 public void testTicket653()
 SELECT ?uri ?p ?o WHERE { 
   BIND (CONST as ?uri ) 
   ?uri ?p ?o . 
   OPTIONAL { 
     ?uri a ?type . 
     ?type rdfs:label ?typelabel . 
   } 
 }
 
 
 is rewritten as
 
 
 SELECT ?uri ?p ?o WHERE { 
   CONST ?p ?o . 
   OPTIONAL { 
     ?uri a ?type . 
     ?type rdfs:label ?typelabel . 
   } 
 }
 
  
  where { ?uri -> CONST } is added to the exogenous mapping set.public void testTicketBLZG2042()
 SELECT ?s where { BIND(CONST AS ?o) . ?s / ?o }
   
 
 , verify that the AST is rewritten as
 
 
 SELECT ?s where { ?s / ?o }
   
 
 where CONST is the binding for ?o in the input solution
 and the exogeneous mapping { ?p -> CONST } is added.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.