Package org.jboss.dna.graph.query.validate

Examples of org.jboss.dna.graph.query.validate.Schemata


     */
    public PlanNode execute( QueryContext context,
                             PlanNode plan,
                             LinkedList<OptimizerRule> ruleStack ) {
        // For each of the SOURCE nodes ...
        Schemata schemata = context.getSchemata();
        for (PlanNode sourceNode : plan.findAllAtOrBelow(Type.SOURCE)) {

            // Resolve the node to find the definition in the schemata ...
            SelectorName tableName = sourceNode.getProperty(Property.SOURCE_NAME, SelectorName.class);
            SelectorName tableAlias = sourceNode.getProperty(Property.SOURCE_ALIAS, SelectorName.class);
            if (tableAlias != null) {
                Table table = schemata.getTable(tableName);
                // We also need to replace references to the alias for the view ...
                PlanUtil.ColumnMapping aliasMappings = PlanUtil.createMappingForAliased(tableAlias, table, sourceNode);
                // Adjust the plan nodes above the SOURCE node ...
                PlanUtil.replaceViewReferences(context, sourceNode.getParent(), aliasMappings);
                // And adjust the SOURCE node ...
View Full Code Here


            SelectorName leftSelectorName = joinCondition.getSelector1Name();
            SelectorName rightSelectorName = joinCondition.getSelector2Name();
            String leftPropertyName = joinCondition.getProperty1Name();
            String rightPropertyName = joinCondition.getProperty2Name();

            Schemata schemata = context.getSchemata();
            Schemata.Table leftTable = schemata.getTable(leftSelectorName);
            Schemata.Column leftColumn = leftTable.getColumn(leftPropertyName);
            String leftType = leftColumn.getPropertyType();

            Schemata.Table rightTable = schemata.getTable(rightSelectorName);
            Schemata.Column rightColumn = rightTable.getColumn(rightPropertyName);
            String rightType = rightColumn.getPropertyType();

            TypeSystem typeSystem = context.getTypeSystem();
            if (leftType.equals(rightType)) {
View Full Code Here

                PlanNode rightNode = joinNode.getLastChild().findAtOrBelow(Type.SOURCE);
                assert leftNode != null;
                assert rightNode != null;
                EquiJoinCondition equiJoin = (EquiJoinCondition)condition;
                // Find the names (or aliases) of the tables ...
                Schemata schemata = context.getSchemata();
                assert schemata != null;
                SelectorName leftTableName = leftNode.getProperty(Property.SOURCE_NAME, SelectorName.class);
                SelectorName rightTableName = rightNode.getProperty(Property.SOURCE_NAME, SelectorName.class);
                assert leftTableName != null;
                assert rightTableName != null;
                // Presumably the join condition is using at least one alias, but we only care about the actual name ...
                if (!leftTableName.equals(rightTableName)) {
                    // The join is not joining the same table, so this doesn't meet the condition ...
                    continue;
                }
                // Find the schemata columns referenced by the join condition ...
                Table table = schemata.getTable(leftTableName);
                if (table == null) {
                    context.getProblems().addError(GraphI18n.tableDoesNotExist, leftTableName);
                    continue;
                }
                String leftColumnName = equiJoin.getProperty1Name();
View Full Code Here

        CanonicalPlanner planner = new CanonicalPlanner();

        // Prepare the maps that will record the old-to-new mappings from the old view SOURCE nodes to the table SOURCEs ...

        // For each of the SOURCE nodes ...
        Schemata schemata = context.getSchemata();
        Set<PlanNode> processedSources = new HashSet<PlanNode>();
        boolean foundViews = false;
        do {
            foundViews = false;
            for (PlanNode sourceNode : plan.findAllAtOrBelow(Type.SOURCE)) {
                if (processedSources.contains(sourceNode)) continue;
                processedSources.add(sourceNode);

                // Resolve the node to find the definition in the schemata ...
                SelectorName tableName = sourceNode.getProperty(Property.SOURCE_NAME, SelectorName.class);
                SelectorName tableAlias = sourceNode.getProperty(Property.SOURCE_ALIAS, SelectorName.class);
                Table table = schemata.getTable(tableName);
                if (table instanceof View) {
                    View view = (View)table;
                    PlanNode viewPlan = viewPlanCache.get(tableName);
                    if (viewPlan == null) {
                        viewPlan = planner.createPlan(context, view.getDefinition());
View Full Code Here

                            Analyzer analyzer ) {
        super(delegate);
        this.constraint = constraint;
        this.variables = variables != null ? variables : Collections.<String, Object>emptyMap();
        TypeSystem types = delegate.getContext().getTypeSystem();
        Schemata schemata = delegate.getContext().getSchemata();
        this.checker = createChecker(types, schemata, delegate.getColumns(), this.constraint, this.variables, analyzer);
    }
View Full Code Here

         *
         * @see javax.jcr.query.Query#execute()
         */
        public QueryResult execute() throws RepositoryException {
            // Submit immediately to the workspace graph ...
            Schemata schemata = session.workspace().nodeTypeManager().schemata();
            QueryResults result = session.repository().queryManager().query(session.workspace().getName(),
                                                                            query,
                                                                            schemata,
                                                                            hints,
                                                                            variables);
View Full Code Here

        TypeSystem typeSystem = context.getValueFactories().getTypeSystem();
        // Parsing must be done now ...
        QueryCommand command = queryParser.parseQuery(expression, typeSystem);
        assert command != null : "Could not parse " + expression;

        Schemata schemata = getRepositorySchemata();

        Set<String> workspaceNames = repository.workspaceNames();
        for (String workspaceName : workspaceNames) {
            QueryResults result = repository.queryManager().query(workspaceName, command, schemata, null, null);
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.query.validate.Schemata

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.