示例#1
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;
 }
示例#2
0
 public void visitNegatedComplexQuery(NegatedComplexQuery negatedQuery) {
   stack.add(0, negatedQuery);
   List<FormulaVariable> existentialVariables =
       variableFinder.getExistentialVariables(variableMaps, stack);
   variables.add(0, existentialVariables);
   result
       .append("\n")
       .append(generateIndent())
       .append(utility.SECONDARY_INDENT)
       .append("and not ");
   if (useSaveFormat) {
     result.append("exists ");
   } else {
     if (!existentialVariables.isEmpty()) {
       result.append("exist ");
       result.append(utility.printVariables(existentialVariables));
     }
   }
   ComplexQueryWithNegations childQuery = negatedQuery.getComplexQuery();
   result.append(" (");
   if (!useSaveFormat) {
     result
         .append("//")
         .append(negatedQuery.getProvenance())
         .append(" - ")
         .append(childQuery.getId());
   }
   result.append("\n");
   childQuery.accept(this);
   List<Expression> equalities = variableFinder.getEqualities(variableMaps, stack);
   if (!equalities.isEmpty()) {
     result.append(generateEqualityString(equalities, variables, true));
   }
   result.append("\n").append(generateIndent()).append(utility.SECONDARY_INDENT).append(")");
   variables.remove(0);
   stack.remove(0);
 }
示例#3
0
 public static String sqlNameForPositiveView(ComplexQueryWithNegations query) {
   return WORK_SCHEMA_NAME + "." + POSITIVE_QUERY + query.getId();
 }
示例#4
0
 public static String sqlNameForViewWithIntersection(ComplexQueryWithNegations query) {
   return WORK_SCHEMA_NAME + "." + query.getId();
 }