Package org.modeshape.jcr.query.model

Examples of org.modeshape.jcr.query.model.Comparison


        // Create the expected plan ...
        PlanNode expected = new PlanNode(Type.ACCESS, selector("x1"));
        PlanNode project = new PlanNode(Type.PROJECT, expected, selector("x1"));
        project.setProperty(Property.PROJECT_COLUMNS, columns(column("x1", "c11"), column("x1", "c12", "c2")));
        PlanNode select1 = new PlanNode(Type.SELECT, project, selector("x1"));
        select1.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("x1"), "c11"), Operator.EQUAL_TO,
                                                                     new Literal("value")));
        PlanNode select2 = new PlanNode(Type.SELECT, select1, selector("x1"));
        select2.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("x1"), "c13"),
                                                                     Operator.LESS_THAN, new Literal(3L)));
        PlanNode source = new PlanNode(Type.SOURCE, select2, selector("x1"));
        source.setProperty(Property.SOURCE_NAME, selector("t1"));
        source.setProperty(Property.SOURCE_ALIAS, selector("x1"));
        source.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t1")).getColumns());
View Full Code Here


        // Create the expected plan ...
        PlanNode expected = new PlanNode(Type.ACCESS, selector("t1"));
        PlanNode project = new PlanNode(Type.PROJECT, expected, selector("t1"));
        project.setProperty(Property.PROJECT_COLUMNS, columns(column("t1", "c11"), column("t1", "c12")));
        PlanNode select = new PlanNode(Type.SELECT, project, selector("t1"));
        select.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t1"), "c13"), Operator.LESS_THAN,
                                                                    new Literal(3L)));
        PlanNode source = new PlanNode(Type.SOURCE, select, selector("t1"));
        source.setProperty(Property.SOURCE_NAME, selector("t1"));
        source.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t1")).getColumns());
        // Compare the expected and actual plan ...
View Full Code Here

        PlanNode subquery = new PlanNode(Type.ACCESS, expected, selector("t2"));
        subquery.setProperty(Property.VARIABLE_NAME, Subquery.VARIABLE_PREFIX + "1");
        PlanNode project2 = new PlanNode(Type.PROJECT, subquery, selector("t2"));
        project2.setProperty(Property.PROJECT_COLUMNS, columns(column("t2", "c21")));
        PlanNode select2 = new PlanNode(Type.SELECT, project2, selector("t2"));
        select2.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t2"), "c22"),
                                                                     Operator.LESS_THAN, new Literal(3L)));
        PlanNode source2 = new PlanNode(Type.SOURCE, select2, selector("t2"));
        source2.setProperty(Property.SOURCE_NAME, selector("t2"));
        source2.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t2")).getColumns());
View Full Code Here

        PlanNode subquery1 = new PlanNode(Type.ACCESS, expected, selector("t2"));
        subquery1.setProperty(Property.VARIABLE_NAME, Subquery.VARIABLE_PREFIX + "1");
        PlanNode project1 = new PlanNode(Type.PROJECT, subquery1, selector("t2"));
        project1.setProperty(Property.PROJECT_COLUMNS, columns(column("t2", "c22")));
        PlanNode select1 = new PlanNode(Type.SELECT, project1, selector("t2"));
        select1.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t2"), "c23"), Operator.EQUAL_TO,
                                                                     new Literal("extra")));
        PlanNode source1 = new PlanNode(Type.SOURCE, select1, selector("t2"));
        source1.setProperty(Property.SOURCE_NAME, selector("t2"));
        source1.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t2")).getColumns());

        PlanNode depQuery2 = new PlanNode(Type.DEPENDENT_QUERY, expected, selector("t1"), selector("t2"));

        PlanNode subquery2 = new PlanNode(Type.ACCESS, depQuery2, selector("t2"));
        subquery2.setProperty(Property.VARIABLE_NAME, Subquery.VARIABLE_PREFIX + "2");
        PlanNode project2 = new PlanNode(Type.PROJECT, subquery2, selector("t2"));
        project2.setProperty(Property.PROJECT_COLUMNS, columns(column("t2", "c21")));
        PlanNode select2 = new PlanNode(Type.SELECT, project2, selector("t2"));
        select2.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t2"), "c22"),
                                                                     Operator.LESS_THAN, new Literal(3L)));
        PlanNode source2 = new PlanNode(Type.SOURCE, select2, selector("t2"));
        source2.setProperty(Property.SOURCE_NAME, selector("t2"));
        source2.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t2")).getColumns());

        PlanNode mainQuery = new PlanNode(Type.ACCESS, depQuery2, selector("t1"));
        PlanNode project = new PlanNode(Type.PROJECT, mainQuery, selector("t1"));
        project.setProperty(Property.PROJECT_COLUMNS, columns(column("t1", "c11"), column("t1", "c12")));
        PlanNode firstSelect = new PlanNode(Type.SELECT, project, selector("t1"));
        firstSelect.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("t1"), "c13"),
                                                                          new BindVariableName(Subquery.VARIABLE_PREFIX + "2")));
        PlanNode secondSelect = new PlanNode(Type.SELECT, firstSelect, selector("t1"));
        secondSelect.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t1"), "c12"),
                                                                          Operator.EQUAL_TO,
                                                                          new BindVariableName(Subquery.VARIABLE_PREFIX + "1")));
        PlanNode source = new PlanNode(Type.SOURCE, secondSelect, selector("t1"));
        source.setProperty(Property.SOURCE_NAME, selector("t1"));
        source.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t1")).getColumns());
