Package de.fuberlin.wiwiss.d2rq.expr

Examples of de.fuberlin.wiwiss.d2rq.expr.Expression


 
  private void convertEquality(ExprFunction2 expr)
  {
    expr.getArg1().visit(this);
    expr.getArg2().visit(this);
    Expression e2 = expression.pop();
    Expression e1 = expression.pop();
   
    // TODO Expression.FALSE and Expression.TRUE are not constants
    if (e1.equals(Expression.FALSE))
      e1 = CONSTANT_FALSE;
    else if (e1.equals(Expression.TRUE))
      e1 = CONSTANT_TRUE;
    if (e2.equals(Expression.FALSE))
      e2 = CONSTANT_FALSE;
    else if (e2.equals(Expression.TRUE))
      e2 = CONSTANT_TRUE;
View Full Code Here


        List<NodeRelation> nodeRelations, Expr filter, ExprList allFilters) {
        List<NodeRelation> result = new ArrayList<NodeRelation>();
        boolean convertable = true;
        for (NodeRelation nodeRelation: nodeRelations) {
          // TODO: The transformation from Expr to Expression should happen in NodeRelation.select()
            Expression expression = TransformExprToSQLApplyer.convert(filter, nodeRelation);
            if (expression == null) {
              // the expression cannot be transformed to SQL
                convertable = false;
            } else if (expression.isTrue()) {
              // keep as is
            } else if (expression.isFalse()) {
                continue// skip
            } else {
              nodeRelation = nodeRelation.select(expression);
              if (nodeRelation.baseRelation().condition().isFalse()) continue;
            }
View Full Code Here

  public void testApplyToNewNameReturnsNewName() {
    assertEquals(col2, this.col1ToCol2.applyTo(col2));
  }
 
  public void testApplyToExpressionReplacesMappedColumns() {
    Expression e = SQLExpression.create("foo.col1=foo.col3");
    assertEquals(SQLExpression.create("foo.col2=foo.col3"), this.col1ToCol2.applyTo(e));
  }
View Full Code Here

   
    NodeRelation intvalue = search("table2", "intvalue", rels);
 
    Expr disjunction = new E_LogicalOr(new E_Equals(new ExprVar("o"),  NodeValue.makeNode("1", XSDDatatype.XSDint)), new E_Equals(new ExprVar("o"), NodeValue.makeNode("2", XSDDatatype.XSDint)));
   
    Expression result = TransformExprToSQLApplyer.convert(disjunction, intvalue);
    TypedNodeMaker nm = (TypedNodeMaker) intvalue.nodeMaker(Var.alloc("o"));
    Expression e1 = nm.valueMaker().valueExpression("1");
    Expression e2 = nm.valueMaker().valueExpression("2");
    Expression expected = e1.or(e2);
   
    assertEquals("?o = \"1\"^^xsd:int || ?o = \"2\"^^xsd:int", expected, result);
  }
View Full Code Here

   
    NodeRelation intvalue = search("table2", "intvalue", rels);
 
    Expr sameTerm = new E_SameTerm(new ExprVar("o"),  NodeValue.makeNode("1", XSDDatatype.XSDint));
   
    Expression result = TransformExprToSQLApplyer.convert(sameTerm, intvalue);
    TypedNodeMaker nm = (TypedNodeMaker) intvalue.nodeMaker(Var.alloc("o"));
    Expression expected = nm.valueMaker().valueExpression("1");
   
    assertEquals("sameTerm(?o, \"1\"^^xsd:int)", expected, result);
   
    sameTerm = new E_SameTerm(new ExprVar("o"),  NodeValue.makeNode("1", XSDDatatype.XSDdecimal));
   
View Full Code Here

TOP

Related Classes of de.fuberlin.wiwiss.d2rq.expr.Expression

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.