Examples of QueryCommand


Examples of org.drools.process.command.QueryCommand

        return this.commandService.execute( cmd );
    }

    public QueryResults getQueryResults(String query,
                                        Object[] arguments) {
        QueryCommand cmd = new QueryCommand(null, query, arguments);
        return this.commandService.execute( cmd );
    }   
View Full Code Here

Examples of org.jboss.dna.graph.query.model.QueryCommand

        public Builder addView( String name,
                                String definition ) {
            CheckArg.isNotEmpty(name, "name");
            CheckArg.isNotEmpty(definition, "definition");
            SqlQueryParser parser = new SqlQueryParser();
            QueryCommand command = parser.parseQuery(definition, typeSystem);
            this.viewDefinitions.put(new SelectorName(name), command);
            return this;
        }
View Full Code Here

Examples of org.jboss.dna.graph.query.model.QueryCommand

            boolean added = false;
            do {
                added = false;
                Set<SelectorName> viewNames = new HashSet<SelectorName>(definitions.keySet());
                for (SelectorName name : viewNames) {
                    QueryCommand command = definitions.get(name);
                    // Create the canonical plan for the definition ...
                    QueryContext queryContext = new QueryContext(schemata, typeSystem);
                    CanonicalPlanner planner = new CanonicalPlanner();
                    PlanNode plan = planner.createPlan(queryContext, command);
                    if (queryContext.getProblems().hasErrors()) {
                        continue;
                    }

                    // Get the columns from the top-level PROJECT ...
                    PlanNode project = plan.findAtOrBelow(Type.PROJECT);
                    assert project != null;
                    List<org.jboss.dna.graph.query.model.Column> columns = project.getPropertyAsList(Property.PROJECT_COLUMNS,
                                                                                                     org.jboss.dna.graph.query.model.Column.class);
                    assert !columns.isEmpty();

                    // Go through all the columns and look up the types ...
                    List<Column> viewColumns = new ArrayList<Column>(columns.size());
                    for (org.jboss.dna.graph.query.model.Column column : columns) {
                        // Find the table that the column came from ...
                        Table source = schemata.getTable(column.getSelectorName());
                        if (source == null) break;
                        String viewColumnName = column.getColumnName();
                        String sourceColumnName = column.getPropertyName(); // getColumnName() returns alias
                        Column sourceColumn = source.getColumn(sourceColumnName);
                        if (sourceColumn == null) {
                            throw new InvalidQueryException(Visitors.readable(command),
                                                            "The view references a non-existant column '"
                                                            + column.getColumnName() + "' in '" + source.getName() + "'");
                        }
                        viewColumns.add(new ImmutableColumn(viewColumnName, sourceColumn.getPropertyType(),
                                                            sourceColumn.isFullTextSearchable()));
                    }
                    if (viewColumns.size() != columns.size()) {
                        // We weren't able to resolve all of the columns,
                        // so maybe the columns were referencing yet-to-be-built views ...
                        continue;
                    }

                    // If we could resolve the definition ...
                    ImmutableView view = new ImmutableView(name, viewColumns, command);
                    definitions.remove(name);
                    schemata = schemata.with(view);
                    added = true;
                }
            } while (added && !definitions.isEmpty());

            if (!definitions.isEmpty()) {
                QueryCommand command = definitions.values().iterator().next();
                throw new InvalidQueryException(Visitors.readable(command), "The view definition cannot be resolved: "
                                                                            + Visitors.readable(command));
            }

            return schemata;
View Full Code Here