View Full Code Here

        PlanNode subquery2 = new PlanNode(Type.ACCESS, depQuery2, selector("t2"));
        subquery2.setProperty(Property.VARIABLE_NAME, Subquery.VARIABLE_PREFIX + "2");
        PlanNode project2 = new PlanNode(Type.PROJECT, subquery2, selector("t2"));
        project2.setProperty(Property.PROJECT_COLUMNS, columns(column("t2", "c22")));
        PlanNode select2 = new PlanNode(Type.SELECT, project2, selector("t2"));
        select2.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t2"), "c23"), Operator.EQUAL_TO,
                                                                     new Literal("extra")));
        PlanNode source2 = new PlanNode(Type.SOURCE, select2, selector("t2"));
        source2.setProperty(Property.SOURCE_NAME, selector("t2"));
        source2.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t2")).getColumns());

        PlanNode subquery1 = new PlanNode(Type.ACCESS, depQuery2, selector("t2"));
        subquery1.setProperty(Property.VARIABLE_NAME, Subquery.VARIABLE_PREFIX + "1");
        PlanNode project1 = new PlanNode(Type.PROJECT, subquery1, selector("t2"));
        project1.setProperty(Property.PROJECT_COLUMNS, columns(column("t2", "c21")));
        PlanNode select1 = new PlanNode(Type.SELECT, project1, selector("t2"));
        select1.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t2"), "c22"),
                                                                     Operator.LESS_THAN,
                                                                     new BindVariableName(Subquery.VARIABLE_PREFIX + "2")));
        PlanNode source1 = new PlanNode(Type.SOURCE, select1, selector("t2"));
        source1.setProperty(Property.SOURCE_NAME, selector("t2"));
        source1.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t2")).getColumns());
View Full Code Here

        // Create the expected plan ...
        PlanNode access = new PlanNode(Type.ACCESS, selector("v1"));
        PlanNode project = new PlanNode(Type.PROJECT, access, selector("v1"));
        project.setProperty(Property.PROJECT_COLUMNS, columns(column("v1", "c11", "c1")));
        PlanNode select1 = new PlanNode(Type.SELECT, project, selector("v1"));
        select1.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("v1"), "c11"), Operator.EQUAL_TO,
                                                                     new Literal("x")));
        PlanNode select2 = new PlanNode(Type.SELECT, select1, selector("v1"));
        select2.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("v1"), "c12"), Operator.EQUAL_TO,
                                                                     new Literal("y")));
        PlanNode select3 = new PlanNode(Type.SELECT, select2, selector("v1"));
        select3.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("v1"), "c13"),
                                                                     Operator.LESS_THAN, new Literal(3L)));
        PlanNode source = new PlanNode(Type.SOURCE, select3, selector("v1"));
        source.setProperty(Property.SOURCE_NAME, selector("t1"));
        source.setProperty(Property.SOURCE_ALIAS, selector("v1"));
        source.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t1")).getColumns());
