Package org.openrdf.sail.rdbms.algebra.base

Examples of org.openrdf.sail.rdbms.algebra.base.SqlExpr


  @Override
  public void meet(MathExpr node)
    throws UnsupportedRdbmsOperatorException
  {
    SqlExpr left = createNumericExpr(node.getLeftArg());
    SqlExpr right = createNumericExpr(node.getRightArg());
    MathOp op = node.getOperator();
    result = new SqlMathExpr(left, op, right);
  }
View Full Code Here


        break;
      case GE:
      case GT:
      case LE:
      case LT:
        SqlExpr simple = and(simple(type(left)), simple(type(right)));
        SqlExpr labels = and(cmp(label(left), op, label(right)), simple);
        SqlExpr time = cmp(time(left), op, time(right));
        SqlExpr within = cmp(time(left), op, sub(time(right), num(HR14)));
        SqlExpr comp = or(eq(zoned(left), zoned(right)), within);
        SqlExpr dateTime = and(eq(type(left), type(right)), and(comp, time));
        result = or(cmp(numeric(left), op, numeric(right)), or(dateTime, labels));
        break;
    }
  }
View Full Code Here

  @Override
  public void meet(IsResource node)
    throws UnsupportedRdbmsOperatorException
  {
    SqlExpr isBNode = isNotNull(sql.createBNodeExpr(node.getArg()));
    result = or(isBNode, isNotNull(sql.createUriExpr(node.getArg())));
  }
View Full Code Here

  {
    ValueExpr left = node.getLeftArg();
    ValueExpr right = node.getRightArg();
    SqlCase sqlCase = new SqlCase();
    sqlCase.when(eq(label(right), str("*")), neq(label(left), str("")));
    SqlExpr pattern = concat(lowercase(label(right)), str("%"));
    sqlCase.when(new TrueValue(), like(label(left), pattern));
    result = sqlCase;
  }
View Full Code Here

    }
    else if ((leftIsVar || leftIsConst) && (rightIsVar || rightIsConst)) {
      result = eq(hash(left), hash(right));
    }
    else {
      SqlExpr bnodes = eqComparingNull(bNode(left), bNode(right));
      SqlExpr uris = eqComparingNull(uri(left), uri(right));
      SqlExpr langs = eqComparingNull(lang(left), lang(right));
      SqlExpr datatype = eqComparingNull(type(left), type(right));
      SqlExpr labels = eqComparingNull(label(left), label(right));

      SqlExpr literals = and(langs, and(datatype, labels));
      result = and(bnodes, and(uris, literals));
    }
  }
View Full Code Here

  }

  private SqlExpr equal(ValueExpr left, ValueExpr right)
    throws UnsupportedRdbmsOperatorException
  {
    SqlExpr bnodes = eq(bNode(left), bNode(right));
    SqlExpr uris = eq(uri(left), uri(right));
    SqlCase scase = new SqlCase();
    scase.when(or(isNotNull(bNode(left)), isNotNull(bNode(right))), bnodes);
    scase.when(or(isNotNull(uri(left)), isNotNull(uri(right))), uris);
    return literalEqual(left, right, scase);
  }
View Full Code Here

  private SqlExpr literalEqual(ValueExpr left, ValueExpr right, SqlCase scase)
    throws UnsupportedRdbmsOperatorException
  {
    // TODO What about xsd:booleans?
    SqlExpr labels = eq(label(left), label(right));
    SqlExpr langs = and(eqIfNotNull(lang(left), lang(right)), labels.clone());
    SqlExpr numeric = eq(numeric(left), numeric(right));
    SqlExpr time = eq(time(left), time(right));

    SqlExpr bothCalendar = and(isNotNull(time(left)), isNotNull(time(right)));
    SqlExpr over14 = gt(abs(sub(time(left), time(right))), num(HR14 / 2));
    SqlExpr comparable = and(bothCalendar, or(eq(zoned(left), zoned(right)), over14));

    scase.when(or(isNotNull(lang(left)), isNotNull(lang(right))), langs);
    scase.when(and(simple(type(left)), simple(type(right))), labels.clone());
    scase.when(and(isNotNull(numeric(left)), isNotNull(numeric(right))), numeric);
    scase.when(comparable, time);
View Full Code Here

  }

  private SqlExpr termsEqual(ValueExpr left, ValueExpr right)
    throws UnsupportedRdbmsOperatorException
  {
    SqlExpr bnodes = eqIfNotNull(bNode(left), bNode(right));
    SqlExpr uris = eqIfNotNull(uri(left), uri(right));
    SqlCase scase = new SqlCase();
    scase.when(or(isNotNull(bNode(left)), isNotNull(bNode(right))), bnodes);
    scase.when(or(isNotNull(uri(left)), isNotNull(uri(right))), uris);
    return literalEqual(left, right, scase);
  }
View Full Code Here

      }
    }
    if (contexts.length > 0) {
      RdbmsResource[] ids = vf.asRdbmsResource(contexts);
      RefIdColumn var = new RefIdColumn(c);
      SqlExpr in = null;
      for (RdbmsResource id : ids) {
        NumberValue longValue;
        try {
          longValue = new NumberValue(vf.getInternalId(id));
        }
View Full Code Here

    for (String name : names) {
      ColumnVar l = lvars.get(name);
      ColumnVar r = rvars.get(name);
      if (!l.isImplied() && !r.isImplied()) {
        IdColumn rid = new IdColumn(r);
        SqlExpr filter = eq(rid, new IdColumn(l));
        if (r.isNullable()) {
          filter = or(isNull(rid), filter);
        }
        right.addFilter(filter);
      }
View Full Code Here

TOP

Related Classes of org.openrdf.sail.rdbms.algebra.base.SqlExpr

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.