Examples of org.jboss.dna.graph.query.model.QueryCommand

     *
     * @return the resulting query command; never null
     * @see #clear()
     */
    public QueryCommand query() {
        QueryCommand result = new Query(source, constraint, orderings, columns, limit, distinct);
        if (this.firstQuery != null) {
            // EXCEPT has a higher precedence than INTERSECT or UNION, so if the first query is
            // an INTERSECT or UNION SetQuery, the result should be applied to the RHS of the previous set ...
            if (firstQuery instanceof SetQuery && firstQuerySetOperation == Operation.EXCEPT) {
                SetQuery setQuery = (SetQuery)firstQuery;
                QueryCommand left = setQuery.getLeft();
                QueryCommand right = setQuery.getRight();
                SetQuery exceptQuery = new SetQuery(right, Operation.EXCEPT, result, firstQueryAll);
                result = new SetQuery(left, setQuery.getOperation(), exceptQuery, setQuery.isAll());
            } else {
                result = new SetQuery(this.firstQuery, this.firstQuerySetOperation, result, this.firstQueryAll);
            }
View Full Code Here

Examples of org.modeshape.jcr.api.query.qom.QueryCommand

        String nodeTypeString = nodeTypeName.getString(context.getNamespaceRegistry());
        String expression = "SELECT * from [" + nodeTypeString + "] LIMIT 1";
        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();

        // Now query the entire repository for any nodes that use this node type ...
View Full Code Here

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

            Set<String> languages = queryParsers.getLanguages();
            throw new InvalidQueryException(JcrI18n.invalidQueryLanguage.text(language, languages));
        }
        try {
            // Parsing must be done now ...
            QueryCommand command = parser.parseQuery(expression, typeSystem);
            if (command == null) {
                // The query is not well-formed and cannot be parsed ...
                throw new InvalidQueryException(JcrI18n.queryCannotBeParsedUsingLanguage.text(language, expression));
            }
            // Set up the hints ...
View Full Code Here

Examples of org.semanticweb.HermiT.debugger.commands.QueryCommand

        registerCommand(new HistoryCommand(this));
        registerCommand(new IsAncestorOfCommand(this));
        registerCommand(new ModelStatsCommand(this));
        registerCommand(new NodesForCommand(this));
        registerCommand(new OriginStatsCommand(this));
        registerCommand(new QueryCommand(this));
        registerCommand(new ReuseNodeForCommand(this));
        registerCommand(new ShowDescriptionGraphCommand(this));
        registerCommand(new ShowDLClausesCommand(this));
        registerCommand(new ShowExistsCommand(this));
        registerCommand(new ShowModelCommand(this));
View Full Code Here

Examples of org.teiid.query.sql.lang.QueryCommand

     */
    public static Object validateSubqueryPushdown(SubqueryContainer subqueryContainer, Object critNodeModelID,
        QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord) throws TeiidComponentException {
      ProcessorPlan plan = subqueryContainer.getCommand().getProcessorPlan();
      if (plan != null) {
        QueryCommand queryCommand = getQueryCommand(plan);
       
        if (queryCommand == null) {
          return null;
        }
       
View Full Code Here

Examples of org.teiid.query.sql.lang.QueryCommand

    Command command = ((AccessNode)accessNode).getCommand();
    if(command == null || !(command instanceof QueryCommand) || ((command instanceof Query) && ((Query)command).getIsXML())) {
        return null;
    }
   
    QueryCommand queryCommand = (QueryCommand)command;
    return queryCommand;
  }
View Full Code Here

Examples of org.teiid.query.sql.lang.QueryCommand

              GroupSymbol intoGroup = (GroupSymbol)accessNode.getFirstChild().getProperty(NodeConstants.Info.INTO_GROUP);
              if (intoGroup != null) {
                commandRoot = NodeEditor.findNodePreOrder(accessNode, NodeConstants.Types.SOURCE).getFirstChild();
              }
                plan = removeUnnecessaryInlineView(plan, commandRoot);
                QueryCommand queryCommand = createQuery(metadata, capFinder, accessNode, commandRoot);
              addDistinct(metadata, capFinder, accessNode, queryCommand);
                command = queryCommand;
                if (intoGroup != null) {
                  Insert insertCommand = new Insert(intoGroup, ResolverUtil.resolveElementsInGroup(intoGroup, metadata), null);
                  insertCommand.setQueryExpression(queryCommand);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.