View Full Code Here

        PlanNode leftAccess = new PlanNode(Type.ACCESS, join, selector("t1"));
        PlanNode leftProject = new PlanNode(Type.PROJECT, leftAccess, selector("t1"));
        leftProject.setProperty(Property.PROJECT_COLUMNS, columns(column("t1", "c11", "c1")));
        PlanNode leftSelect1 = new PlanNode(Type.SELECT, leftProject, selector("t1"));
        leftSelect1.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t1"), "c11"),
                                                                         Operator.EQUAL_TO, new Literal('x')));
        PlanNode leftSelect2 = new PlanNode(Type.SELECT, leftSelect1, selector("t1"));
        leftSelect2.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t1"), "c12"),
                                                                         Operator.EQUAL_TO, new Literal('y')));
        PlanNode leftSource = new PlanNode(Type.SOURCE, leftSelect2, selector("t1"));
        leftSource.setProperty(Property.SOURCE_NAME, selector("t1"));
        leftSource.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t1")).getColumns());

        PlanNode rightAccess = new PlanNode(Type.ACCESS, join, selector("t2"));
        PlanNode rightProject = new PlanNode(Type.PROJECT, rightAccess, selector("t2"));
        rightProject.setProperty(Property.PROJECT_COLUMNS, columns(nonSelectedColumn("t2", "c21")));
        PlanNode rightSelect1 = new PlanNode(Type.SELECT, rightProject, selector("t2"));
        rightSelect1.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t2"), "c21"),
                                                                          Operator.EQUAL_TO, new Literal('x')));
        PlanNode rightSource = new PlanNode(Type.SOURCE, rightSelect1, selector("t2"));
        rightSource.setProperty(Property.SOURCE_NAME, selector("t2"));
        rightSource.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t2")).getColumns());
View Full Code Here

        sort.setProperty(Property.SORT_ORDER_BY, orderings(ascending("t1", "c11"), descending("t1", "c12")));
        PlanNode leftAccess = new PlanNode(Type.ACCESS, sort, selector("t1"));
        PlanNode leftProject = new PlanNode(Type.PROJECT, leftAccess, selector("t1"));
        leftProject.setProperty(Property.PROJECT_COLUMNS, columns(column("t1", "c11", "c1"), column("t1", "c12")));
        PlanNode leftSelect1 = new PlanNode(Type.SELECT, leftProject, selector("t1"));
        leftSelect1.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t1"), "c11"),
                                                                         Operator.EQUAL_TO, new Literal("x")));
        PlanNode leftSelect2 = new PlanNode(Type.SELECT, leftSelect1, selector("t1"));
        leftSelect2.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t1"), "c12"),
                                                                         Operator.EQUAL_TO, new Literal("y")));
        PlanNode leftSource = new PlanNode(Type.SOURCE, leftSelect2, selector("t1"));
        leftSource.setProperty(Property.SOURCE_NAME, selector("t1"));
        leftSource.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t1")).getColumns());
View Full Code Here

        sort.setProperty(Property.SORT_ORDER_BY, orderings(ascending("X", "c11"), descending("X", "c12")));
        PlanNode leftAccess = new PlanNode(Type.ACCESS, sort, selector("X"));
        PlanNode leftProject = new PlanNode(Type.PROJECT, leftAccess, selector("X"));
        leftProject.setProperty(Property.PROJECT_COLUMNS, columns(column("X", "c11", "c1"), column("X", "c12")));
        PlanNode leftSelect1 = new PlanNode(Type.SELECT, leftProject, selector("X"));
        leftSelect1.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("X"), "c11"),
                                                                         Operator.EQUAL_TO, new Literal("x")));
        PlanNode leftSelect2 = new PlanNode(Type.SELECT, leftSelect1, selector("X"));
        leftSelect2.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("X"), "c12"),
                                                                         Operator.EQUAL_TO, new Literal("y")));
        PlanNode leftSource = new PlanNode(Type.SOURCE, leftSelect2, selector("X"));
        leftSource.setProperty(Property.SOURCE_NAME, selector("t1"));
        leftSource.setProperty(Property.SOURCE_ALIAS, selector("X"));
        leftSource.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t1")).getColumns());
View Full Code Here

        sort.setProperty(Property.SORT_ORDER_BY, orderings(ascending("X", "c1"), descending("X", "c12")));
        PlanNode leftAccess = new PlanNode(Type.ACCESS, sort, selector("X"));
        PlanNode leftProject = new PlanNode(Type.PROJECT, leftAccess, selector("X"));
        leftProject.setProperty(Property.PROJECT_COLUMNS, columns(column("X", "c11", "c1"), column("X", "c12")));
        PlanNode leftSelect1 = new PlanNode(Type.SELECT, leftProject, selector("X"));
        leftSelect1.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("X"), "c11"),
                                                                         Operator.EQUAL_TO, new Literal("x")));
        PlanNode leftSelect2 = new PlanNode(Type.SELECT, leftSelect1, selector("X"));
        leftSelect2.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("X"), "c12"),
                                                                         Operator.EQUAL_TO, new Literal("y")));
        PlanNode leftSource = new PlanNode(Type.SOURCE, leftSelect2, selector("X"));
        leftSource.setProperty(Property.SOURCE_NAME, selector("t1"));
        leftSource.setProperty(Property.SOURCE_ALIAS, selector("X"));
        leftSource.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("t1")).getColumns());
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.query.model.Comparison

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.