public void visitComplexQueryWithNegation(ComplexQueryWithNegations query) { stack.add(0, query); // List<FormulaVariable> universalVariables = // variableFinder.getUniversalVariables(variableMaps, stack); // variables.add(0, universalVariables); ComplexConjunctiveQuery positiveQuery = query.getComplexQuery(); positiveQuery.accept(this); List<NegatedComplexQuery> sortedQueries = new ArrayList<NegatedComplexQuery>(query.getNegatedComplexQueries()); Collections.sort(sortedQueries); for (NegatedComplexQuery negatedQuery : sortedQueries) { negatedQuery.accept(this); } // variables.remove(0); stack.remove(0); }
private static String findViewName(NegatedComplexQuery negation) { String fromViewName; ComplexQueryWithNegations negatedQuery = negation.getComplexQuery(); if (materializedViews.containsKey(negatedQuery.getId())) { return materializedViews.get(negatedQuery.getId()); } // if (materializedViews.containsKey(negatedQuery.toString())) { // return materializedViews.get(negatedQuery.toString()); // } if (negatedQuery .getNegatedComplexQueries() .isEmpty()) { // || isRewiQueryWithOnlySubsumeNegations(negatedQuery)) { fromViewName = sqlNameForPositiveView(negation.getComplexQuery()); } else { fromViewName = sqlNameForViewWithIntersection(negation.getComplexQuery()); } return fromViewName; }