Package org.openrdf.sail.rdbms.algebra

Examples of org.openrdf.sail.rdbms.algebra.SqlAnd


  public static SqlExpr abs(SqlExpr arg) {
    return new SqlAbs(arg);
  }

  public static SqlExpr and(SqlExpr... args) {
    return new SqlAnd(args);
  }
View Full Code Here


          }
        }
        else if (arg instanceof SqlAnd) {
          // value IS NOT NULL AND value = ? OR NULL
          // -> value = ?
          SqlAnd and = (SqlAnd)arg;
          // search for the value IS NOT NULL expression
          for (SqlExpr isNotNull : and.getArgs()) {
            SqlExpr variable = arg(arg(isNotNull, SqlNot.class), SqlIsNull.class);
            if (variable == null) {
              continue;
            }
            // search for the value = ? expression
            for (SqlExpr eq : and.getArgs()) {
              SqlExpr constant = other(eq, variable, SqlEq.class);
              if (constant == null) {
                continue;
              }
              if (constant instanceof SqlConstant) {
                node.removeChildNode(sqlNull);
                and.removeChildNode(isNotNull);
                if (node.getNumberOfArguments() == 1) {
                  replace(node, node.getArg(0));
                }
                if (and.getNumberOfArguments() == 1) {
                  replace(and, and.getArg(0));
                }
                return;
              }
            }
          }
View Full Code Here

  public static SqlExpr abs(SqlExpr arg) {
    return new SqlAbs(arg);
  }

  public static SqlExpr and(SqlExpr left, SqlExpr right) {
    return new SqlAnd(left, right);
  }
View Full Code Here

      }
    }
    else if (right instanceof SqlNull && left instanceof SqlAnd) {
      // value IS NOT NULL AND value = ? OR NULL
      // -> value = ?
      SqlAnd l = (SqlAnd)left;
      SqlExpr lleft = l.getLeftArg();
      SqlExpr lright = l.getRightArg();
      SqlExpr isNotNull = arg(arg(lleft, SqlNot.class), SqlIsNull.class);
      SqlExpr isNotEq = other(lright, isNotNull, SqlEq.class);
      if (isNotEq instanceof SqlConstant) {
        replace(node, lright);
      }
View Full Code Here

TOP

Related Classes of org.openrdf.sail.rdbms.algebra.SqlAnd

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.