@Test public void test_flatten_basic_02() { test("{ :s1 :p :o }", ":s1 :p :o") ; }
private static void test(String input, String expected) { if ( expected == null ) expected = input ; String qs = gen(PRE, input) ; String qsExpected = gen(PRE, expected) ; Query query = QueryFactory.create(qs, Syntax.syntaxARQ) ; Query query2 = QueryTransformOps.transform(query, new ElementTransformCleanGroupsOfOne()) ; Query queryExpected = QueryFactory.create(qsExpected, Syntax.syntaxARQ) ; Op op1 = Algebra.compile(query) ; Op op2 = Algebra.compile(query2) ; assertEquals("Algebra different", op1, op2) ; boolean modified = ! query.equals(query2) ; boolean expectModification = !queryExpected.equals(query) ; assertEquals("Expect query modifed?", expectModification, modified) ; }
@Test public void test_flatten_optional_03() { test("OPTIONAL{?s1f :q ?z FILTER(?z) }", null) ; }
@Test public void test_flatten_basic_03() { test("{{ :s2 :p :o }}", ":s2 :p :o") ; }
@Test public void test_flatten_fileter_02() { test("{ :s1 :p :o {FILTER(?x)} }", ":s1 :p :o {FILTER(?x)}") ; }
@Test public void test_flatten_pattern_04() { test("{{ ?s :q ?z } UNION {{?s :q ?z}}}", "{?s :q ?z} UNION {?s :q ?z }") ; }
@Test public void test_flatten_filter_01() { test(":s0 :p :o .{FILTER(?x)}", null) ; }
@Test public void test_flatten_filter_03() { test("{{ :s1 :p :o {FILTER(?x)}}}", " :s1 :p :o {FILTER(?x)}") ; }
@Test public void test_flatten_optional_02() { test("OPTIONAL{{?s2 :q ?z}}", "OPTIONAL{?s2 :q ?z}") ; }
@Test public void test_flatten_arq_02() { test("EXISTS {{ :s :p :o }}", "EXISTS { :s :p :o }") ; }
@Test public void test_flatten_optional_01() { test("OPTIONAL{ ?s1 :q ?z }", null) ; }
@Test public void test_flatten_optional_05() { test("OPTIONAL{{{?S3 :q ?z FILTER(?z) }}}", "OPTIONAL{{?S3 :q ?z FILTER(?z) }}") ; }
@Test public void test_flatten_pattern_01() { test("{?s :q ?z } UNION {?s :q ?z }", null) ; }
@Test public void test_flatten_pattern_02() { test("{{?s :q ?z}} UNION {?s :q ?z }", "{?s :q ?z} UNION {?s :q ?z }") ; }
@Test public void test_flatten_expr_01() { test("FILTER EXISTS { :s :p :o }", null) ; }
@Test public void test_flatten_basic_01() { test(":s0 :p :o .", null) ; }
@Test public void test_flatten_basic_04() { test("{{{ :s3 :p :o }}}", ":s3 :p :o") ; }
@Test public void test_flatten_optional_04() { test("OPTIONAL{{?S2 :q ?z FILTER(?z) }}", null); }
@Test public void test_flatten_optional_06() { test("OPTIONAL{?sx :q ?z {FILTER(?z)} }", null) ; }
@Test public void test_flatten_pattern_03() { test("{ ?s :q ?z} UNION {{?s :q ?z}}", "{?s :q ?z} UNION {?s :q ?z }") ; }