Package org.modeshape.jcr.query.model

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


    @SuppressWarnings( "fallthrough" )
    protected void verifyComparison( DynamicOperand operand,
                                     Operator op,
                                     StaticOperand rhs ) {
        if (operand instanceof PropertyValue) {
            PropertyValue propValue = (PropertyValue)operand;
            verifyOperator(propValue.selectorName(), propValue.getPropertyName(), op);
        } else if (operand instanceof NodeName) {
            // Verify that the rhs is convertable to a name ...
            if (rhs instanceof Literal) {
                boolean fail = false;
                // The literal value must be a NAME or URI ...
View Full Code Here


        assertThat(constraint, is(instanceOf(Between.class)));
        Between between = (Between)constraint;
        assertThat(between.isLowerBoundIncluded(), is(true));
        assertThat(between.isUpperBoundIncluded(), is(true));
        assertThat(between.getOperand(), is(instanceOf(PropertyValue.class)));
        PropertyValue operand = (PropertyValue)between.getOperand();
        assertThat(operand.selectorName(), is(selector.name()));
        assertThat(operand.getPropertyName(), is("id"));
        assertThat(between.getLowerBound(), is(instanceOf(Literal.class)));
        assertThat(between.getLowerBound(), is(instanceOf(Literal.class)));
        assertThat((Literal)between.getLowerBound(), is(literal("lower")));
        assertThat((Literal)between.getUpperBound(), is(literal("upper")));
    }
View Full Code Here

        assertThat(constraint, is(instanceOf(Between.class)));
        Between between = (Between)constraint;
        assertThat(between.isLowerBoundIncluded(), is(false));
        assertThat(between.isUpperBoundIncluded(), is(false));
        assertThat(between.getOperand(), is(instanceOf(PropertyValue.class)));
        PropertyValue operand = (PropertyValue)between.getOperand();
        assertThat(operand.selectorName(), is(selector.name()));
        assertThat(operand.getPropertyName(), is("id"));
        assertThat(between.getLowerBound(), is(instanceOf(Literal.class)));
        assertThat(between.getLowerBound(), is(instanceOf(Literal.class)));
        assertThat((Literal)between.getLowerBound(), is(literal("lower")));
        assertThat((Literal)between.getUpperBound(), is(literal("upper")));
    }
View Full Code Here

        assertThat(constraint, is(instanceOf(Between.class)));
        Between between = (Between)constraint;
        assertThat(between.isLowerBoundIncluded(), is(true));
        assertThat(between.isUpperBoundIncluded(), is(false));
        assertThat(between.getOperand(), is(instanceOf(PropertyValue.class)));
        PropertyValue operand = (PropertyValue)between.getOperand();
        assertThat(operand.selectorName(), is(selector.name()));
        assertThat(operand.getPropertyName(), is("id"));
        assertThat(between.getLowerBound(), is(instanceOf(Literal.class)));
        assertThat(between.getLowerBound(), is(instanceOf(Literal.class)));
        assertThat((Literal)between.getLowerBound(), is(literal("lower")));
        assertThat((Literal)between.getUpperBound(), is(literal("upper")));
    }
View Full Code Here

        assertThat(constraint, is(instanceOf(Between.class)));
        Between between = (Between)constraint;
        assertThat(between.isLowerBoundIncluded(), is(false));
        assertThat(between.isUpperBoundIncluded(), is(true));
        assertThat(between.getOperand(), is(instanceOf(PropertyValue.class)));
        PropertyValue operand = (PropertyValue)between.getOperand();
        assertThat(operand.selectorName(), is(selector.name()));
        assertThat(operand.getPropertyName(), is("id"));
        assertThat(between.getLowerBound(), is(instanceOf(Literal.class)));
        assertThat(between.getLowerBound(), is(instanceOf(Literal.class)));
        assertThat((Literal)between.getLowerBound(), is(literal("lower")));
        assertThat((Literal)between.getUpperBound(), is(literal("upper")));
    }
View Full Code Here

        assertThat(constraint, is(instanceOf(Between.class)));
        Between between = (Between)constraint;
        assertThat(between.isLowerBoundIncluded(), is(true));
        assertThat(between.isUpperBoundIncluded(), is(true));
        assertThat(between.getOperand(), is(instanceOf(PropertyValue.class)));
        PropertyValue operand = (PropertyValue)between.getOperand();
        assertThat(operand.selectorName(), is(selector.name()));
        assertThat(operand.getPropertyName(), is("id"));
        assertThat(between.getLowerBound(), is(instanceOf(Literal.class)));
        assertThat(between.getLowerBound(), is(instanceOf(Literal.class)));
        assertThat((Literal)between.getLowerBound(), is(literal("lower")));
        assertThat((Literal)between.getUpperBound(), is(literal("upper")));
    }
View Full Code Here

        // 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());

        PlanNode mainQuery = new PlanNode(Type.ACCESS, expected, selector("t1"));
        PlanNode project = new PlanNode(Type.PROJECT, mainQuery, 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 SetCriteria(new PropertyValue(selector("t1"), "c13"),
                                                                     new BindVariableName(Subquery.VARIABLE_PREFIX + "1")));
        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());
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

TOP

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

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.